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 <samuel.pitoiset@gmail.com> # v1
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> # v1
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com> # v1
Acked-by: Eric Engestrom <eric.engestrom@intel.com>
This commit is contained in:
Michel Dänzer 2019-09-26 09:27:27 +02:00 committed by Michel Dänzer
parent ebd1309fef
commit 41797a1fed
1 changed files with 28 additions and 22 deletions

View File

@ -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