-
Notifications
You must be signed in to change notification settings - Fork 152
/
flow.groovy
48 lines (46 loc) · 1.42 KB
/
flow.groovy
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
#!groovy
// Orig Ref From :: https://documentation.cloudbees.com/docs/cookbook/_setting_up_a_basic_build_pipeline_with_jenkins.html
def devQAStaging() {
env.PATH="${tool 'Maven 3.x'}/bin:${env.PATH}"
stage 'Dev'
sh 'mvn clean install package'
archive 'target/x.war'
try {
checkpoint('Archived war')
} catch (NoSuchMethodError _) {
echo 'Checkpoint feature available in Jenkins Enterprise by CloudBees.'
}
stage 'QA'
parallel(longerTests: {
runWithServer {url ->
sh "mvn -f sometests/pom.xml test -Durl=${url} -Dduration=30"
}
}, quickerTests: {
runWithServer {url ->
sh "mvn -f sometests/pom.xml test -Durl=${url} -Dduration=20"
}
})
stage name: 'Staging', concurrency: 1
deploy 'target/x.war', 'staging'
}
def production() {
input message: "Does http://localhost:8888/staging/ look good?"
try {
checkpoint('Before production')
} catch (NoSuchMethodError _) {
echo 'Checkpoint feature available in Jenkins Enterprise by CloudBees.'
}
stage name: 'Production', concurrency: 1
node {
unarchive mapping: ['target/x.war' : 'x.war']
deploy 'target/x.war', 'production'
echo 'Deployed to http://localhost:8888/production/'
}
}
def deploy(war, id) {
sh "cp ${war} /tmp/webapps/${id}.war"
}
def undeploy(id) {
sh "rm /tmp/webapps/${id}.war"
}
return this;