-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathJenkinsfile
40 lines (36 loc) · 1.1 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
node {
def app
def image = 'careydevelopment/crm-service'
def branch = scm.branches[0].name.substring(2)
try {
stage('Clone repository') {
git branch: branch,
credentialsId: 'GitHub Credentials',
url: 'https://github.com/careydevelopment/crm-service.git'
}
stage('Build JAR') {
docker.image('maven:3.6.3-jdk-11').inside('-v /root/.m2:/root/.m2') {
sh 'mvn -B -Dmaven.test.skip=true clean package'
stash includes: '**/target/crm-service.jar', name: 'jar'
}
}
stage('Build Image') {
unstash 'jar'
app = docker.build image
}
stage('Push') {
docker.withRegistry('https://registry.hub.docker.com', 'docker-hub') {
app.push("${env.BUILD_NUMBER}")
app.push("latest")
}
}
} catch (e) {
echo 'Error occurred during build process!'
echo e.toString()
currentBuild.result = 'FAILURE'
} finally {
//skipping tests as we need environment setup (e.g., remote properties files)
//will get to it later
//junit '**/target/surefire-reports/TEST-*.xml'
}
}