Permalink
Aug 24, 2016
Aug 24, 2016
Aug 24, 2016
Sep 13, 2016
Aug 24, 2016
Aug 24, 2016
Aug 24, 2016
Aug 24, 2016
Aug 24, 2016
Sep 13, 2016
Aug 24, 2016
Aug 24, 2016
Sep 13, 2016
Aug 24, 2016
Newer
100644
92 lines (73 sloc)
2.19 KB

2
3
stage 'Checkout'
4
5
checkout scm
6
7
stage 'Acquire util'
8

11
git([ url: "https://github.internet2.edu/docker/util.git",
12
credentialsId: "jenkins-github-access-token" ])
13
sh 'ls'

16
}

24
if(env.BRANCH_NAME == "master"){
25
tag = "latest"
26
}else{
27
tag = env.BRANCH_NAME
28
}
29
30
if(!imagename){

31
echo "You must define an imagename in common.bash"
32
currentBuild.result = 'FAILURE'

37
38
stage 'Build'
39
try{

41
} catch(error) {
42
def error_details = readFile('./debug');
43
def message = "BUILD ERROR: There was a problem building the shibboleth-sp image. \n\n ${error_details}"

44
sh "rm -f ./debug"
45
handleError(message)
46
}

51
stage 'Tests'
52

53
try{
54
sh 'bin/test.sh &> debug'
55
} catch(error) {
56
def error_details = readFile('./debug');
57
def message = "BUILD ERROR: There was a problem testing ${imagename}:${tag}. \n\n ${error_details}"
58
sh "rm -f ./debug"
59
handleError(message)
60
}
61

65
66
stage 'Push'

69
baseImg.push("$tag")
70
}

71
72
stage 'Notify'
73
74
slackSend color: 'good', message: "$maintainer/$imagename:$tag pushed to DockerHub"

75
}
76
77
def maintainer() {
78
def matcher = readFile('common.bash') =~ 'maintainer="(.+)"'
79
matcher ? matcher[0][1] : 'tier'
80
}
81
82
def imagename() {
83
def matcher = readFile('common.bash') =~ 'imagename="(.+)"'
84
matcher ? matcher[0][1] : null
85
}
86
87
def handleError(String message){
88
echo "${message}"
89
currentBuild.setResult("FAILED")
90
slackSend color: 'danger', message: "${message}"
91
sh 'exit 1'
92
}