From f71cf1450e5dc68c08870dada79c2dc995163a6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Thu, 18 May 2023 11:03:52 +0200 Subject: [PATCH] ci: add deploy tag to commit to avoid race conditions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When parallel builds for different environments run on the same host at the same time then the one that finishes last overwrites the Docker image that was built first, since the commit will be the same. "So the last shall be first, and the first last: for many be called, but few chosen." Matthew 20:16, King James Bible Signed-off-by: Jakub SokoĊ‚owski --- Jenkinsfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6869169aa..c5e01c28c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -63,8 +63,9 @@ pipeline { stage('Build') { steps { script { dir("spiffworkflow-${params.COMPONENT}") { + /* Tag and Commit is combined to avoid clashes of parallel builds. */ image = docker.build( - "${params.DOCKER_NAME}:${env.GIT_COMMIT.take(8)}", + "${params.DOCKER_NAME}:${params.DOCKER_TAG}-${env.GIT_COMMIT.take(8)}", "--label=commit='${env.GIT_COMMIT.take(8)}' ." ) }