Skip to content
Permalink
Newer
Older
100644 83 lines (61 sloc) 1.76 KB
1
node('docker') {
3
stage 'Checkout'
4
5
checkout scm
7
stage 'Acquire util'
9
sh 'mkdir -p bin'
10
dir('bin'){
11
git([ url: "https://github.internet2.edu/docker/util.git",
12
credentialsId: "jenkins-github-access-token" ])
13
sh 'ls'
14
sh 'mv bin/* .'
15
}
17
stage 'Acquire conftree'
18
19
sh 'mkdir -p root'
20
dir('root'){
21
git([ url: "https://github.internet2.edu/docker/shib-idp-conftree.git",
22
branch: "test", credentialsId: "jenkins-github-access-token" ])
25
stage 'Build'
26
27
def maintainer = maintainer()
28
def imagename = imagename()
29
def tag
30
31
// Tag images created on master branch with 'latest'
32
if(env.BRANCH_NAME == "master"){
33
tag = "latest"
34
}else{
35
tag = env.BRANCH_NAME
36
}
37
38
if(!imagename){
39
echo "You must define an imagename in common.bash"
40
currentBuild.result = 'FAILURE'
41
}
42
if(maintainer){
43
echo "Building ${maintainer}:${tag} for ${maintainer}"
44
echo "Building ${maintainer} for ${maintainer}"
45
}
46
47
sh 'bin/rebuild.sh'
51
sh 'bin/ci-run.sh && sleep 60'
53
stage 'Tests'
55
sh 'bin/test.sh'
56
// should build a finally construct here
57
stage 'Stop container'
Jim Van Fleet
Aug 8, 2016
61
stage 'Push'
62
63
docker.withRegistry('https://registry.hub.docker.com/', 'dockerhub-bigfleet') {
64
def baseImg = docker.build("$maintainer/$imagename")
65
baseImg.push("$tag")
66
}
67
68
}
69
70
def maintainer() {
71
def matcher = readFile('common.bash') =~ 'maintainer="(.+)"'
72
matcher ? matcher[0][1] : 'tier'
73
}
74
75
def imagename() {
76
def matcher = readFile('common.bash') =~ 'imagename="(.+)"'
77
matcher ? matcher[0][1] : null
78
}
80
def version() {
81
def matcher = readFile('common.bash') =~ 'version="(.+)"'
82
matcher ? matcher[0][1] : null
You can’t perform that action at this time.