From 7ccce09edcb595b61176cd4538468cd9b31a4a9d Mon Sep 17 00:00:00 2001
From: Sonia Zorba <sonia.zorba@inaf.it>
Date: Fri, 12 Nov 2021 17:19:33 +0100
Subject: [PATCH] Updated CI

---
 .gitlab-ci.yml | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 73d5734..5b05163 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -8,9 +8,10 @@ stages:
   tags:
     - docker
   rules:
-    - if: '$CI_COMMIT_BRANCH == "master"'
+    - if: '$CI_COMMIT_REF_NAME == "master"'
       changes:
         - gms-client/gms-client/*
+        - .gitlab-ci.yml
 
 build_gms_client:
   extends: .gms_client
@@ -42,9 +43,10 @@ test_gms:
     - awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print "coverage=" 100*covered/instructions }' target/site/jacoco/jacoco.csv
   coverage: '/coverage=\d+\.\d+/'
   rules:
-    - if: '$CI_COMMIT_BRANCH == "master"'
+    - if: '$CI_COMMIT_REF_NAME == "master"'
       changes:
         - gms/*
+        - .gitlab-ci.yml
 
 deploy_gms_client:
   extends: .gms_client
@@ -74,9 +76,10 @@ deploy_gms_lib:
         -Durl=${IA2_MVN_REPO_SNAPSHOTS}
         -DpomFile=pom.xml
   rules:
-    - if: '$CI_COMMIT_BRANCH == "master"'
+    - if: '$CI_COMMIT_REF_NAME == "master"'
       changes:
         - gms/*
+        - .gitlab-ci.yml
 
 dockerize_db:
   stage: deploy
@@ -87,10 +90,11 @@ dockerize_db:
     - docker build -t "${CI_REGISTRY_IMAGE}/database" -f database/Dockerfile .
     - docker push "${CI_REGISTRY_IMAGE}/database"
   rules:
-    - if: '$CI_COMMIT_BRANCH == "master"'
+    - if: '$CI_COMMIT_REF_NAME == "master"'
       changes:
         - database/*
         - gms/src/main/resources/sql/*
+        - .gitlab-ci.yml
 
 dockerize_gms:
   stage: deploy
@@ -101,10 +105,11 @@ dockerize_gms:
     - docker build -t "${CI_REGISTRY_IMAGE}" -f gms/Dockerfile .
     - docker push "${CI_REGISTRY_IMAGE}"
   rules:
-    - if: '$CI_COMMIT_BRANCH == "master"'
+    - if: '$CI_COMMIT_REF_NAME == "master"'
       changes:
         - gms/*
         - gms-ui/*
+        - .gitlab-ci.yml
 
 upload_jar:
   stage: publish
-- 
GitLab