From f1f99098f9dbbdbdc91880ad481f503c864b8a48 Mon Sep 17 00:00:00 2001
From: lewa <lene.wasskog@nibio.no>
Date: Wed, 29 Nov 2023 10:59:45 +0100
Subject: [PATCH] chore: Try with 'rules' instead of 'only'

---
 .gitlab-ci.yml | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index d3f49a6..d10419d 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -44,9 +44,9 @@ build:
   artifacts:
     paths:
       - target/*.war
-  only:
-    - $MAIN_BRANCH
-    - $RELEASE_BRANCH
+  rules:
+    - if: $CI_COMMIT_REF_NAME == $MAIN_BRANCH
+    - if: $CI_COMMIT_REF_NAME == $RELEASE_BRANCH
 
 test:
   stage: test
@@ -54,9 +54,9 @@ test:
     - "./mvnw $MAVEN_POM_WITH_MODELS $MAVEN_CLI_OPTS $MAVEN_OPTS test"
   tags:
     - vips-java
-  only:
-    - $MAIN_BRANCH
-    - $RELEASE_BRANCH
+  rules:
+    - if: $CI_COMMIT_REF_NAME == $MAIN_BRANCH
+    - if: $CI_COMMIT_REF_NAME == $RELEASE_BRANCH
 
 deploy-to-staging:
   stage: deploy
@@ -99,7 +99,7 @@ deploy-to-staging:
   tags:
     - vips-java
   rules:
-    - if: "$CI_COMMIT_REF_NAME == $MAIN_BRANCH"
+    - if: $CI_COMMIT_REF_NAME == $MAIN_BRANCH
   environment:
     name: staging
     url: https://vipscore02test.nibio.no
@@ -115,7 +115,7 @@ upload-snapshot:
   tags:
     - vips-java
   rules:
-    - if: "$CI_COMMIT_REF_NAME == $MAIN_BRANCH"
+    - if: $CI_COMMIT_REF_NAME == $MAIN_BRANCH
 
 deploy-to-production:
   stage: deploy
@@ -186,4 +186,4 @@ upload-and-tag-release:
   tags:
     - vips-java
   rules:
-    - if: "$CI_COMMIT_REF_NAME == $RELEASE_BRANCH"
+    - if: $CI_COMMIT_REF_NAME == $RELEASE_BRANCH
-- 
GitLab