From c0c25b3b80578877a4c95177a8158f4c2adf5245 Mon Sep 17 00:00:00 2001
From: Lorenzo Pagliai <lorenzo.pagliai@seco.com>
Date: Tue, 20 Dec 2022 13:46:10 +0100
Subject: [PATCH] Add BUILD_BRANCH variable

* This variable allows to define the branch that is used for the
manifest build (the master one on schedule/tag or the integration one on
upstream pipeline trigger)
---
 manifest-pipeline-yocto.yml | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/manifest-pipeline-yocto.yml b/manifest-pipeline-yocto.yml
index 149c902..5a19619 100644
--- a/manifest-pipeline-yocto.yml
+++ b/manifest-pipeline-yocto.yml
@@ -186,9 +186,14 @@ retrigger:
       - eval $(ssh-agent -s)
       - ssh-add /home/secous/.ssh/id_rsa
       - export EULA=1
+      - BUILD_BRANCH=${MASTER_BRANCH}
+      - |
+         if [ ${CI_PIPELINE_SOURCE} == "pipeline" ]; then
+            echo "This is the manifest branch used for the build ${CI_COMMIT_REF_NAME}"
+            BUILD_BRANCH="${CI_COMMIT_REF_NAME}"
       - |
         su secous -c "
-        repo init -u ${CI_REPOSITORY_URL} -b kirkstone/develop; 
+        repo init -u ${CI_REPOSITORY_URL} -b ${BUILD_BRANCH}; 
         repo sync -j$(nproc) --fetch-submodules;
         . ./seco-setup.sh -d ${DEFCONFIG_FILE};
         . ./seco-setup.sh -c;
-- 
GitLab