forked from zooniverse/tove
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
63 lines (56 loc) · 1.41 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
#!groovy
pipeline {
agent none
options {
disableConcurrentBuilds()
}
stages {
stage('Build Docker image') {
agent any
steps {
script {
def dockerRepoName = 'zooniverse/tove'
def dockerImageName = "${dockerRepoName}:${GIT_COMMIT}"
def newImage = docker.build(dockerImageName)
if (BRANCH_NAME == 'master') {
stage('Update latest tag') {
newImage.push()
newImage.push('latest')
}
}
}
}
}
stage('Deploy staging to Kubernetes') {
when { branch 'master' }
agent any
steps {
sh "sed 's/__IMAGE_TAG__/${GIT_COMMIT}/g' kubernetes/deployment-staging.tmpl | kubectl apply --record -f -"
}
}
}
post {
success {
script {
if (BRANCH_NAME == 'master' || env.TAG_NAME == 'production-release') {
slackSend (
color: '#00FF00',
message: "SUCCESSFUL: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})",
channel: "#ops"
)
}
}
}
failure {
script {
if (BRANCH_NAME == 'master' || env.TAG_NAME == 'production-release') {
slackSend (
color: '#FF0000',
message: "FAILED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})",
channel: "#ops"
)
}
}
}
}
}