ci: Fix pre-merge pipelines with no code changes
authorDaniel Stone <daniels@collabora.com>
Thu, 14 Sep 2023 10:47:40 +0000 (11:47 +0100)
committerMarge Bot <emma+marge@anholt.net>
Fri, 15 Sep 2023 11:29:34 +0000 (11:29 +0000)
Make sure we don't end up with manual container jobs in MR pipelines,
because they'll never start. This cleans up the container and build
rules so always 'do the right thing' on MRs (container+build if
required, nothing if not) and user branches (all manual).

Signed-off-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25219>

.gitlab-ci.yml

index 443e3e1..31e5ba1 100644 (file)
@@ -176,7 +176,14 @@ include:
       - include/**/*
       - src/**/*
       when: on_success
-    # Otherwise, build/test jobs won't run because no rule matched.
+    # Just skip everything for MRs which don't actually change anything in the
+    # build
+    - if: *is-pre-merge-for-marge
+      when: never
+    - if: *is-post-merge
+      when: never
+    # Always allow user branches etc to trigger jobs manually
+    - when: manual
 
 
 .ci-deqp-artifacts:
@@ -214,9 +221,14 @@ include:
       changes:
         *all_paths
       when: on_success
-    # Allow triggering jobs manually in other cases
+    # Just skip everything for MRs which don't actually change anything in the
+    # build - the same rules as above, but without the file-change rules
+    - if: *is-pre-merge-for-marge
+      when: never
+    - if: *is-post-merge
+      when: never
+    # Always allow user branches etc to trigger jobs manually
     - when: manual
-    # Otherwise, container jobs won't run because no rule matched.
 
 # Git archive