From cf209ef87e91ad54a96cec47b1f16b043e5603f1 Mon Sep 17 00:00:00 2001
From: Lorenzo Del Pianta <lorenzo.del.pianta.perez@cern.ch>
Date: Tue, 4 Feb 2025 10:55:34 +0100
Subject: [PATCH] Update .gitlab-ci.yml

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

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index c2603b347..be7f76fec 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -11,13 +11,16 @@ stages:
     name: gcr.io/kaniko-project/executor:debug
     entrypoint: [""]
   script:
-      # This is not the common Authentication config, unknown reason why common config fails
+      # define script variables, they are passed in build time
+    - IMAGE_DESTINATION = ${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:${TAG}
+      # Prepare Kaniko configuration file
     - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
-    # - echo "{\"auths\":{\"$CI_REGISTRY\":{\"auth\":\"$(echo -n ${CI_REGISTRY_USER}:${CI_REGISTRY_PASSWORD} | base64)\"}}}" > /kaniko/.docker/config.json
-    - /kaniko/executor --context "$CI_PROJECT_DIR/$CONTEXT_DIR" --dockerfile "$CI_PROJECT_DIR/$CONTEXT_DIR/$DOCKERFILE"
+     # Build and push the image from the Dockerfile at the root of the project.
+    - /kaniko/executor --context "$CI_PROJECT_DIR/$CONTEXT_DIR" --dockerfile "$CI_PROJECT_DIR/$CONTEXT_DIR/$DOCKERFILE" 
       --destination "${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:${TAG}" $BUILD_ARGS
       # Print the full registry path of the pushed image
     - echo "Image pushed to ${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:${TAG}"
+    - echo "${IMAGE_DESTINATION}"
 
 environment:
   stage: environment
-- 
GitLab