-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
47 lines (46 loc) · 1.34 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
#!/usr/bin/env groovy
pipeline {
agent { label 'master' }
options {
skipDefaultCheckout()
timeout(time: 30, unit: 'MINUTES')
timestamps()
buildDiscarder(logRotator(numToKeepStr: '30'))
}
environment {
TERM_FLAGS=" "
}
stages {
stage('Initial cleanup and checkout') {
steps {
sh 'if [ $(docker ps -aq | wc -l) -gt 0 ] ; then docker rm -f $(docker ps -aq) ; fi'
sh 'sudo chown -R ${USER}:${USER} .'
deleteDir()
checkout scm
}
}
stage('Deploy: staging') {
when {
expression {return env.BRANCH_NAME.equals('master')}
}
steps {
echo 'Deploy to staging environment'
sh 'gcloud auth list'
sh 'make build/docker/deployable publish'
sh 'make deploy/staging'
}
}
stage('Deploy: production') {
when {
expression {
GIT_TAG = sh(returnStdout: true, script: 'git tag --contains HEAD')
return GIT_TAG != ''
}
}
steps {
echo 'Deploy to production environment'
sh 'make publish deploy/production'
}
}
}
}