diff --git a/build-pipeline-yocto.yml.jinja2 b/build-pipeline-yocto.yml.jinja2
index 85b978bd5aedb1bcefe55aad8c9131fd6cd5beac..7427f91c6a9f906631a006fd822058d26919b2fd 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