[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH 8/9] gitlab-ci: Add rules to skip building cross-jobs
From: |
Philippe Mathieu-Daudé |
Subject: |
[RFC PATCH 8/9] gitlab-ci: Add rules to skip building cross-jobs |
Date: |
Wed, 4 Nov 2020 23:45:57 +0100 |
Add rules to skip some crossbuild jobs.
The following tags are available to skip CI jobs:
- cross (skip all cross-jobs)
- system (skip all cross-system jobs)
- user (skip all cross-user jobs)
Developers can combine tags in the SKIP_BUILD variable when
pushing a branch (or tag) to repositories. Examples:
$ git push -o ci.variable="SKIP_BUILD=user" myrepo mybranch
$ git push -o ci.variable="SKIP_BUILD=user,system" myrepo mybranch
References:
- https://docs.gitlab.com/ee/ci/yaml/#rulesif
-
https://docs.gitlab.com/ee/user/project/push_options.html#push-options-for-gitlab-cicd
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
.gitlab-ci.d/crossbuilds.yml | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/.gitlab-ci.d/crossbuilds.yml b/.gitlab-ci.d/crossbuilds.yml
index 701550f028c..08f27649eb2 100644
--- a/.gitlab-ci.d/crossbuilds.yml
+++ b/.gitlab-ci.d/crossbuilds.yml
@@ -1,6 +1,16 @@
.cross_common_job:
stage: build
image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:latest
+ rules:
+ # If the if statement is true, the job is excluded from a pipeline.
+ - if: $SKIP_BUILD =~ /cross/
+ when: never
+ - if: $CI_JOB_NAME =~ /system/ && $SKIP_BUILD =~ /system/
+ when: never
+ - if: $CI_JOB_NAME =~ /user/ && $SKIP_BUILD =~ /user/
+ when: never
+ # In all other cases, the job is added to the pipeline.
+ - when: on_success
.cross_system_build_job:
extends: .cross_common_job
--
2.26.2
- [RFC PATCH 0/9] gitlab-ci: Allow forks to skip some build jobs, Philippe Mathieu-Daudé, 2020/11/04
- [RFC PATCH 1/9] gitlab-ci: Replace YAML anchors by extends (cross_system_build_job), Philippe Mathieu-Daudé, 2020/11/04
- [RFC PATCH 2/9] gitlab-ci: Replace YAML anchors by extends (native_build_job), Philippe Mathieu-Daudé, 2020/11/04
- [RFC PATCH 3/9] gitlab-ci: Replace YAML anchors by extends (native_test_job), Philippe Mathieu-Daudé, 2020/11/04
- [RFC PATCH 4/9] gitlab-ci: Replace YAML anchors by extends (acceptance_test_job), Philippe Mathieu-Daudé, 2020/11/04
- [RFC PATCH 5/9] gitlab-ci: Rename acceptance_test_job -> integration_test_job, Philippe Mathieu-Daudé, 2020/11/04
- [RFC PATCH 6/9] gitlab-ci: Extract common job definition as 'cross_common_job', Philippe Mathieu-Daudé, 2020/11/04
- [RFC PATCH 8/9] gitlab-ci: Add rules to skip building cross-jobs,
Philippe Mathieu-Daudé <=
- [RFC PATCH 9/9] gitlab-ci: Add rules to skip building/testing native jobs, Philippe Mathieu-Daudé, 2020/11/04
- [RFC PATCH 7/9] gitlab-ci: Extract common job definition as 'native_common_job', Philippe Mathieu-Daudé, 2020/11/04
- Re: [RFC PATCH 0/9] gitlab-ci: Allow forks to skip some build jobs, Philippe Mathieu-Daudé, 2020/11/05