forked from department-of-veterans-affairs/va.gov-cms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile.cd
79 lines (71 loc) · 1.83 KB
/
Jenkinsfile.cd
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
def shouldBail() {
// abort the job if there's a newer build going now
return currentBuild.nextBuild
}
pipeline {
agent any
stages {
stage('Checkout Code') {
steps {
checkout scm
}
}
stage('Build new AMI') {
when {
expression {
!shouldBail()
}
}
steps {
script {
commit = sh(returnStdout: true, script: "git rev-parse HEAD").trim()
}
build job: "builds/cms", parameters: [
booleanParam(name: 'release', value: false),
booleanParam(name: 'notify_slack', value: true),
stringParam(name: 'ref', value: commit),
booleanParam(name: 'force_rebuild', value: false)
], wait: true
}
}
stage('Deploy to dev') {
when {
expression {
!shouldBail()
}
}
steps {
sh 'echo SUCCESS, we are in DEV step'
build job: "deploys/cms-vagov-dev", parameters: [
stringParam(name: 'app', value: 'cms'),
booleanParam(name: 'notify_slack', value: true),
stringParam(name: 'ref', value: commit),
booleanParam(name: 'migration_status', value: false)
] , wait: false
}
}
stage('Deploy to staging') {
when {
expression {
!shouldBail()
}
}
steps {
build job: "deploys/cms-vagov-staging", parameters: [
stringParam(name: 'app', value: 'cms'),
booleanParam(name: 'notify_slack', value: true),
stringParam(name: 'ref', value: commit),
booleanParam(name: 'migration_status', value: false)
] , wait: false
}
}
}
post {
always {
cleanWs()
}
failure {
slackSend(channel: '#cms-team', color: 'danger', message: "${env.JOB_NAME} failed ${env.BUILD_URL}")
}
}
}