From 6f58ce2c6166627f309d14eb935c0175403799d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Tue, 21 Feb 2023 16:03:14 +0100 Subject: [PATCH] ci: add commit to Docker image tag pushed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jakub SokoĊ‚owski --- _assets/ci/Jenkinsfile.docker | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/_assets/ci/Jenkinsfile.docker b/_assets/ci/Jenkinsfile.docker index b8707b63f..0a7bdff51 100644 --- a/_assets/ci/Jenkinsfile.docker +++ b/_assets/ci/Jenkinsfile.docker @@ -33,24 +33,26 @@ pipeline { REPO = "${env.WORKSPACE}/src/github.com/status-im/status-go" GOPATH = "${env.WORKSPACE}" PATH = "/usr/local/go/bin:${env.PATH}:${env.GOPATH}/bin" - /* docker image settings */ - IMAGE_NAME = "statusteam/status-go" - IMAGE_TAG = "deploy-test" + /* Makefile parameters */ + DOCKER_IMAGE_NAME = 'statusteam/status-go' + DOCKER_IMAGE_CUSTOM_TAG = "ci-build-${utils.gitCommit()}" + /* Release docker image settings. */ + RELEASE_IMAGE_TAG = "deploy-test" } stages { stage('Prep') { steps { dir(env.REPO) { script { - println("Output: ${env.IMAGE_NAME}:${env.IMAGE_TAG}") + println("Output: ${env.DOCKER_IMAGE_NAME}:${env.RELEASE_IMAGE_TAG}") } } } } stage('Build') { steps { dir(env.REPO) { script { sh 'make docker-image' - image = docker.image("${env.IMAGE_NAME}:v${utils.getVersion()}") + image = docker.image("${env.DOCKER_IMAGE_NAME}:${env.DOCKER_IMAGE_CUSTOM_TAG}") } } } } stage('Push') { steps { dir(env.REPO) { script { withDockerRegistry([credentialsId: "dockerhub-statusteam-auto", url: ""]) { - image.push() + image.push("v${utils.getVersion()}-${utils.gitCommit()}") } } } } } @@ -58,7 +60,7 @@ pipeline { when { expression { params.RELEASE == true } } steps { dir(env.REPO) { script { withDockerRegistry([credentialsId: "dockerhub-statusteam-auto", url: ""]) { - image.push(env.IMAGE_TAG) + image.push(env.RELEASE_IMAGE_TAG) } } } } } } // stages