diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index e797333caeeb13729acd6f2ec63902288896ec3c..ec20f56f6296552adb252bc96bbdcf578e8d5162 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -44,12 +44,11 @@ pica-ci-base:
     - docker push $REGISTRY_PROD/pica-ci-base:latest
   after_script:
     - docker logout $REGISTRY_PROD
-  only:
-    changes:
-      - "pica-ci-base/**"
-    refs:
-      - master
-      - dev-ci
+  rules:
+    - if: '$CI_COMMIT_BRANCH == "master" || $CI_COMMIT_BRANCH == "dev-ci"'
+      changes:
+        - "pica-ci-base/**"
+      when: always
 
 # Create a file a few environment variables added (which Dockerfile has been modified, the complete name of the image...)
 # The file will be an artifact shared with further steps
@@ -62,10 +61,11 @@ set-variables:
     - ./get-modified-image.sh
   # If the Dockerfile is changed, force the build.
   # Otherwise, may be triggered manually.
-  only:
-    changes:
+  rules:
+    - changes:
       - "pica-*/**"
       - "meta-*/**"
+      when: always
 
 # Build the image that was modified
 build:
@@ -178,9 +178,8 @@ push-prod:
     - docker push $MODIFIED_IMAGE_FULL
   after_script:
     - docker logout $REGISTRY_PROD
-  only:
-    refs:
-      - master
-    changes:
+  rules:
+    - if: '$CI_COMMIT_BRANCH == "master"'
+      changes:
       - "pica-*/**"
-  when: manual
+      when: manual