All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: qemu-devel@nongnu.org, Cleber Rosa <crosa@redhat.com>,
	Willian Rampazzo <wrampazz@redhat.com>
Cc: "Thomas Huth" <thuth@redhat.com>,
	"Daniel P . Berrangé" <berrange@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>,
	"Wainer dos Santos Moschetta" <wainersm@redhat.com>,
	virt-ci-maint-team@redhat.com,
	"Alex Bennée" <alex.bennee@linaro.org>
Subject: [RFC PATCH 2/2] gitlab-ci: Introduce allow_skipping_job_template
Date: Fri, 11 Dec 2020 18:17:03 +0100	[thread overview]
Message-ID: <20201211171703.537546-3-philmd@redhat.com> (raw)
In-Reply-To: <20201211171703.537546-1-philmd@redhat.com>

It might be overkill (and frustrating) to rerun all the jobs when
iterating over a single code unit. As some users are interested
in only rerunning a specific set of jobs, allow them to use a
"manual" profile, when jobs are created in the pipeline but not
started. It is up to the user to manually start the jobs of
interest.

To switch a repository to manual, set QEMU_DEFAULT_WORKFLOW_MANUAL
in the project UI, following [1].

Once a repository is using the manual workflow, the user can still
automatically start the jobs by explicitly set the
QEMU_IGNORE_DEFAULT_WORKFLOW which disable the manual mode.

Example while pushing a branch/tag from command line (see [2]):

  $ git push -o ci.variable="QEMU_IGNORE_DEFAULT_WORKFLOW=1" \
      myrepo mybranch

[1] https://docs.gitlab.com/ee/ci/variables/#create-a-custom-variable-in-the-ui
[2] 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 |  4 ++++
 .gitlab-ci.yml               | 18 ++++++++++++++++++
 2 files changed, 22 insertions(+)

diff --git a/.gitlab-ci.d/crossbuilds.yml b/.gitlab-ci.d/crossbuilds.yml
index 864cad7cec5..56b053cbb52 100644
--- a/.gitlab-ci.d/crossbuilds.yml
+++ b/.gitlab-ci.d/crossbuilds.yml
@@ -1,4 +1,5 @@
 .cross_system_build_job:
+  extends: .allow_skipping_job
   stage: build
   image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:latest
   timeout: 80m
@@ -18,6 +19,7 @@
 # KVM), and set extra options (such disabling other accelerators) via the
 # $ACCEL_CONFIGURE_OPTS variable.
 .cross_accel_build_job:
+  extends: .allow_skipping_job
   stage: build
   image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:latest
   timeout: 30m
@@ -30,6 +32,7 @@
     - make -j$(expr $(nproc) + 1) all check-build
 
 .cross_user_build_job:
+  extends: .allow_skipping_job
   stage: build
   image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:latest
   script:
@@ -40,6 +43,7 @@
     - make -j$(expr $(nproc) + 1) all check-build
 
 .cross_sanity_check_job:
+  extends: .allow_skipping_job
   stage: build
   image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:latest
   timeout: 3m
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 98bff03b47b..26b85f08f35 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -13,7 +13,21 @@ include:
   - local: '/.gitlab-ci.d/containers.yml'
   - local: '/.gitlab-ci.d/crossbuilds.yml'
 
+.allow_skipping_job_template: &allow_skipping_job_definition
+  rules:
+    # Skip if the user set the QEMU_DEFAULT_WORKFLOW_MANUAL variable for its
+    # project. Can be overridden by setting the QEMU_IGNORE_DEFAULT_WORKFLOW
+    # variable.
+    - if: $CI_PIPELINE_SOURCE == "push" && $QEMU_DEFAULT_WORKFLOW_MANUAL && $QEMU_IGNORE_DEFAULT_WORKFLOW == null
+      when: manual
+      allow_failure: true
+    - when: always
+
+.allow_skipping_job:
+  <<: *allow_skipping_job_definition
+
 .native_build_job_template: &native_build_job_definition
+  <<: *allow_skipping_job_definition
   stage: build
   image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:latest
   before_script:
@@ -35,6 +49,7 @@ include:
       fi
 
 .native_test_job_template: &native_test_job_definition
+  <<: *allow_skipping_job_definition
   stage: test
   image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:latest
   script:
@@ -43,6 +58,7 @@ include:
     - make $MAKE_CHECK_ARGS
 
 .acceptance_template: &acceptance_definition
+  <<: *allow_skipping_job_definition
   cache:
     key: "${CI_JOB_NAME}-cache"
     paths:
@@ -536,6 +552,7 @@ check-dco:
     GIT_DEPTH: 1000
 
 build-libvhost-user:
+  <<: *allow_skipping_job_definition
   stage: build
   image: $CI_REGISTRY_IMAGE/qemu/fedora:latest
   before_script:
@@ -547,6 +564,7 @@ build-libvhost-user:
     - ninja
 
 pages:
+  <<: *allow_skipping_job_definition
   image: $CI_REGISTRY_IMAGE/qemu/ubuntu2004:latest
   stage: test
   needs:
-- 
2.26.2



  parent reply	other threads:[~2020-12-11 18:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-11 17:17 [RFC PATCH 0/2] gitlab-ci: Maintain a public runner, allow manual pipeline Philippe Mathieu-Daudé
2020-12-11 17:17 ` [RFC PATCH 1/2] gitlab-ci: Step in to maintain the fedora-i386-cross runner Philippe Mathieu-Daudé
2020-12-14 12:35   ` Thomas Huth
2020-12-14 17:52     ` Philippe Mathieu-Daudé
2020-12-15 10:01       ` Daniel P. Berrangé
2020-12-11 17:17 ` Philippe Mathieu-Daudé [this message]
2020-12-14 13:32   ` [RFC PATCH 2/2] gitlab-ci: Introduce allow_skipping_job_template Thomas Huth
2020-12-14 15:02     ` Philippe Mathieu-Daudé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201211171703.537546-3-philmd@redhat.com \
    --to=philmd@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=berrange@redhat.com \
    --cc=crosa@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    --cc=virt-ci-maint-team@redhat.com \
    --cc=wainersm@redhat.com \
    --cc=wrampazz@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.