Skip to contentSkip to conversation

gitlab-ci: Allow adding manual jobs on cirrus-ci

PATCH In review Philippe Mathieu-Daudé 3 participants 4 messages Mar 14, 2022 – May 17, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gitlab-ci: Allow adding manual jobs on cirrus-ci

From: Philippe Mathieu-Daudé <[email protected]>

By default, all Cirrus-CI jobs are added as 'on_success' (the default value). Add a ${MANUAL_JOB} variable (default to 0) to be able to add manual jobs.

---
 .gitlab-ci.d/cirrus.yml       | 2 ++
 .gitlab-ci.d/cirrus/build.yml | 1 +
 2 files changed, 3 insertions(+)
.gitlab-ci.d/cirrus.yml +2 -0
index b96b22e269..9e640019dd 100644
@@ -44,6 +44,8 @@
     # Allow on 'staging' branch and 'stable-X.Y-staging' branches only
     - if: '$CI_PROJECT_NAMESPACE == "qemu-project" && $CI_COMMIT_BRANCH !~ /staging/'
       when: never
+    - if: '$CIRRUS_GITHUB_REPO && $CIRRUS_API_TOKEN && $MANUAL_JOB == "1"'
+      when: manual
     - if: "$CIRRUS_GITHUB_REPO && $CIRRUS_API_TOKEN"
 
 x64-freebsd-12-build:
.gitlab-ci.d/cirrus/build.yml +1 -0
index c555f5d36e..c58dc86855 100644
@@ -14,6 +14,7 @@ env:
   MAKE: "@MAKE@"
   CONFIGURE_ARGS: "@CONFIGURE_ARGS@"
   TEST_TARGETS: "@TEST_TARGETS@"
+  MANUAL_JOB: 0
 
 build_task:
   install_script:
Signature · 1 line
2.34.1
#1 lore raw
Quoted 31 lines · Philippe Mathieu-Daudé

From: Philippe Mathieu-Daudé <[email protected]>

By default, all Cirrus-CI jobs are added as 'on_success' (the default value). Add a ${MANUAL_JOB} variable (default to 0) to be able to add manual jobs.

---
  .gitlab-ci.d/cirrus.yml       | 2 ++
  .gitlab-ci.d/cirrus/build.yml | 1 +
  2 files changed, 3 insertions(+)
.gitlab-ci.d/cirrus.yml +2 -0
index b96b22e269..9e640019dd 100644
@@ -44,6 +44,8 @@
      # Allow on 'staging' branch and 'stable-X.Y-staging' branches only
      - if: '$CI_PROJECT_NAMESPACE == "qemu-project" && $CI_COMMIT_BRANCH !~ /staging/'
        when: never
+    - if: '$CIRRUS_GITHUB_REPO && $CIRRUS_API_TOKEN && $MANUAL_JOB == "1"'
+      when: manual
      - if: "$CIRRUS_GITHUB_REPO && $CIRRUS_API_TOKEN"
 
  x64-freebsd-12-build:
.gitlab-ci.d/cirrus/build.yml +0 -0
index c555f5d36e..c58dc86855 100644

.gitlab-ci.d/cirrus/build.yml env: · line 20

Quoted 7 lines
.gitlab-ci.d/cirrus/build.yml +1 -0
@@ -14,6 +14,7 @@ env:
    MAKE: "@MAKE@"
    CONFIGURE_ARGS: "@CONFIGURE_ARGS@"
    TEST_TARGETS: "@TEST_TARGETS@"
+  MANUAL_JOB: 0
 
  build_task:
    install_script:

Hi Philippe!

