-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
51 lines (43 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
47
48
49
50
51
jettyUrl = 'http://localhost:8081/'
def servers
stage 'Dev'
node {
checkout scm
servers = load 'servers.groovy'
mvn 'clean package'
dir('target') {stash name: 'war', includes: 'x.war'}
}
stage 'QA'
parallel(longerTests: {
runTests(servers, 30)
}, quickerTests: {
runTests(servers, 20)
})
stage name: 'Staging', concurrency: 1
node {
servers.deploy 'staging'
}
input message: "Does ${jettyUrl}staging/ look good?"
try {
checkpoint('Before production')
} catch (NoSuchMethodError _) {
echo 'Checkpoint feature available in CloudBees Jenkins Enterprise.'
}
stage name: 'Production', concurrency: 1
node {
sh "wget -O - -S ${jettyUrl}staging/"
echo 'Production server looks to be alive'
servers.deploy 'production'
echo "Deployed to ${jettyUrl}production/"
}
def mvn(args) {
sh "${tool 'M3'}/bin/mvn ${args}"
}
def runTests(servers, duration) {
node {
checkout scm
servers.runWithServer {id ->
mvn "-f sometests test -Durl=${jettyUrl}${id}/ -Dduration=${duration}"
}
}
}