forked from loris-imageserver/loris-docker
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Jenkinsfile
73 lines (65 loc) · 2.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
elifePipeline {
def commit
stage 'Checkout', {
checkout scm
commit = elifeGitRevision()
}
node('containers-jenkins-plugin') {
stage 'Build images', {
checkout scm
sh "IMAGE_TAG=${commit} ./build.sh"
}
stage 'Smoke tests', {
try {
sh "IMAGE_TAG=${commit} ./run.sh &"
sh "docker-wait-healthy loris 60"
} finally {
sh "docker stop loris"
}
}
stage 'Push image', {
image = DockerImage.elifesciences(this, "loris", commit)
elifePullRequestOnly {
def branchName = env.CHANGE_BRANCH
def tagName = branchName.replaceAll("/", "_")
image.tag(tagName).push()
}
elifeMainlineOnly {
stage 'Push image', {
image.push()
}
}
}
}
elifeMainlineOnly {
stage 'Deploy on ci, continuumtest', {
def deployments = [
ci: {
lock('iiif--ci') {
builderDeployRevision 'iiif--ci', commit
builderSmokeTests 'iiif--ci', '/opt/loris'
}
},
continuumtest: {
lock('iiif--continuumtest') {
builderDeployRevision 'iiif--continuumtest', commit
builderSmokeTests 'iiif--continuumtest', '/opt/loris'
}
}
]
parallel deployments
}
stage 'Deploy to prod', {
lock('iiif--prod') {
builderDeployRevision 'iiif--prod', commit, 'blue-green'
builderSmokeTests 'iiif--prod', '/opt/loris'
}
}
node('containers-jenkins-plugin') {
stage 'Tag image', {
image = DockerImage.elifesciences(this, "loris", commit)
image.tag('latest').push()
}
}
}
}