diff mbox series

[1/2] CI: Allow job tag to be optionally set globally

Message ID 20230310095303.671951-2-peter.hoyes@arm.com
State Accepted
Delegated to: Tom Rini
Headers show
Series CI configuration improvements | expand

Commit Message

Peter Hoyes March 10, 2023, 9:53 a.m. UTC
From: Peter Hoyes <Peter.Hoyes@arm.com>

The default behavior of Gitlab runners is to only run jobs which match
the configured tag, although there is an option to run untagged jobs
[1].

To support running the CI in more complex environments where different
types of runners may be present that support different tags, allow the
DEFAULT_TAG for all jobs in the pipeline to be set globally using an
environment variable. An empty default value is provided to retain
support for untagged runners.

[1] https://docs.gitlab.com/ee/ci/runners/configure_runners.html#use-tags-to-control-which-jobs-a-runner-can-run

Signed-off-by: Peter Hoyes <Peter.Hoyes@arm.com>
---
 .gitlab-ci.yml | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Simon Glass March 10, 2023, 8:49 p.m. UTC | #1
On Fri, 10 Mar 2023 at 01:54, Peter Hoyes <peter.hoyes@arm.com> wrote:
>
> From: Peter Hoyes <Peter.Hoyes@arm.com>
>
> The default behavior of Gitlab runners is to only run jobs which match
> the configured tag, although there is an option to run untagged jobs
> [1].
>
> To support running the CI in more complex environments where different
> types of runners may be present that support different tags, allow the
> DEFAULT_TAG for all jobs in the pipeline to be set globally using an
> environment variable. An empty default value is provided to retain
> support for untagged runners.
>
> [1] https://docs.gitlab.com/ee/ci/runners/configure_runners.html#use-tags-to-control-which-jobs-a-runner-can-run
>
> Signed-off-by: Peter Hoyes <Peter.Hoyes@arm.com>
> ---
>  .gitlab-ci.yml | 7 +++++++
>  1 file changed, 7 insertions(+)

Reviewed-by: Simon Glass <sjg@chromium.org>
Tom Rini March 17, 2023, 4:43 p.m. UTC | #2
On Fri, Mar 10, 2023 at 09:53:02AM +0000, Peter Hoyes wrote:

> From: Peter Hoyes <Peter.Hoyes@arm.com>
> 
> The default behavior of Gitlab runners is to only run jobs which match
> the configured tag, although there is an option to run untagged jobs
> [1].
> 
> To support running the CI in more complex environments where different
> types of runners may be present that support different tags, allow the
> DEFAULT_TAG for all jobs in the pipeline to be set globally using an
> environment variable. An empty default value is provided to retain
> support for untagged runners.
> 
> [1] https://docs.gitlab.com/ee/ci/runners/configure_runners.html#use-tags-to-control-which-jobs-a-runner-can-run
> 
> Signed-off-by: Peter Hoyes <Peter.Hoyes@arm.com>

Reviewed-by: Tom Rini <trini@konsulko.com>
Tom Rini March 22, 2023, 2:37 p.m. UTC | #3
On Fri, Mar 10, 2023 at 09:53:02AM +0000, Peter Hoyes wrote:

> From: Peter Hoyes <Peter.Hoyes@arm.com>
> 
> The default behavior of Gitlab runners is to only run jobs which match
> the configured tag, although there is an option to run untagged jobs
> [1].
> 
> To support running the CI in more complex environments where different
> types of runners may be present that support different tags, allow the
> DEFAULT_TAG for all jobs in the pipeline to be set globally using an
> environment variable. An empty default value is provided to retain
> support for untagged runners.
> 
> [1] https://docs.gitlab.com/ee/ci/runners/configure_runners.html#use-tags-to-control-which-jobs-a-runner-can-run
> 
> Signed-off-by: Peter Hoyes <Peter.Hoyes@arm.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> Reviewed-by: Tom Rini <trini@konsulko.com>

Applied to u-boot/next, thanks!
diff mbox series

Patch

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 272d69e220..d54694e016 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,5 +1,12 @@ 
 # SPDX-License-Identifier: GPL-2.0+
 
+variables:
+  DEFAULT_TAG: ""
+
+default:
+  tags:
+    - ${DEFAULT_TAG}
+
 # Grab our configured image.  The source for this is found
 # in the u-boot tree at tools/docker/Dockerfile
 image: trini/u-boot-gitlab-ci-runner:jammy-20230126-10Feb2023