forked from smart-on-fhir/smart-launcher-v2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
pipeline { | ||
agent any | ||
options { | ||
buildDiscarder(logRotator(numToKeepStr: '10')) | ||
} | ||
environment { | ||
AWS_ACCOUNTS = '475186532573' | ||
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 INTERNAL to PROD' | ||
sh 'docker run -v /var/run/docker.sock:/var/run/docker.sock $AWS_ENV $GIT_ENV cicd promote smart-launcher-v2 internal' | ||
} | ||
} | ||
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' | ||
} | ||
} | ||
stage('Healthcheck') { | ||
steps { | ||
echo 'Checking health of service' | ||
sh 'curl -m 10 https://smart-launcher-v2.elimuinformatics.com/' | ||
} | ||
} | ||
} | ||
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>)" | ||
} | ||
} | ||
} |