forked from bitly/oauth2_proxy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
38 lines (32 loc) · 1.07 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
def imageName
def imageVersion
builderNode {
def cacheImageTag
if (env.CHANGE_ID) {
// Pull request, use target branch as cache image
cacheImageTag = env.CHANGE_TARGET
} else {
// Branch, use its last built thing as cache
cacheImageTag = env.BRANCH_NAME
}
// Special case for master branch, use 'latest' for tag name.
if (cacheImageTag == "master") {
cacheImageTag = "latest"
}
checkout scm
imageVersion = projectVersion()
stage("build image") {
imageName = buildDockerImage(repository: "ci-tool-ops/google-auth-proxy", cacheImageTag: cacheImageTag)
}
if (!env.CHANGE_ID) {
stage("promote to ${cacheImageTag}") {
// Branch- promote to its name for caching, and also to its imageVersion for posterity.
promoteDockerImage(imageName: imageName, toTags: [imageVersion, cacheImageTag])
}
if (env.BRANCH_NAME == 'aws-release-0.0.2') {
stage("deploy to dev-us-east-1") {
deployNomadService(group: "ci-tool-ops", service: "google-auth-proxy", stack: "dev-us-east-1", version: imageVersion)
}
}
}
}