Skip to content
Permalink
Newer
Older
100644 74 lines (54 sloc) 1.6 KB
1
node('docker') {
3
stage 'Checkout'
4
5
checkout scm
6
7
stage 'Acquire util'
8
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" ])
23
}
24
25
stage 'Build'
26
27
def maintainer = maintainer()
28
def imagename = imagename()
29
def tag = env.BRANCH_NAME
30
if(!imagename){
31
echo "You must define an imagename in common.bash"
32
currentBuild.result = 'FAILURE'
33
}
34
if(maintainer){
35
echo "Building ${maintainer}:${tag} for ${maintainer}"
36
}
37
38
sh 'bin/rebuild.sh'
42
sh 'bin/ci-run.sh && sleep 60'
44
stage 'Tests'
45
46
sh 'bin/test.sh'
47
// should build a finally construct here
48
stage 'Stop container'
49
50
sh 'bin/ci-stop.sh'
Jim Van Fleet
Aug 8, 2016
51
52
stage 'Push'
53
54
docker.withRegistry('https://registry.hub.docker.com/', 'dockerhub-bigfleet') {
55
def baseImg = docker.build("$maintainer/$imagename")
56
baseImg.push("$tag")
57
}
58
59
}
60
61
def maintainer() {
62
def matcher = readFile('common.bash') =~ 'maintainer="(.+)"'
63
matcher ? matcher[0][1] : 'tier'
64
}
65
66
def imagename() {
67
def matcher = readFile('common.bash') =~ 'imagename="(.+)"'
68
matcher ? matcher[0][1] : null
69
}
71
def version() {
72
def matcher = readFile('common.bash') =~ 'version="(.+)"'
73
matcher ? matcher[0][1] : null
You can’t perform that action at this time.