diff --git a/Jenkinsfile-prod b/Jenkinsfile-prod new file mode 100644 index 0000000..c1b9cbc --- /dev/null +++ b/Jenkinsfile-prod @@ -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>)" + } + } +}