-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathJenkinsfile
58 lines (55 loc) · 1.77 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
pipeline {
agent any // configure here if you need any agent
options {
buildDiscarder(logRotator(numToKeepStr: '10')) // configurable
timeout(time: 1, unit: 'DAYS') // configurable
}
stages {
stage('Build release branch and Upload to Nexus') {
when {
branch 'master' // release branch 'master'
}
steps {
withMaven(){ // mimic maven-plugin behaviour?
sh "./mvnw clean source:jar deploy" // for temporary nodes
}
}
}
stage('Build maintenance branch') {
when {
expression { "${env.BRANCH_NAME}" =~ /v\d+\.x/ } // maintenance release branch 'v1.x', 'v2.x'
}
steps {
withMaven(){ // mimic maven-plugin behaviour?
sh "./mvnw clean source:jar deploy" // for temporary nodes
}
}
}
stage('Build Pull Request') {
when {
expression { env.CHANGE_ID != null } // Pull request
}
steps {
withMaven(){ // mimic maven-plugin behaviour?
sh "./mvnw clean verify" // for temporary nodes
}
}
}
stage('Build Development/Feature branch') { // in no special case so not sure about the stage name to use..
when {
allOf {
expression { env.CHANGE_ID == null } // Pull request
expression { "${env.BRANCH_NAME}" !=~ /v\d+\.x/ }
expression { "${env.BRANCH_NAME}" != 'master' }
}
}
steps {
echo "Build something interesting"
// Don't fail the build on test failure, let withMaven mark as unstable: -DtestFailureIgnore=true
withMaven(){ // mimic maven-plugin behaviour?
sh "./mvnw -DtestFailureIgnore=true -Dmaven.javadoc.failOnError=false clean verify --fail-never" // for temporary nodes
}
}
}
}
}