From 66c257c8c4763c1c6e08d0b56a2c225f26270cc3 Mon Sep 17 00:00:00 2001
From: Pierre Smeyers <pierre.smeyers@gmail.com>
Date: Tue, 30 Jan 2024 14:24:42 +0100
Subject: [PATCH] fix: sanitize variable substitution pattern

replace '${foo+repl}' pattern with '${foo:+repl}' (latest supports $foo being defined but empty)

closes #21
---
 templates/gitlab-ci-sonar.yml | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/templates/gitlab-ci-sonar.yml b/templates/gitlab-ci-sonar.yml
index f75fe67..15abcbb 100644
--- a/templates/gitlab-ci-sonar.yml
+++ b/templates/gitlab-ci-sonar.yml
@@ -426,11 +426,11 @@ sonar:
       fi
     - >-
       sonar-scanner ${TRACE+-Dsonar.verbose=true} $java_proxy_args 
-      ${SONAR_LOGIN+-Dsonar.login=$SONAR_LOGIN} 
-      ${SONAR_PASSWORD+-Dsonar.password=$SONAR_PASSWORD} 
-      ${SONAR_PROJECT_KEY+-Dsonar.projectKey=$SONAR_PROJECT_KEY} 
-      ${SONAR_PROJECT_NAME+-Dsonar.projectName=$SONAR_PROJECT_NAME} 
-      ${SONAR_QUALITY_GATE_ENABLED+-Dsonar.qualitygate.wait=$SONAR_QUALITY_GATE_ENABLED}
+      ${SONAR_LOGIN:+-Dsonar.login=$SONAR_LOGIN} 
+      ${SONAR_PASSWORD:+-Dsonar.password=$SONAR_PASSWORD} 
+      ${SONAR_PROJECT_KEY:+-Dsonar.projectKey=$SONAR_PROJECT_KEY} 
+      ${SONAR_PROJECT_NAME:+-Dsonar.projectName=$SONAR_PROJECT_NAME} 
+      ${SONAR_QUALITY_GATE_ENABLED:+-Dsonar.qualitygate.wait=$SONAR_QUALITY_GATE_ENABLED}
       $SONAR_BASE_ARGS
   rules:
     - !reference [.test-policy, rules]
-- 
GitLab