qemu-devel
[Top][All Lists]
Advanced

[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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]