-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
55 lines (54 loc) · 2.06 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
pipeline {
options {
buildDiscarder(logRotator(numToKeepStr: '5', daysToKeepStr: '90', artifactNumToKeepStr: '5'))
}
agent any
stages {
stage('Build') {
steps {
sh 'mvn clean package'
junit '**/target/surefire-reports/*.xml'
stash includes: '**/target/*.jar', name: 'dccweb'
}
}
stage('Integration') {
when { branch 'master' }
steps {
unstash 'dccweb'
sh 'mvn verify'
}
}
stage('Sonar') {
when { branch 'master' }
steps {
unstash 'dccweb'
sh 'mvn sonar:sonar'
}
}
stage('Archive') {
when { branch 'master' }
steps {
unstash 'dccweb'
archiveArtifacts artifacts: 'dcc-webapp/target/*.jar', fingerprint: true
archiveArtifacts artifacts: 'dcc-webapp/target/*.zip', fingerprint: true
archiveArtifacts artifacts: 'dcc-webapp/target/*.tar.gz', fingerprint: true
}
}
stage('release') {
when { branch 'develop' }
steps {
checkout([
$class: 'GitSCM',
branches: [[name: env.BRANCH_NAME]],
extensions: [[$class: 'LocalBranch', localBranch: env.BRANCH_NAME]],
userRemoteConfigs: [[credentialsId: 'GITHUB', url: 'https://github.com/shawnbelton/dccweb.git']]
])
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'GITHUB', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD']]) {
sh "git checkout -B develop"
sh "mvn -B -Dgit.user=$USERNAME -Dgit.password='$PASSWORD' -DpushReleases=false jgitflow:release-start"
sh "mvn -B -Dgit.user=$USERNAME -Dgit.password='$PASSWORD' -DpushReleases=true jgitflow:release-finish"
}
}
}
}
}