mesa/.gitlab-ci/farm-rules.yml
Eric Engestrom 83d856d4bc ci/farm-rules: re-add "run every container and build job when a farm gets re-enabled"
Turns out I was right the first time, I was just missing that this
should only be done in MRs, which @daniels added in 16527f6ffd.

Without this, a "farm re-enable" pipeline will run all the jobs for that
farm, but will have none of the container & build jobs to support these
tests.

This reverts commit 1c3097225a.

Fixes: 1c3097225a ("ci: don't run everything just because a farm gets re-enabled")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25243>
2023-09-15 16:07:17 +00:00

294 lines
10 KiB
YAML

# The logic for each $FARM is as follows:
#
# If the disable file exists, we are disabling the farm, or it's already
# disabled:
# - exists: [ .ci-farms-disabled/$FARM ]
# when: never
#
# Otherwise, changing the disable file means removing it, so we are
# re-enabling the farm:
# - changes: [ .ci-farms-disabled/$FARM ]
# if: '$CI_PIPELINE_SOURCE != "schedule"'
# when: on_success
# Note: the "manual" variant of each farm rules changes the above to `never`,
# so that jobs meant to be manual don't run in re-enablement MRs. This is the
# only difference between `.$FARM-farm-rules` and `.$FARM-farm-manual-rules`.
#
# If any other disable file is modified, we are disabling/re-enabling another
# farm:
# - changes: [ .ci-farms-disabled/* ]
# if: '$CI_PIPELINE_SOURCE != "schedule"'
# when: never
#
# The `not schedule` condition is there to make sure scheduled pipelines
# contains all the jobs, as `changes` conditions in scheduled pipelines are
# always evaluated to `true`.
#
# The "fallback", if none of these rules match, is usually the list of files
# that are used by a driver. See the various `.$DRIVER-rules` in the
# corresponding `src/**/ci/gitlab-ci.yml`.
.microsoft-farm-rules:
rules:
- exists: [ .ci-farms-disabled/microsoft ] # 1. Is disabled, never run
when: never
- changes: [ .ci-farms-disabled/microsoft ] # 2. Removed from disabled, run
if: '$CI_PIPELINE_SOURCE != "schedule"'
when: on_success
- changes: [ .ci-farms-disabled/* ] # 3. We touched other farms in MR, do not run
if: '$CI_PIPELINE_SOURCE != "schedule"'
when: never
# 4. Fall-through (other rules or on_success)
.microsoft-farm-manual-rules:
rules:
# Allow triggering jobs manually in other cases if any files affecting the
# pipeline were changed
- exists: [ .ci-farms-disabled/microsoft ]
when: never
- changes: [ .ci-farms-disabled/microsoft ]
if: '$CI_PIPELINE_SOURCE != "schedule"'
when: never
- !reference [.microsoft-farm-rules, rules]
.microsoft-farm-container-rules:
rules:
# Allow triggering jobs manually in other cases if any files affecting the
# pipeline were changed
- exists: [ .ci-farms-disabled/microsoft ]
when: never
- changes: [ .ci-farms-disabled/microsoft ]
if: '$CI_PROJECT_NAMESPACE == "mesa" && $CI_COMMIT_BRANCH'
when: on_success
- changes: [ .ci-farms-disabled/microsoft ]
if: '$GITLAB_USER_LOGIN == "marge-bot" && $CI_PIPELINE_SOURCE == "merge_request_event"'
when: on_success
- changes: [ .ci-farms-disabled/microsoft ]
if: '$CI_PROJECT_NAMESPACE == "mesa" && $GITLAB_USER_LOGIN != "marge-bot" && $CI_COMMIT_BRANCH'
when: on_success
- changes: [ .ci-farms-disabled/* ]
if: '$CI_PROJECT_NAMESPACE == "mesa" && $CI_COMMIT_BRANCH'
when: never
- changes: [ .ci-farms-disabled/* ]
if: '$GITLAB_USER_LOGIN == "marge-bot" && $CI_PIPELINE_SOURCE == "merge_request_event"'
when: never
- changes: [ .ci-farms-disabled/* ]
if: '$CI_PROJECT_NAMESPACE == "mesa" && $GITLAB_USER_LOGIN != "marge-bot" && $CI_COMMIT_BRANCH'
when: never
.collabora-farm-rules:
rules:
- exists: [ .ci-farms-disabled/collabora ]
when: never
- if: '$CI_PIPELINE_SOURCE != "schedule"'
changes: [ .ci-farms-disabled/collabora ]
when: on_success
- if: '$CI_PIPELINE_SOURCE != "schedule"'
changes: [ .ci-farms-disabled/* ]
when: never
.collabora-farm-manual-rules:
rules:
- exists: [ .ci-farms-disabled/collabora ]
when: never
- if: '$CI_PIPELINE_SOURCE != "schedule"'
changes: [ .ci-farms-disabled/collabora ]
when: never
- !reference [.collabora-farm-rules, rules]
.igalia-farm-rules:
rules:
- exists: [ .ci-farms-disabled/igalia ]
when: never
- changes: [ .ci-farms-disabled/igalia ]
if: '$CI_PIPELINE_SOURCE != "schedule"'
when: on_success
- changes: [ .ci-farms-disabled/* ]
if: '$CI_PIPELINE_SOURCE != "schedule"'
when: never
.igalia-farm-manual-rules:
rules:
- exists: [ .ci-farms-disabled/igalia ]
when: never
- changes: [ .ci-farms-disabled/igalia ]
if: '$CI_PIPELINE_SOURCE != "schedule"'
when: never
- !reference [.igalia-farm-rules, rules]
.lima-farm-rules:
rules:
- exists: [ .ci-farms-disabled/lima ]
when: never
- changes: [ .ci-farms-disabled/lima ]
if: '$CI_PIPELINE_SOURCE != "schedule"'
when: on_success
- changes: [ .ci-farms-disabled/* ]
if: '$CI_PIPELINE_SOURCE != "schedule"'
when: never
.lima-farm-manual-rules:
rules:
- exists: [ .ci-farms-disabled/lima ]
when: never
- changes: [ .ci-farms-disabled/lima ]
if: '$CI_PIPELINE_SOURCE != "schedule"'
when: never
- !reference [.lima-farm-rules, rules]
.anholt-farm-rules:
rules:
- exists: [ .ci-farms-disabled/anholt ]
when: never
- changes: [ .ci-farms-disabled/anholt ]
if: '$CI_PIPELINE_SOURCE != "schedule"'
when: on_success
- changes: [ .ci-farms-disabled/* ]
if: '$CI_PIPELINE_SOURCE != "schedule"'
when: never
.anholt-farm-manual-rules:
rules:
- exists: [ .ci-farms-disabled/anholt ]
when: never
- changes: [ .ci-farms-disabled/anholt ]
if: '$CI_PIPELINE_SOURCE != "schedule"'
when: never
- !reference [.anholt-farm-rules, rules]
.valve-farm-rules:
rules:
- exists: [ .ci-farms-disabled/valve-mupuf ]
if: '$RUNNER_FARM_LOCATION == "mupuf"'
when: never
- exists: [ .ci-farms-disabled/valve-kws ]
if: '$RUNNER_FARM_LOCATION == "keywords"'
when: never
- changes: [ .ci-farms-disabled/valve-mupuf ]
if: '$RUNNER_FARM_LOCATION == "mupuf" && $CI_PIPELINE_SOURCE != "schedule"'
when: on_success
- changes: [ .ci-farms-disabled/valve-kws ]
if: '$RUNNER_FARM_LOCATION == "keywords" && $CI_PIPELINE_SOURCE != "schedule"'
when: on_success
- changes: [ .ci-farms-disabled/* ]
if: '$CI_PIPELINE_SOURCE != "schedule"'
when: never
.valve-farm-manual-rules:
rules:
- exists: [ .ci-farms-disabled/valve-mupuf ]
if: '$RUNNER_FARM_LOCATION == "mupuf"'
when: never
- exists: [ .ci-farms-disabled/valve-kws ]
if: '$RUNNER_FARM_LOCATION == "keywords"'
when: never
- changes: [ .ci-farms-disabled/valve-mupuf ]
if: '$RUNNER_FARM_LOCATION == "mupuf" && $CI_PIPELINE_SOURCE != "schedule"'
when: never
- changes: [ .ci-farms-disabled/valve-kws ]
if: '$RUNNER_FARM_LOCATION == "keywords" && $CI_PIPELINE_SOURCE != "schedule"'
when: never
- !reference [.valve-farm-rules, rules]
.austriancoder-farm-rules:
rules:
- exists: [ .ci-farms-disabled/austriancoder ]
when: never
- changes: [ .ci-farms-disabled/austriancoder ]
if: '$CI_PIPELINE_SOURCE != "schedule"'
when: on_success
- changes: [ .ci-farms-disabled/* ]
if: '$CI_PIPELINE_SOURCE != "schedule"'
when: never
.austriancoder-farm-manual-rules:
rules:
- exists: [ .ci-farms-disabled/austriancoder ]
when: never
- changes: [ .ci-farms-disabled/austriancoder ]
if: '$CI_PIPELINE_SOURCE != "schedule"'
when: never
- !reference [.austriancoder-farm-rules, rules]
.freedreno-farm-rules:
rules:
- exists: [ .ci-farms-disabled/freedreno ]
when: never
- changes: [ .ci-farms-disabled/freedreno ]
if: '$CI_PIPELINE_SOURCE != "schedule"'
when: on_success
- changes: [ .ci-farms-disabled/* ]
if: '$CI_PIPELINE_SOURCE != "schedule"'
when: never
.freedreno-farm-manual-rules:
rules:
- exists: [ .ci-farms-disabled/freedreno ]
when: never
- changes: [ .ci-farms-disabled/freedreno ]
if: '$CI_PIPELINE_SOURCE != "schedule"'
when: never
- !reference [.freedreno-farm-rules, rules]
# Skip container & build jobs when disabling any farm, and run them if any
# farm gets re-enabled.
# Only apply these rules in MR context, because otherwise we get a false
# positive on files being 'created' when pushing to a new branch, and break
# our pipeline
.disable-farm-mr-rules:
rules:
# changes(disabled) + exists(disabled) = disabling the farm
# Note: this cannot be simplified into a single `.ci-farms-disabled/*` rule
# because if there are more than one disabled farm and we only re-enable
# one, the exits(.ci-farms-disabled/*) would match and what should be
# a farm re-enable pipeline will be detected as a farm disable pipeline.
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
changes: [ .ci-farms-disabled/microsoft ]
exists: [ .ci-farms-disabled/microsoft ]
when: never
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
changes: [ .ci-farms-disabled/collabora ]
exists: [ .ci-farms-disabled/collabora ]
when: never
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
changes: [ .ci-farms-disabled/igalia ]
exists: [ .ci-farms-disabled/igalia ]
when: never
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
changes: [ .ci-farms-disabled/lima ]
exists: [ .ci-farms-disabled/lima ]
when: never
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
changes: [ .ci-farms-disabled/anholt ]
exists: [ .ci-farms-disabled/anholt ]
when: never
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
changes: [ .ci-farms-disabled/valve-mupuf ]
exists: [ .ci-farms-disabled/valve-mupuf ]
when: never
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
changes: [ .ci-farms-disabled/valve-kws ]
exists: [ .ci-farms-disabled/valve-kws ]
when: never
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
changes: [ .ci-farms-disabled/austriancoder ]
exists: [ .ci-farms-disabled/austriancoder ]
when: never
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
changes: [ .ci-farms-disabled/freedreno ]
exists: [ .ci-farms-disabled/freedreno ]
when: never
# Any other change to ci-farms/* means some farm is getting re-enabled.
# Run jobs in Marge pipelines (and let it fallback to manual otherwise)
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $GITLAB_USER_LOGIN == "marge-bot"'
changes: [ .ci-farms/* ]
when: on_success