forked from smart-on-fhir/smart-launcher-v2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile-prod
47 lines (47 loc) · 1.38 KB
/
Jenkinsfile-prod
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
pipeline {
agent { label 'ecs' }
options {
buildDiscarder(logRotator(numToKeepStr: '10'))
}
environment {
AWS_CREDENTIALS = credentials('AWS-KEYS')
AWS_ENV = """${sh(
returnStdout: true,
script: 'env | awk -F= \'/^AWS/ {print "-e " $1}\''
)}"""
GIT_ENV = """${sh(
returnStdout: true,
script: 'env | awk -F= \'/^GIT/ {print "-e " $1}\''
)}"""
}
stages {
stage('Setup') {
steps {
sh '''
docker pull $CICD_ECR_REGISTRY/cicd:latest
docker tag $CICD_ECR_REGISTRY/cicd:latest cicd:latest
'''
}
}
stage('Promote') {
steps {
echo 'Promoting from STAGE to PROD'
sh 'docker run -v /var/run/docker.sock:/var/run/docker.sock $AWS_ENV $GIT_ENV cicd promote smart-launcher-v2 stage'
}
}
stage('Wait') {
steps {
echo 'Waiting for service to reach steady state'
sh 'docker run -v /var/run/docker.sock:/var/run/docker.sock $AWS_ENV cicd wait smart-launcher-v2 prod'
}
}
}
post {
unsuccessful {
slackSend color: 'danger', channel: '#product-ops-prod', message: "Pipeline Failed: ${env.JOB_NAME} ${env.BUILD_NUMBER} (<${env.BUILD_URL}|Open>)"
}
fixed {
slackSend color: 'good', channel: '#product-ops-prod', message: "Pipeline Ran Successfully: ${env.JOB_NAME} ${env.BUILD_NUMBER} (<${env.BUILD_URL}|Open>)"
}
}
}