From 47a1246d811b2ad484f19db95656183ce1de94c7 Mon Sep 17 00:00:00 2001
From: Pierre Smeyers <pierre.smeyers@orange.com>
Date: Wed, 9 Jun 2021 14:57:00 +0200
Subject: [PATCH] fix(publish): remove variable from rules:exists expression
 (unsupported)

---
 templates/gitlab-ci-helm.yml | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/templates/gitlab-ci-helm.yml b/templates/gitlab-ci-helm.yml
index 596f64f..7214dba 100644
--- a/templates/gitlab-ci-helm.yml
+++ b/templates/gitlab-ci-helm.yml
@@ -663,15 +663,16 @@ helm-publish:
   stage: publish
   script:
     - helm ${TRACE+--debug} $(get_helm_config_opt) repo index $HELM_PUBLISH_DIR --url $HELM_PUBLISH_URL $HELM_PUBLISH_ARGS
-  rules:
-    - if: $CI_MERGE_REQUEST_ID || $HELM_PUBLISH_URL == null || $CI_COMMIT_REF_NAME !~ $PROD_REF
-      when: never
-    - exists:
-        - $HELM_CHART_DIR/Chart.yaml
   artifacts:
     expire_in: 1 week
     paths:
       - $HELM_PUBLISH_DIR
+  rules:
+    - if: $CI_MERGE_REQUEST_ID || $HELM_PUBLISH_URL == null || $CI_COMMIT_REF_NAME !~ $PROD_REF
+      when: never
+    # /!\ variables can't be used in rules:exists
+    - exists:
+        - "**/Chart.yaml"
 
 # Deploy job prototype
 # Can be extended to define a concrete environment
-- 
GitLab