Sorry for the late reply ... I think this might collide with Daniel's patch that turns most jobs to manual mode
(https://lore.kernel.org/all/[email protected]/) which he is hopefully going to respin soon ... but anyway, if you add a variable like this, there should be an update to docs/devel/ci-jobs.rst.inc to describe the new variable, otherwise you might be the only one who's using it.

Thomas

#2 lore raw
Quoted 27 lines · Thomas Huth
Quoted 23 lines · Philippe Mathieu-Daudé

From: Philippe Mathieu-Daudé <[email protected]>

By default, all Cirrus-CI jobs are added as 'on_success' (the default value). Add a ${MANUAL_JOB} variable (default to 0) to be able to add manual jobs.

---
  .gitlab-ci.d/cirrus.yml       | 2 ++
  .gitlab-ci.d/cirrus/build.yml | 1 +
  2 files changed, 3 insertions(+)
.gitlab-ci.d/cirrus.yml +2 -0
index b96b22e269..9e640019dd 100644
@@ -44,6 +44,8 @@
      # Allow on 'staging' branch and 'stable-X.Y-staging' branches only
      - if: '$CI_PROJECT_NAMESPACE == "qemu-project" && $CI_COMMIT_BRANCH !~ /staging/'
        when: never
+    - if: '$CIRRUS_GITHUB_REPO && $CIRRUS_API_TOKEN && $MANUAL_JOB == "1"'
+      when: manual
Quoted 11 lines

.gitlab-ci.d/cirrus/build.yml env: · line 17

Quoted 11 lines
.gitlab-ci.d/cirrus.yml +0 -0
      - if: "$CIRRUS_GITHUB_REPO && $CIRRUS_API_TOKEN"
  x64-freebsd-12-build:
.gitlab-ci.d/cirrus/build.yml +1 -0
index c555f5d36e..c58dc86855 100644
@@ -14,6 +14,7 @@ env:
    MAKE: "@MAKE@"
    CONFIGURE_ARGS: "@CONFIGURE_ARGS@"
    TEST_TARGETS: "@TEST_TARGETS@"
+  MANUAL_JOB: 0

This addition doesn't make sense. build.yml is config that is run by Cirrus CI.

The MANUAL_JOB env is interpreted by GitLab CI, so would only ever be set by jobs in .gitlab-ci.d/cirrus.yml

Quoted 5 lines

.gitlab-ci.d/cirrus/build.yml env: · line 20

Quoted 2 lines
.gitlab-ci.d/cirrus/build.yml +0 -0
  build_task:
    install_script:

Hi Philippe!

Quoted 7 lines

Sorry for the late reply ... I think this might collide with Daniel's patch that turns most jobs to manual mode
(https://lore.kernel.org/all/[email protected]/)
which he is hopefully going to respin soon ... but anyway, if you add a variable like this, there should be an update to docs/devel/ci-jobs.rst.inc to describe the new variable, otherwise you might be the only one who's using it.

IIUC, this MANUAL_JOB variable isn't for end developer usage, rather it is for usage when adding jobs to .gitlab-ci.d/cirrus.yml, so I don't think it needs documenting there. THis simply lets us add a bunch more jobs to cirrus.yml without causing timeout problems by having them all run at once, providing we put MANUAL_JOB: 1 in the config for the new job.

No need to delay this for sake of my series. I'll adapt to whatever exists at the time I'm rebasing.

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#3 lore raw
Quoted 59 lines · Daniel P. Berrangé
Quoted 27 lines · Thomas Huth
Quoted 23 lines · Philippe Mathieu-Daudé

From: Philippe Mathieu-Daudé <[email protected]>

By default, all Cirrus-CI jobs are added as 'on_success' (the default value). Add a ${MANUAL_JOB} variable (default to 0) to be able to add manual jobs.

---
   .gitlab-ci.d/cirrus.yml       | 2 ++
   .gitlab-ci.d/cirrus/build.yml | 1 +
   2 files changed, 3 insertions(+)
.gitlab-ci.d/cirrus.yml +2 -0
index b96b22e269..9e640019dd 100644
@@ -44,6 +44,8 @@
       # Allow on 'staging' branch and 'stable-X.Y-staging' branches only
       - if: '$CI_PROJECT_NAMESPACE == "qemu-project" && $CI_COMMIT_BRANCH !~ /staging/'
         when: never
+    - if: '$CIRRUS_GITHUB_REPO && $CIRRUS_API_TOKEN && $MANUAL_JOB == "1"'
+      when: manual
Quoted 11 lines

.gitlab-ci.d/cirrus/build.yml env: · line 17

Quoted 11 lines
.gitlab-ci.d/cirrus.yml +0 -0
       - if: "$CIRRUS_GITHUB_REPO && $CIRRUS_API_TOKEN"
   x64-freebsd-12-build:
.gitlab-ci.d/cirrus/build.yml +1 -0
index c555f5d36e..c58dc86855 100644
@@ -14,6 +14,7 @@ env:
     MAKE: "@MAKE@"
     CONFIGURE_ARGS: "@CONFIGURE_ARGS@"
     TEST_TARGETS: "@TEST_TARGETS@"
+  MANUAL_JOB: 0

This addition doesn't make sense. build.yml is config that is run by Cirrus CI.

The MANUAL_JOB env is interpreted by GitLab CI, so would only ever be set by jobs in .gitlab-ci.d/cirrus.yml

Quoted 5 lines

.gitlab-ci.d/cirrus/build.yml env: · line 20

Quoted 2 lines
.gitlab-ci.d/cirrus/build.yml +0 -0
   build_task:
     install_script:

Hi Philippe!

Quoted 7 lines

Sorry for the late reply ... I think this might collide with Daniel's patch that turns most jobs to manual mode
(https://lore.kernel.org/all/[email protected]/)
which he is hopefully going to respin soon ... but anyway, if you add a variable like this, there should be an update to docs/devel/ci-jobs.rst.inc to describe the new variable, otherwise you might be the only one who's using it.

Quoted 5 lines

IIUC, this MANUAL_JOB variable isn't for end developer usage, rather it is for usage when adding jobs to .gitlab-ci.d/cirrus.yml, so I don't think it needs documenting there. THis simply lets us add a bunch more jobs to cirrus.yml without causing timeout problems by having them all run at once, providing we put MANUAL_JOB: 1 in the config for the new job.

Ok, but then this patch is incomplete. This should either be in a series that introduces such new jobs, or/and rework the NetBSD and OpenBSD jobs to use this variable, too.

Thomas