CI: Support stage selection with merge requests

Currently the stage/board selection only works with normal pushes, since
gitlab unfortunately drops CI variables when starting an MR pipeline.

Fix this by looking for tags in the MR description. This only supports
stage-selection, not individual boards.

Simplify the workflow since the previous changes are now not needed.
Cover-letter:
Updates for the new utool
This series includes a patch to make CI work with the way utool
operates, specifically to allow merge requests to honour its requests.

It also drops an unwanted test file.
END

Signed-off-by: Simon Glass <simon.glass@canonical.com>
This commit is contained in:
Simon Glass
2025-12-23 23:09:21 -07:00
parent 6b12f88b54
commit ce0a74a60d

View File

@@ -3,17 +3,13 @@
include:
- local: '.gitlab-ci-release.yml'
# Control when pipelines are created
workflow:
rules:
# Allow manual merge request pipelines when MANUAL_TRIGGER is set
- if: $CI_PIPELINE_SOURCE == "merge_request_event" && $MANUAL_TRIGGER == "1"
- if: $CI_PIPELINE_SOURCE == "push"
when: always
# Prevent automatic merge request pipelines
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
when: never
# Allow all other pipeline sources (push, manual, API)
- when: always
when: always
- when: never
variables:
DEFAULT_TAG: ""
@@ -53,6 +49,9 @@ stages:
# - privileged = true in /etc/gitlab-runner/config.toml
# OR passwordless sudo for: modprobe, cryptsetup, dd
rules:
# Skip if MR description contains [skip-pytest]
- if: $CI_MERGE_REQUEST_DESCRIPTION =~ /\[skip-pytest\]/
when: never
- if: $PYTEST == "1"
when: always
- if: $PYTEST == $CI_JOB_NAME
@@ -154,6 +153,9 @@ stages:
.world_build:
stage: world_build
rules:
# Skip if MR description contains [skip-world]
- if: $CI_MERGE_REQUEST_DESCRIPTION =~ /\[skip-world\]/
when: never
- if: $WORLD == "1"
when: always
- when: never
@@ -236,6 +238,9 @@ build all other platforms:
.test_suites:
stage: test_suites
rules:
# Skip if MR description contains [skip-suites]
- if: $CI_MERGE_REQUEST_DESCRIPTION =~ /\[skip-suites\]/
when: never
- if: $SUITES == "1"
when: always
- when: never
@@ -381,6 +386,9 @@ Examples:
.python_check_template:
stage: test.py
rules:
# Skip if MR description contains [skip-pytest]
- if: $CI_MERGE_REQUEST_DESCRIPTION =~ /\[skip-pytest\]/
when: never
- if: $PYTEST == "1"
when: always
- if: $PYTEST == $CI_JOB_NAME
@@ -726,6 +734,9 @@ coreboot test.py:
stage: sjg-lab
needs: []
rules:
# Skip if MR description contains [skip-sjg]
- if: $CI_MERGE_REQUEST_DESCRIPTION =~ /\[skip-sjg\]/
when: never
- if: $SJG_LAB == $ROLE || $SJG_LAB == "1"
when: always
- if: $CI_PIPELINE_SOURCE == "merge_request_event"