From f940abce0364ee360bdfb749828638096c3b94a5 Mon Sep 17 00:00:00 2001
From: Wouter Deconinck <wdconinc@gmail.com>
Date: Fri, 21 Jul 2023 23:16:29 +0000
Subject: [PATCH] fix: external trigger with VERSION has priority

---
 .gitlab-ci.yml | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 691a21fdf..59931f4f9 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -33,6 +33,9 @@ variables:
   ## Additional options for docker build (e.g. --no-cache)
   BUILD_OPTIONS:
 
+  ## Version to be set by external trigger
+  VERSION:
+
   ## Internal tag used for the CI
   INTERNAL_TAG: "pipeline-${CI_PIPELINE_ID}"
 
@@ -101,7 +104,10 @@ version:
   stage: config
   script:
     - |
-      if [ "x${CI_PIPELINE_SOURCE}" = "xmerge_request_event" ]; then
+      if [ -n "${VERSION}" ]; then
+        # external trigger with specified version
+        EXPORT_TAG="${VERSION}"
+      elif [ "x${CI_PIPELINE_SOURCE}" = "xmerge_request_event" ]; then
         VERSION="unstable-mr-${CI_MERGE_REQUEST_PROJECT_ID}-${CI_MERGE_REQUEST_IID}"
         NIGHTLY_TAG="${VERSION}-nightly"
         EXPORT_TAG="${VERSION}"
-- 
GitLab