From b07b1aa63509648748355c63b2a3a975901f78bd Mon Sep 17 00:00:00 2001
From: Lorenzo Pagliai <lorenzo.pagliai@seco.com>
Date: Thu, 30 Mar 2023 10:20:22 +0200
Subject: [PATCH] [BUILD BRANCH] Use the refs/tags/${CI_COMMIT_TAG}

* When a tag occurs the repo tool use the reference to the tag instead
of the head of the MASTER_BRANCH
---
 manifest-pipeline-yocto.yml | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/manifest-pipeline-yocto.yml b/manifest-pipeline-yocto.yml
index 58f1328..ee93285 100644
--- a/manifest-pipeline-yocto.yml
+++ b/manifest-pipeline-yocto.yml
@@ -192,10 +192,11 @@ retrigger:
       - BUILD_BRANCH=${MASTER_BRANCH}
       - |
          if [ ${CI_PIPELINE_SOURCE} == "pipeline" ]; then
-            BUILD_BRANCH="${CI_COMMIT_REF_NAME}"
-         fi
-         if [ ${CI_PIPELINE_SOURCE} == "schedule" ]; then
-            BUILD_BRANCH="${CI_COMMIT_BRANCH}"
+              BUILD_BRANCH="${CI_COMMIT_REF_NAME}"
+         elif [ ${CI_PIPELINE_SOURCE} == "schedule" ]; then
+              BUILD_BRANCH="${CI_COMMIT_BRANCH}"
+         elif [ ! -z ${CI_COMMIT_TAG} ];
+              BUILD_BRANCH="refs/tags/${CI_COMMIT_TAG}"
          fi
          echo "This is the manifest repository URL used for the build: ${CI_REPOSITORY_URL}"
          echo "This is the manifest branch used for the build: ${BUILD_BRANCH}"
-- 
GitLab