-
Notifications
You must be signed in to change notification settings - Fork 38
/
Jenkinsfile
46 lines (42 loc) · 1.05 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
node("mavenwithnexus") {
checkout scm
def isCanary = false
def isTimeout = false
try {
timeout(time: 24, unit: 'HOURS') {
isCanary = input( id:'CanaryDeployment', message: 'Do a Canary Release ?',
parameters: [
[$class: 'BooleanParameterDefinition', defaultValue: true, description: '',
name: 'Please confirm to do a canary release']
])
}
}catch(err) {
def user = err.getCauses()[0].getUser()
if('SYSTEM' == user.toString()){
isTimeout = true
}else{
isCanary = false
echo "Aborted by: [${user}]"
}
}
if(isTimeout) {
echo 'Since no confirmation recevied on time, doing nothing'
currentBuild.result = 'FAILURE'
}else{
if(isCanary) {
stage("Test") {
sh "mvn -B test"
}
stage("Deploy") {
sh "mvn -DskipTests clean -Pcanary fabric8:deploy"
}
}else{
stage("Test") {
sh "mvn -B test"
}
stage("Deploy") {
sh "mvn -DskipTests clean fabric8:deploy"
}
}
}
}