diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 1c5d4e99c44613df85783744081b022688a3dc35..3031f74f8239dc50c959219c4965cffe95115fa5 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}"..."