forked from ianmiell/shutit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
50 lines (44 loc) · 1.61 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
#!groovy
def nodename='cage'
def builddir='shutit-' + env.BUILD_NUMBER
def branch=env.BRANCH_NAME
//nodename='welles'
//def nodetest() {
// sh('echo alive on $(hostname)')
//}
//// By default we use the 'welles' node, which could be offline.
//try {
// // Give it 5 seconds to run the nodetest function
// timeout(time: 5, unit: 'SECONDS') {
// node(nodename) {
// nodetest()
// }
// }
//} catch(err) {
// // Uh-oh. welles not available, so use 'cage'.
// nodename='cage'
//}
try {
lock('shutit_tests') {
stage('setupenv') {
node(nodename) {
sh 'mkdir -p ' + builddir
dir(builddir) {
checkout([$class: 'GitSCM', branches: [[name: '*/' + branch]], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'SubmoduleOption', disableSubmodules: false, parentCredentials: false, recursiveSubmodules: true, reference: '', trackingSubmodules: false]], submoduleCfg: [], userRemoteConfigs: [[url: 'https://github.com/ianmiell/shutit']]])
}
}
}
stage('shutit_tests') {
node(nodename) {
dir(builddir + '/shutit-test') {
sh('PATH=$(pwd)/..:${PATH} ./run.sh -s tk.shutit.shutit_test shutit_branch ' + branch + ' -l info 2>&1')
}
}
}
}
mail bcc: '', body: '''See: http://jenkins.meirionconsulting.tk/job/shutit''', cc: '', from: '[email protected]', replyTo: '', subject: 'Build OK', to: '[email protected]'
} catch(err) {
mail bcc: '', body: '''See: http://jenkins.meirionconsulting.tk/job/shutit
''' + err, cc: '', from: '[email protected]', replyTo: '', subject: 'Build failure', to: '[email protected]'
throw(err)
}