-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile_build
41 lines (37 loc) · 1.28 KB
/
Jenkinsfile_build
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
void getVarsSetup() {
VERSION = sh(returnStdout: true, script: 'grep "version:" value.yaml | cut -d" " -f2').trim()
}
pipeline {
agent none
stages {
stage("Build release image.") {
// when {
// branch 'release-*'
// beforeAgent true
// }
environment {
GOOGLE_CREDENTIALS = credentials('NPE_GCR_CARBON_CREDENTIALS')
}
agent { label 'docker' }
steps {
script {
getVarsSetup()
sh 'echo "$GOOGLE_CREDENTIALS" > keyfile.json'
sh 'docker login -u _json_key -p "$(cat keyfile.json)" https://gcr.io'
sh "docker build . -t gcr.io/gcp-ushi-carbon-svcs-dev/carbon-telemetry-components:${BRANCH_NAME}"
sh "docker push gcr.io/gcp-ushi-carbon-svcs-dev/carbon-telemetry-components:${BRANCH_NAME}"
}
}
}
}
post {
failure {
script {
mail (to: '[email protected]',
subject: "Job '${env.JOB_NAME}' (${env.BUILD_NUMBER}) failed.",
body: "Please visit ${env.BUILD_URL} for further information."
)
}
}
}
}