This repository has been archived by the owner on Mar 29, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
54 lines (48 loc) · 1.86 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
elifePipeline {
node('containers-jenkins-plugin') {
def commit
stage 'Checkout', {
checkout scm
commit = elifeGitRevision()
if (env.TAG_NAME) {
version = env.TAG_NAME - 'v'
} else {
version = 'develop'
}
}
stage 'Build and run tests', {
try {
sh "make IMAGE_TAG=${commit} REVISION=${commit} ci-build-and-test"
echo "Checking revision label..."
def image = DockerImage.elifesciences(this, 'sciencebeam-trainer-grobid-tools', commit)
echo "Reading revision label of image: ${image.toString()}"
def actualRevision = sh(
script: "./ci/docker-read-local-label.sh ${image.toString()} org.opencontainers.image.revision",
returnStdout: true
).trim()
echo "revision label: ${actualRevision} (expected: ${commit})"
assert actualRevision == commit
} finally {
sh "make ci-clean"
}
}
elifeMainlineOnly {
stage 'Merge to master', {
elifeGitMoveToBranch commit, 'master'
}
stage 'Push unstable image', {
def image = DockerImage.elifesciences(this, 'sciencebeam-trainer-grobid-tools', commit)
def unstable_image = image.addSuffixAndTag('_unstable', commit)
unstable_image.tag('latest').push()
unstable_image.push()
}
}
elifeTagOnly { tag ->
stage 'Push release image', {
def image = DockerImage.elifesciences(this, 'sciencebeam-trainer-grobid-tools', commit)
image.tag('latest').push()
image.tag(version).push()
}
}
}
}