[libvirt PATCH 1/2] ci: Define the integration job tag dynamically via a variable
Erik Skultety
eskultet at redhat.com
Tue Mar 22 06:52:20 UTC 2022
Custom runners are private to a project, so naturally forks cannot run
any workloads on these. The integration test suite which requires
access to our custom runner is naturally disabled on forks and can be
enabled by setting LIBVIRT_CI_INTEGRATION=1.
The problem is that the current integration jobs definitions have tags
statically defined as 'redhat-vm-host'. If users are going to supply
their own private runners for their forks, they can define whatever
tags they want with it and so unless they add 'redhat-vm-host' to their
own runner's tags, the pipeline won't run.
To solve this, define the integration job tag using a variable. The
repo config will use the value defined in the job for the variable
while users can override the value easily on a project/pipeline level
thanks to GitLab's CI variable precedence [1].
[1] https://docs.gitlab.com/ee/ci/variables/#cicd-variable-precedence
Signed-off-by: Erik Skultety <eskultet at redhat.com>
---
ci/integration.yml | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/ci/integration.yml b/ci/integration.yml
index 8551ce8776..9726f00bff 100644
--- a/ci/integration.yml
+++ b/ci/integration.yml
@@ -45,7 +45,6 @@
when: on_success
- when: never
-
centos-stream-8-tests:
extends: .integration_tests
needs:
@@ -57,8 +56,10 @@ centos-stream-8-tests:
variables:
# needed by libvirt-gitlab-executor
DISTRO: centos-stream-8
+ # can be overriden in forks to set a different runner tag
+ LIBVIRT_CI_INTEGRATION_RUNNER_TAG: redhat-vm-host
tags:
- - redhat-vm-host
+ - $LIBVIRT_CI_INTEGRATION_RUNNER_TAG
centos-stream-9-tests:
extends: .integration_tests
@@ -71,8 +72,10 @@ centos-stream-9-tests:
variables:
# needed by libvirt-gitlab-executor
DISTRO: centos-stream-9
+ # can be overriden in forks to set a different runner tag
+ LIBVIRT_CI_INTEGRATION_RUNNER_TAG: redhat-vm-host
tags:
- - redhat-vm-host
+ - $LIBVIRT_CI_INTEGRATION_RUNNER_TAG
fedora-34-tests:
extends: .integration_tests
@@ -85,8 +88,10 @@ fedora-34-tests:
variables:
# needed by libvirt-gitlab-executor
DISTRO: fedora-34
+ # can be overriden in forks to set a different runner tag
+ LIBVIRT_CI_INTEGRATION_RUNNER_TAG: redhat-vm-host
tags:
- - redhat-vm-host
+ - $LIBVIRT_CI_INTEGRATION_RUNNER_TAG
fedora-35-tests:
extends: .integration_tests
@@ -99,5 +104,7 @@ fedora-35-tests:
variables:
# needed by libvirt-gitlab-executor
DISTRO: fedora-35
+ # can be overriden in forks to set a different runner tag
+ LIBVIRT_CI_INTEGRATION_RUNNER_TAG: redhat-vm-host
tags:
- - redhat-vm-host
+ - $LIBVIRT_CI_INTEGRATION_RUNNER_TAG
--
2.34.1
More information about the libvir-list
mailing list