This repository has been archived by the owner on Jan 4, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Jenkinsfile
48 lines (48 loc) · 1.91 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
pipeline {
agent none
stages {
stage('container') {
agent {
dockerfile {
args '-v ${HOME}/.m2:/home/builder/.m2 -v ${HOME}/.grails:/home/builder/.grails -v ${HOME}/.ivy2:/home/builder/.ivy2 -v ${HOME}/bin:${HOME}/bin'
additionalBuildArgs '--build-arg BUILDER_UID=$(id -u)'
}
}
stages {
stage('clean') {
steps {
sh 'git reset --hard'
sh 'git clean -xffd'
}
}
stage('set_version') {
when { not { branch "master" } }
steps {
sh './bumpversion.sh build'
}
}
stage('release') {
when { branch 'master' }
steps {
withCredentials([usernamePassword(credentialsId: env.GIT_CREDENTIALS_ID, passwordVariable: 'GIT_PASSWORD', usernameVariable: 'GIT_USERNAME')]) {
sh './bumpversion.sh release'
}
}
}
stage('package') {
steps {
sh 'grails -Dhttps.protocols=TLSv1.2 -DARTIFACT_BUILD_NUMBER=${BUILD_NUMBER} -Dgrails.work.dir=${WORKSPACE}//target clean --non-interactive --plain-output'
sh 'grails -Dhttps.protocols=TLSv1.2 -DARTIFACT_BUILD_NUMBER=${BUILD_NUMBER} -Dgrails.work.dir=${WORKSPACE}//target prod war --non-interactive --plain-output'
}
}
}
post {
success {
dir('target/') {
archiveArtifacts artifacts: '*.war', fingerprint: true, onlyIfSuccessful: true
}
}
}
}
}
}