ci: Define the integration job tag dynamically via a variable

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@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Erik Skultety 2022-03-21 13:51:53 +01:00
parent 731456ca13
commit e23353756e

View File

@ -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