From 41797a1fed5ed9b7dafeeb064e47f1a364a4e981 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Thu, 26 Sep 2019 09:27:27 +0200 Subject: [PATCH] gitlab-ci: Overhaul job run policy Use new rules: instead of only: For container stage jobs: * In the main Mesa project, run them by default. * In merge requests, run them by default if any files affecting pipeline results are changed. * In all other cases (in particular branches in personal projects), don't run them by default but allow triggering them manually. build & test stage jobs are left at the default (when: on_success), so they will run automatically once all their dependencies are satisified. (Using the same rules as above would require these jobs to be manually triggered as well, which is only possible once all dependency jobs have passed) Please be considerate of CI runner resources and cancel unneeded jobs on personal branches with no corresponding merge requests (this can be done before the jobs start running). In summary: No more special branch names. Unnecessary job runs are avoided by default, but jobs which don't run by default can be triggered manually. v2: * Split out LAVA changes to separate commit * Clarify commit log a little, in particular WRT build/test stage jobs Reviewed-by: Samuel Pitoiset # v1 Reviewed-by: Pierre-Eric Pelloux-Prayer # v1 Reviewed-by: Tomeu Vizoso # v1 Acked-by: Eric Engestrom --- .gitlab-ci.yml | 50 ++++++++++++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0c89ec45a2a..9934293b2df 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -18,28 +18,8 @@ stages: # When to automatically run the CI .ci-run-policy: - only: - 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/**/* + rules: + - when: on_success retry: max: 2 when: @@ -77,6 +57,32 @@ 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