-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathJenkinsfile
67 lines (67 loc) · 1.93 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
56
57
58
59
60
61
62
63
64
65
66
67
pipeline {
agent {
docker {
image 'junkdog/mvn-3-jdk8'
// -u root for /root/.m2 to be resolved
args '-v /root/.m2:/root/.m2 -u root'
}
}
environment {
VERSION = readMavenPom().getVersion()
IS_SNAPSHOT = readMavenPom().getVersion().endsWith("-SNAPSHOT")
}
options {
skipStagesAfterUnstable()
}
triggers {
// nightly deploy job
cron('H H * * *')
}
stages {
stage ('Initialize') {
steps {
echo "Building ${env.VERSION}"
}
}
stage ('Build and Test') {
when {
// integration test modules don't update versions with
// the maven release plugin; this is done in a separate
// commit, so skipping the tests until releases are done
// through this pipeline
environment name: 'IS_SNAPSHOT', value: 'YES'
}
steps {
sh 'mvn clean integration-test -B'
}
post {
always {
junit '**/target/surefire-reports/*.xml'
archiveArtifacts allowEmptyArchive: true, artifacts: '*/target/*.jar'
}
}
}
stage ('Build (skip tests)') {
when {
environment name: 'IS_SNAPSHOT', value: 'NO'
}
steps {
sh 'mvn clean integration-test -DskipTests -B'
}
post {
archiveArtifacts allowEmptyArchive: true, artifacts: '*/target/*.jar'
}
}
stage('Deploy -SNAPSHOT') {
when {
allOf {
branch 'develop'
triggeredBy 'TimerTrigger'
}
}
steps {
sh 'mvn clean deploy -DskipTests -B'
}
}
}
}