From 8f2f3e0925a042afdce0611a758d7ee79bb4110f Mon Sep 17 00:00:00 2001
From: Konrad Botor <kbotor@syncad.com>
Date: Thu, 1 Dec 2022 13:53:37 +0100
Subject: [PATCH] Fixed setting tag variable during Docker image build jobs

---
 .gitlab-ci.yml | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 1c5d4e9..3031f74 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -80,14 +80,13 @@ lint_python_scripts:
       echo -e "\e[0Ksection_end:$(date +%s):login\r\e[0K"
   script: 
     - |
-      tag=""
       echo -e "\e[0Ksection_start:$(date +%s):tag[collapsed=true]\r\e[0KDetermining tag for the new image..."
       if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then
         echo "Running on default branch '$CI_DEFAULT_BRANCH': tag = 'latest'"
-        tag="latest"
+        export tag="latest"
       else
         echo "Running on branch '$CI_COMMIT_BRANCH': tag = $CI_COMMIT_REF_SLUG"
-        tag="$CI_COMMIT_REF_SLUG" 
+        export tag="$CI_COMMIT_REF_SLUG" 
       fi
       echo -e "\e[0Ksection_end:$(date +%s):tag\r\e[0K"
       echo -e "\e[0Ksection_start:$(date +%s):build[collapsed=true]\r\e[0KBaking image "$CI_REGISTRY_IMAGE/$BUILD_TARGET${tag}"..."
-- 
GitLab