-
Notifications
You must be signed in to change notification settings - Fork 14
/
Jenkinsfile
47 lines (47 loc) · 1.75 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
pipeline {
agent none
stages {
stage('container') {
agent {
dockerfile {
args '-v ${HOME}/.m2:/home/builder/.m2 -v ${HOME}/.grails:/home/builder/.grails -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_release') {
when { branch "master" }
steps {
withCredentials([usernamePassword(credentialsId: env.GIT_CREDENTIALS_ID, passwordVariable: 'GIT_PASSWORD', usernameVariable: 'GIT_USERNAME')]) {
sh './bumpversion.sh'
}
}
}
stage('test') {
steps {
sh 'mvn -B clean test'
}
}
stage('package') {
steps {
sh 'grails -DARTIFACT_BUILD_NUMBER=${BUILD_NUMBER} -Dgrails.work.dir=${WORKSPACE}/target clean --non-interactive --plain-output'
sh 'grails -DARTIFACT_BUILD_NUMBER=${BUILD_NUMBER} -Dgrails.work.dir=${WORKSPACE}/target war --non-interactive --plain-output'
}
}
}
post {
success {
dir('target/') {
archiveArtifacts artifacts: '*.war', fingerprint: true, onlyIfSuccessful: true
}
}
}
}
}
}