ci: add quirk for GitLab assuming changes is always true for scheduled runs
authorDavid Heidelberg <david.heidelberg@collabora.com>
Fri, 7 Jul 2023 23:48:31 +0000 (01:48 +0200)
committerMarge Bot <emma+marge@anholt.net>
Mon, 17 Jul 2023 18:12:27 +0000 (18:12 +0000)
Sadly GitLab CI always evaluate `rules:changes` as true, when running
scheduled runs. So we have to add explicit condition to ignore it there.

Every line using `rules:changes` has to have following condition
ignoring "schedule" runes.

Cc: mesa-stable
Reported-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Eric Engestrom <eric@igalia.com>
Signed-off-by: David Heidelberg <david.heidelberg@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24051>

.gitlab-ci/farm-rules.yml

index f831224..12510a4 100644 (file)
@@ -3,8 +3,10 @@
     - exists: [ .ci-farms-disabled/microsoft ]  # 1. Is disabled, never run
       when: never
     - changes: [ .ci-farms-disabled/microsoft ]  # 2. Removed from disabled, run
+      if: '$CI_PIPELINE_SOURCE != "schedule"'
       when: on_success
     - changes: [ .ci-farms-disabled/* ]  # 3. We touched other farms in MR, do not run
+      if: '$CI_PIPELINE_SOURCE != "schedule"'
       when: never
     # 4. Fall-through (other rules or on_success)
 
@@ -15,6 +17,7 @@
     - exists: [ .ci-farms-disabled/microsoft ]
       when: never
     - changes: [ .ci-farms-disabled/microsoft ]
+      if: '$CI_PIPELINE_SOURCE != "schedule"'
       when: never
     - !reference [.microsoft-farm-rules, rules]
 
@@ -25,6 +28,7 @@
     - exists: [ .ci-farms-disabled/microsoft ]
       when: never
     - changes: [ .ci-farms-disabled/microsoft ]
+      if: '$CI_PIPELINE_SOURCE != "schedule"'
       when: manual
     - !reference [.microsoft-farm-rules, rules]
 
     - if: '$RUNNER_TAG =~ /^mesa-ci-x86-64-lava-/'
       exists: [ .ci-farms-disabled/collabora ]
       when: never
-    - if: '$RUNNER_TAG =~ /^mesa-ci-x86-64-lava-/'
+    - if: '$RUNNER_TAG =~ /^mesa-ci-x86-64-lava-/ && $CI_PIPELINE_SOURCE != "schedule"'
       changes: [ .ci-farms-disabled/collabora ]
       when: on_success
-    - if: '$RUNNER_TAG =~ /^mesa-ci-x86-64-lava-/'
+    - if: '$RUNNER_TAG =~ /^mesa-ci-x86-64-lava-/ && $CI_PIPELINE_SOURCE != "schedule"'
       changes: [ .ci-farms-disabled/* ]
       when: never
 
@@ -46,7 +50,7 @@
     - if: '$RUNNER_TAG =~ /^mesa-ci-x86-64-lava-/'
       exists: [ .ci-farms-disabled/collabora ]
       when: never
-    - if: '$RUNNER_TAG =~ /^mesa-ci-x86-64-lava-/'
+    - if: '$RUNNER_TAG =~ /^mesa-ci-x86-64-lava-/ && $CI_PIPELINE_SOURCE != "schedule"'
       changes: [ .ci-farms-disabled/collabora ]
       when: never
     - !reference [.collabora-farm-rules, rules]
     - exists: [ .ci-farms-disabled/igalia ]
       when: never
     - changes: [ .ci-farms-disabled/igalia ]
+      if: '$CI_PIPELINE_SOURCE != "schedule"'
       when: on_success
     - changes: [ .ci-farms-disabled/* ]
+      if: '$CI_PIPELINE_SOURCE != "schedule"'
       when: never
 
 .igalia-farm-manual-rules:
@@ -66,6 +72,7 @@
     - exists: [ .ci-farms-disabled/igalia ]
       when: never
     - changes: [ .ci-farms-disabled/igalia ]
+      if: '$CI_PIPELINE_SOURCE != "schedule"'
       when: never
     - !reference [.igalia-farm-rules, rules]
 
     - exists: [ .ci-farms-disabled/lima ]
       when: never
     - changes: [ .ci-farms-disabled/lima ]
+      if: '$CI_PIPELINE_SOURCE != "schedule"'
       when: on_success
     - changes: [ .ci-farms-disabled/* ]
+      if: '$CI_PIPELINE_SOURCE != "schedule"'
       when: never
 
 .lima-farm-manual-rules:
@@ -84,6 +93,7 @@
     - exists: [ .ci-farms-disabled/lima ]
       when: never
     - changes: [ .ci-farms-disabled/lima ]
+      if: '$CI_PIPELINE_SOURCE != "schedule"'
       when: never
     - !reference [.lima-farm-rules, rules]
 
     - exists: [ .ci-farms-disabled/anholt ]
       when: never
     - changes: [ .ci-farms-disabled/anholt ]
+      if: '$CI_PIPELINE_SOURCE != "schedule"'
       when: on_success
     - changes: [ .ci-farms-disabled/* ]
+      if: '$CI_PIPELINE_SOURCE != "schedule"'
       when: never
 
 .anholt-farm-manual-rules:
     - exists: [ .ci-farms-disabled/anholt ]
       when: never
     - changes: [ .ci-farms-disabled/anholt ]
+      if: '$CI_PIPELINE_SOURCE != "schedule"'
       when: never
     - !reference [.anholt-farm-rules, rules]
 
       if: '$RUNNER_FARM_LOCATION == "keywords"'
       when: never
     - changes: [ .ci-farms-disabled/valve-mupuf ]
-      if: '$RUNNER_FARM_LOCATION == "mupuf"'
+      if: '$RUNNER_FARM_LOCATION == "mupuf" && $CI_PIPELINE_SOURCE != "schedule"'
       when: on_success
     - changes: [ .ci-farms-disabled/valve-kws ]
-      if: '$RUNNER_FARM_LOCATION == "keywords"'
+      if: '$RUNNER_FARM_LOCATION == "keywords" && $CI_PIPELINE_SOURCE != "schedule"'
       when: on_success
     - changes: [ .ci-farms-disabled/* ]
       when: never
       if: '$RUNNER_FARM_LOCATION == "keywords"'
       when: never
     - changes: [ .ci-farms-disabled/valve-mupuf ]
-      if: '$RUNNER_FARM_LOCATION == "mupuf"'
+      if: '$RUNNER_FARM_LOCATION == "mupuf" && $CI_PIPELINE_SOURCE != "schedule"'
       when: never
     - changes: [ .ci-farms-disabled/valve-kws ]
-      if: '$RUNNER_FARM_LOCATION == "keywords"'
+      if: '$RUNNER_FARM_LOCATION == "keywords" && $CI_PIPELINE_SOURCE != "schedule"'
       when: never
     - !reference [.valve-farm-rules, rules]
 
     - exists: [ .ci-farms-disabled/austriancoder ]
       when: never
     - changes: [ .ci-farms-disabled/austriancoder ]
+      if: '$CI_PIPELINE_SOURCE != "schedule"'
       when: on_success
     - changes: [ .ci-farms-disabled/* ]
+      if: '$CI_PIPELINE_SOURCE != "schedule"'
       when: never
 
 .austriancoder-farm-manual-rules:
     - exists: [ .ci-farms-disabled/austriancoder ]
       when: never
     - changes: [ .ci-farms-disabled/austriancoder ]
+      if: '$CI_PIPELINE_SOURCE != "schedule"'
       when: never
     - !reference [.austriancoder-farm-rules, rules]
 
     - exists: [ .ci-farms-disabled/freedreno ]
       when: never
     - changes: [ .ci-farms-disabled/freedreno ]
+      if: '$CI_PIPELINE_SOURCE != "schedule"'
       when: on_success
     - changes: [ .ci-farms-disabled/* ]
+      if: '$CI_PIPELINE_SOURCE != "schedule"'
       when: never
 
 .freedreno-farm-manual-rules:
     - exists: [ .ci-farms-disabled/freedreno ]
       when: never
     - changes: [ .ci-farms-disabled/freedreno ]
+      if: '$CI_PIPELINE_SOURCE != "schedule"'
       when: never
     - !reference [.freedreno-farm-rules, rules]