Skip to contentSkip to conversation

gitlab: compare CIRRUS_nn vars against 'null' not ""

PATCH In review Daniel P. Berrangé 4 participants 4 messages Jun 8, 2022 – Jun 9, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gitlab: compare CIRRUS_nn vars against 'null' not ""

The GitLab variable comparisons don't have shell like semantics where an unset variable compares equal to empty string. We need to explicitly test against 'null' to detect an unset variable.

---
 .gitlab-ci.d/base.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
.gitlab-ci.d/base.yml +1 -1
index f334f3ded7..69b36c148a 100644
@@ -13,7 +13,7 @@
     #############################################################
 
     # Cirrus jobs can't run unless the creds / target repo are set
-    - if: '$QEMU_JOB_CIRRUS && ($CIRRUS_GITHUB_REPO == "" || $CIRRUS_API_TOKEN == "")'
+    - if: '$QEMU_JOB_CIRRUS && ($CIRRUS_GITHUB_REPO == null || $CIRRUS_API_TOKEN == null)'
       when: never
 
     # Publishing jobs should only run on the default branch in upstream
Signature · 1 line
2.36.1
Tested-by Reviewed-by on v1 1/1
#1 lore raw
Quoted 14 lines · Daniel P. Berrangé

The GitLab variable comparisons don't have shell like semantics where an unset variable compares equal to empty string. We need to explicitly test against 'null' to detect an unset variable.

---
  .gitlab-ci.d/base.yml | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
.gitlab-ci.d/base.yml +0 -0
index f334f3ded7..69b36c148a 100644

.gitlab-ci.d/base.yml line 19

Quoted 8 lines
.gitlab-ci.d/base.yml +1 -1
@@ -13,7 +13,7 @@
      #############################################################
 
      # Cirrus jobs can't run unless the creds / target repo are set
-    - if: '$QEMU_JOB_CIRRUS && ($CIRRUS_GITHUB_REPO == "" || $CIRRUS_API_TOKEN == "")'
+    - if: '$QEMU_JOB_CIRRUS && ($CIRRUS_GITHUB_REPO == null || $CIRRUS_API_TOKEN == null)'
        when: never
 
      # Publishing jobs should only run on the default branch in upstream

r~

Reviewed-by on v1 1/1
#2 lore raw
In reply to Daniel P. Berrangé
Quoted 14 lines · Daniel P. Berrangé

The GitLab variable comparisons don't have shell like semantics where an unset variable compares equal to empty string. We need to explicitly test against 'null' to detect an unset variable.

---
  .gitlab-ci.d/base.yml | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
.gitlab-ci.d/base.yml +0 -0
index f334f3ded7..69b36c148a 100644

.gitlab-ci.d/base.yml line 19

Quoted 8 lines
.gitlab-ci.d/base.yml +1 -1
@@ -13,7 +13,7 @@
      #############################################################
 
      # Cirrus jobs can't run unless the creds / target repo are set
-    - if: '$QEMU_JOB_CIRRUS && ($CIRRUS_GITHUB_REPO == "" || $CIRRUS_API_TOKEN == "")'
+    - if: '$QEMU_JOB_CIRRUS && ($CIRRUS_GITHUB_REPO == null || $CIRRUS_API_TOKEN == null)'
        when: never
 
      # Publishing jobs should only run on the default branch in upstream