gitlab-ci: Only run the pipeline if any files affecting it have changed
authorMichel Dänzer <mdaenzer@redhat.com>
Fri, 25 Oct 2019 16:59:56 +0000 (18:59 +0200)
committerMichel Dänzer <michel@daenzer.net>
Tue, 29 Oct 2019 15:09:56 +0000 (15:09 +0000)
E.g. documentation-only changes cannot affect the outcome of the
pipeline, so don't waste resources on running it.

The thing we need to be careful about here is that the container stage
jobs must always run if any later stage jobs using the corresponding
docker images run. We're currently using the same .ci-run-policy
template for all jobs, so this is trivially true.

v2:
* Add bin/ and common.py (Eric Engestrom)

Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> # v1
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
.gitlab-ci.yml

index 78793fc7b0c1e5bfd5959453c1cc8f0be85e9824..92097c13565f7f15a8014f448012bf294a329046 100644 (file)
@@ -40,9 +40,27 @@ stages:
 # When to automatically run the CI
 .ci-run-policy:
   only:
-    - branches@mesa/mesa
-    - merge_requests
-    - /^ci([-/].*)?$/
+    refs:
+      - branches@mesa/mesa
+      - merge_requests
+      - /^ci([-/].*)?$/
+    changes:
+      - VERSION
+      - bin/**/*
+      # GitLab CI
+      - .gitlab-ci.yml
+      - .gitlab-ci/**/*
+      # Meson
+      - meson*
+      - build-support/**/*
+      - subprojects/**/*
+      # SCons
+      - SConstruct
+      - scons/**/*
+      - common.py
+      # Source code
+      - include/**/*
+      - src/**/*
   retry:
     max: 2
     when: