Mesa (master): gitlab-ci: Stop using manual jobs for merge requests

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jan 15 10:51:57 UTC 2020


Module: Mesa
Branch: master
Commit: 8775b742ea31ba4cd035e20a91493204c83b3f07
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=8775b742ea31ba4cd035e20a91493204c83b3f07

Author: Michel Dänzer <mdaenzer at redhat.com>
Date:   Mon Jan 13 09:45:57 2020 +0100

gitlab-ci: Stop using manual jobs for merge requests

They were causing trouble with Marge Bot: The project settings require
that the pipeline succeeds before a merge request (MR) can be merged,
otherwise Marge doesn't wait for the pipeline to succeed before merging
an MR assigned to her. But Marge can't start manual jobs, so she would
always time out waiting for pipelines with manual jobs.

To avoid this, use these rules:
* Run the pipeline by default for MRs and main project branches changing
  any files affecting it.
* For other MRs, run a single dummy job which always succeeds.
* Don't run any jobs for main project branch changes (e.g. from an MR
  having been merged) not affecting the pipeline.
* Allow jobs to be started manually on branches of forked projects, as
  before.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Acked-by: Daniel Stone <daniels at collabora.com>
Reviewed-by: Eric Engestrom <eric at engestrom.ch>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3361>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3361>

---

 .gitlab-ci.yml | 72 ++++++++++++++++++++++++++++++++++++----------------------
 1 file changed, 45 insertions(+), 27 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 464c26d7d1b..1272d537123 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -12,12 +12,44 @@ stages:
   - container
   - build
   - test
+  - success
 
 
 # When to automatically run the CI
 .ci-run-policy:
   rules:
-    - when: on_success
+    # Run pipeline by default for merge requests changing files affecting it
+    - if: '$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME == $CI_COMMIT_REF_NAME'
+      changes: &paths
+      - VERSION
+      - bin/**/*
+      # GitLab CI
+      - .gitlab-ci.yml
+      - .gitlab-ci/**/*
+      # Meson
+      - meson*
+      - build-support/**/*
+      - subprojects/**/*
+      # SCons
+      - SConstruct
+      - scons/**/*
+      - common.py
+      # Source code
+      - include/**/*
+      - src/**/*
+      when: on_success
+    # Run pipeline by default in the main project if files affecting it were
+    # changed
+    - if: '$CI_PROJECT_PATH == "mesa/mesa"'
+      changes:
+        *paths
+      when: on_success
+    # Allow triggering jobs manually on branches of forked projects
+    - if: '$CI_PROJECT_PATH != "mesa/mesa"'
+      if: '$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME != $CI_COMMIT_REF_NAME'
+      when: manual
+    # Otherwise, most jobs won't run
+    - when: never
   retry:
     max: 2
     when:
@@ -25,6 +57,18 @@ stages:
   # Cancel CI run if a newer commit is pushed to the same branch
   interruptible: true
 
+success:
+  stage: success
+  image: debian:stable-slim
+  only:
+    - merge_requests
+  except:
+    changes:
+      *paths
+  script:
+    - echo "Dummy job to make sure every merge request pipeline runs at least one job"
+
+
 .ci-deqp-artifacts:
   artifacts:
     when: always
@@ -55,32 +99,6 @@ stages:
   stage: container
   extends:
     - .ci-run-policy
-  rules:
-    # Run pipeline by default for merge requests changing files affecting it
-    - if: '$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME == $CI_COMMIT_REF_NAME'
-      changes:
-      - VERSION
-      - bin/**/*
-      # GitLab CI
-      - .gitlab-ci.yml
-      - .gitlab-ci/**/*
-      # Meson
-      - meson*
-      - build-support/**/*
-      - subprojects/**/*
-      # SCons
-      - SConstruct
-      - scons/**/*
-      - common.py
-      # Source code
-      - include/**/*
-      - src/**/*
-      when: on_success
-    # Always run pipeline by default in the main project
-    - if: '$CI_PROJECT_PATH == "mesa/mesa"'
-      when: on_success
-    # Otherwise, allow triggering jobs manually
-    - when: manual
   variables:
     DEBIAN_VERSION: buster-slim
     REPO_SUFFIX: $CI_JOB_NAME



More information about the mesa-commit mailing list