]> Frank Brehm's Git Trees - pixelpark/create-vmware-tpl.git/commitdiff
Substituting only/except by rules in .gitlab-ci.yml
authorFrank Brehm <frank.brehm@pixelpark.com>
Mon, 19 Aug 2024 10:43:04 +0000 (12:43 +0200)
committerFrank Brehm <frank.brehm@pixelpark.com>
Mon, 19 Aug 2024 10:43:04 +0000 (12:43 +0200)
.gitlab-ci.yml

index 05c0c52cdf456c1faf66ed878ee9fe1998e68d8a..5ad6fb8702f735a624e0d569c86db4613424d0bb 100644 (file)
@@ -117,7 +117,7 @@ default:
     - pip list --format columns
     - if [ -x bin/compile-xlate-msgs.sh ] ; then bin/compile-xlate-msgs.sh; fi
     - |
-      if [ "$CI_COMMIT_REF_NAME" = "master" -o "$CI_COMMIT_REF_NAME" = "production" ] ; then
+      if [ "$CI_COMMIT_REF_NAME" = "master" -o "$CI_COMMIT_REF_NAME" = "main" -o "$CI_COMMIT_REF_NAME" = "production" ] ; then
           SYSTEM_STATUS="production"
       elif [ "$CI_COMMIT_REF_NAME" = "test" -o "$CI_COMMIT_REF_NAME" = "testing" ] ; then
           SYSTEM_STATUS="testing"
@@ -190,11 +190,11 @@ Test source:
     - which python3
     - bin/create-vmware-template --version
     - bin/create-vmware-template --help
-  except:
-    - /^dev-.*$/
-    - /^dev\/.*$/
-    - /^hf.*$/
-    - tags
+  rules:
+    - if: $CI_COMMIT_BRANCH =~ /^dev-.*$/ || $CI_COMMIT_BRANCH =~ /^dev\/.*$/ || $CI_COMMIT_BRANCH =~ /^hf.*$/
+      when: never
+    - if: $CI_COMMIT_TAG
+      when: never
 
 Linter:
   extends:
@@ -207,11 +207,11 @@ Linter:
   script:
     - pip install --upgrade --upgrade-strategy eager flake8 pylint
     - flake8 --max-line-length=$FLAKE8_MAX_LINE_LENGTH --max-complexity=$FLAKE8_MAX_COMPLEXITY --ignore=$FLAKE8_IGNORE_ERRORS bin lib
-  except:
-    - /^dev-.*$/
-    - /^dev\/.*$/
-    - /^hf.*$/
-    - tags
+  rules:
+    - if: $CI_COMMIT_BRANCH =~ /^dev-.*$/ || $CI_COMMIT_BRANCH =~ /^dev\/.*$/ || $CI_COMMIT_BRANCH =~ /^hf.*$/
+      when: never
+    - if: $CI_COMMIT_TAG
+      when: never
 
 .build-job:
   script:
@@ -337,11 +337,14 @@ Create RHEL9 live template:
     VM_IS_RHEL: 'True'
     VM_KS_TEMPLATE: 'el9-standard.ks'
     COBBLER_DISTRO: 'RHEL-9.2-x86_64'
-  if:
-    - master
-    - main
-  only:
-    - schedules
+  rules:
+    - if: $CI_PIPELINE_SOURCE == "schedule" && $CI_COMMIT_BRANCH == "master"
+      when: on_success
+    - if: $CI_PIPELINE_SOURCE == "schedule" && $CI_COMMIT_BRANCH == "main"
+      when: on_success
+    - if: $CI_PIPELINE_SOURCE == "schedule" && $CI_COMMIT_BRANCH == "production"
+      when: on_success
+    - when: never
 
 Create RHEL9 test template:
   extends:
@@ -359,11 +362,11 @@ Create RHEL9 test template:
     VM_IS_RHEL: 'True'
     VM_KS_TEMPLATE: 'el9-standard.ks'
     COBBLER_DISTRO: 'RHEL-9.2-x86_64'
-  if:
-    - test
-  except:
-    - tags
-  only:
-    - schedules
+  rules:
+    - if: $CI_PIPELINE_SOURCE == "schedule" && $CI_COMMIT_BRANCH == "test"
+      when: on_success
+    - if: $CI_PIPELINE_SOURCE == "schedule" && $CI_COMMIT_BRANCH == "testing"
+      when: on_success
+    - when: never
 
 # vim: et list