From a8566b6d99f65ae3fa30d323252d2c7a9660ede7 Mon Sep 17 00:00:00 2001
From: Pierre Smeyers <pierre.smeyers@gmail.com>
Date: Sun, 1 May 2022 14:17:29 +0200
Subject: [PATCH] chore: use workflow rules

---
 templates/gitlab-ci-sonar.yml | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/templates/gitlab-ci-sonar.yml b/templates/gitlab-ci-sonar.yml
index a39a81a..a198502 100644
--- a/templates/gitlab-ci-sonar.yml
+++ b/templates/gitlab-ci-sonar.yml
@@ -13,6 +13,14 @@
 # program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth 
 # Floor, Boston, MA  02110-1301, USA.
 # =========================================================================================
+# default workflow rules
+workflow:
+  rules:
+    # exclude merge requests
+    - if: $CI_MERGE_REQUEST_ID
+      when: never
+    - when: always
+
 variables:
   # variabilized tracking image
   TBC_TRACKING_IMAGE: "$CI_REGISTRY/to-be-continuous/tools/tracking:master"
@@ -289,9 +297,6 @@ sonar:
     - if [[ "$SONAR_GITLAB_TOKEN" ]]; then sonar_extra_args=$SONAR_GITLAB_ARGS; fi
     - sonar-scanner ${TRACE+-Dsonar.verbose=true} $java_proxy_args ${SONAR_AUTH_TOKEN+-Dsonar.login=$SONAR_AUTH_TOKEN} ${SONAR_LOGIN+-Dsonar.login=$SONAR_LOGIN} ${SONAR_PASSWORD+-Dsonar.password=$SONAR_PASSWORD} $SONAR_BASE_ARGS $sonar_extra_args $sonar_mr_args
   rules:
-    # exclude merge requests
-    - if: $CI_MERGE_REQUEST_ID
-      when: never
     # exclude if $SONAR_URL not set
     - if: '$SONAR_URL == null || $SONAR_URL == ""'
       when: never
-- 
GitLab