From 59fb153aed1f78c790381226916c199f709faa4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andre=CC=81s=20Moschini?= Date: Mon, 28 Dec 2020 12:24:43 -0300 Subject: [PATCH] chore(build): publish images to both registries fromdoppler and dopplerdock --- Jenkinsfile | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index effeffbc..c71951e8 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -77,6 +77,67 @@ pipeline { } } } + stage('Publish in dopplerdock') { + environment { + DOCKER_CREDENTIALS_ID = "dockerhub_dopplerdock" + DOCKER_IMAGE_NAME = "dopplerdock/doppler-for-shopify" + } + stages { + stage('Publish pre-release images from pull request') { + when { + changeRequest target: 'master' + } + steps { + withDockerRegistry(credentialsId: "${DOCKER_CREDENTIALS_ID}", url: "") { + sh 'sh build-n-publish.sh --image=${DOCKER_IMAGE_NAME} --commit=${GIT_COMMIT} --name=pr-${CHANGE_ID}' + } + } + } + stage('Publish pre-release images from master') { + when { + branch 'master' + } + steps { + withDockerRegistry(credentialsId: "${DOCKER_CREDENTIALS_ID}", url: "") { + sh 'sh build-n-publish.sh --image=${DOCKER_IMAGE_NAME} --commit=${GIT_COMMIT} --name=master' + } + } + } + stage('Publish pre-release images from INT') { + when { + branch 'INT' + } + steps { + withDockerRegistry(credentialsId: "${DOCKER_CREDENTIALS_ID}", url: "") { + sh 'sh build-n-publish.sh --image=${DOCKER_IMAGE_NAME} --commit=${GIT_COMMIT} --name=INT' + } + } + } + stage('Publish pre-release images from PROD') { + // Temporal build for testing easily in production + when { + branch 'PROD' + } + steps { + withDockerRegistry(credentialsId: "${DOCKER_CREDENTIALS_ID}", url: "") { + sh 'sh build-n-publish.sh --image=${DOCKER_IMAGE_NAME} --commit=${GIT_COMMIT} --name=PROD' + } + } + } + stage('Publish final version images') { + when { + expression { + return isVersionTag(readCurrentTag()) + } + } + steps { + withDockerRegistry(credentialsId: "${DOCKER_CREDENTIALS_ID}", url: "") { + sh 'sh build-n-publish.sh --image=${DOCKER_IMAGE_NAME} --commit=${GIT_COMMIT} --version=${TAG_NAME}' + } + } + } + } + } } }