From 64dc51d3244909d5ce3dd1a99580d60fce0f0a64 Mon Sep 17 00:00:00 2001
From: Tim Jaacks <tim.jaacks@seco.com>
Date: Mon, 18 Sep 2023 08:28:08 +0200
Subject: [PATCH] Use regex operator to check for multiple variables

The "&&" operator does not work as expected when checking if multiple
variables are set.

See for reference:
https://gitlab.com/gitlab-org/gitlab/-/issues/321371
---
 build-pipeline-yocto.yml.jinja2 | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/build-pipeline-yocto.yml.jinja2 b/build-pipeline-yocto.yml.jinja2
index 85b978bd..7427f91c 100644
--- a/build-pipeline-yocto.yml.jinja2
+++ b/build-pipeline-yocto.yml.jinja2
@@ -230,7 +230,9 @@ azure-{{ machine }}:
   extends: .deploy-azure
   stage: Deploy Azure
   rules:
-    - if: $AZURE_CONTAINER_NAME && $AZURE_TARGET_FOLDER
+    #  "=~ /^./" is the GitLab way of checking whether a variable is set and not empty.
+    # See for reference: https://gitlab.com/gitlab-org/gitlab/-/issues/321371
+    - if: $AZURE_CONTAINER_NAME =~ /^./ && $AZURE_TARGET_FOLDER =~ /^./
       when: manual
       allow_failure: true
   variables:
@@ -262,7 +264,7 @@ azure-{{ machine }}:
 
 .confluence-rules:
   rules:
-    - if: $CONFLUENCE_PARENT_ID && $CONFLUENCE_SPACE
+    - if: $CONFLUENCE_PARENT_ID =~ /^./ && $CONFLUENCE_SPACE =~ /^./
       when: manual
       allow_failure: true
 
-- 
GitLab