Add rules to skip various build/test jobs.
The following tags are available to skip CI jobs:
- user (user-mode jobs)
- system (system-mode jobs)
- centos (jobs based on CentOS distribution image)
- debian (... Debian)
- fedora (... Fedora)
- ubuntu (... Ubuntu)
- crypto (jobs testing the crypto feature)
- tci (jobs testing TCI feature)
- fuzz (fuzzer job)
- integration (integration tests)
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,debian,crypto,fuzz" 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.yml | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 961070d2cbe..432daccf590 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -21,6 +21,30 @@ include:
.native_common_job:
image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:latest
+ rules:
+ # If the if statement is true, the job is excluded from a pipeline.
+ - if: ($TARGETS =~ /softmmu/ || $CONFIGURE_ARGS =~ /disable-user/) && $SKIP_BUILD =~ /system/
+ when: never
+ - if: ($TARGETS =~ /user/ || $CONFIGURE_ARGS =~ /disable-system/) && $SKIP_BUILD =~ /user/
+ when: never
+ - if: $IMAGE =~ /^centos/ && $SKIP_BUILD =~ /centos/
+ when: never
+ - if: $IMAGE =~ /^debian/ && $SKIP_BUILD =~ /debian/
+ when: never
+ - if: $IMAGE =~ /^fedora/ && $SKIP_BUILD =~ /fedora/
+ when: never
+ - if: $IMAGE =~ /^ubuntu/ && $SKIP_BUILD =~ /ubuntu/
+ when: never
+ - if: $CI_JOB_NAME =~ /crypto/ && $SKIP_BUILD =~ /crypto/
+ when: never
+ - if: $CI_JOB_NAME =~ /tci/ && $SKIP_BUILD =~ /tci/
+ when: never
+ - if: $CI_JOB_NAME =~ /fuzz/ && $SKIP_BUILD =~ /fuzz/
+ when: never
+ - if: $CI_JOB_NAME =~ /^acceptance/ && $SKIP_BUILD =~ /integration/
+ when: never
+ # In all other cases, the job is added to the pipeline.
+ - when: on_success
.native_build_job:
extends: .native_common_job
--
2.26.2