From 4edebe3db0bb3123716030ed71660e9864f81c79 Mon Sep 17 00:00:00 2001 From: Alex Tercete Date: Thu, 9 Jan 2025 13:49:06 +0000 Subject: [PATCH] feat(ruleset): allow choosing which jobs to include Ideally, the `jobs` input would be of type `array`, but it's not possible (or, at least, not easy) to convert an array into a string so that it can be used from `include:rules:if` expressions. --- templates/ruleset/template.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/templates/ruleset/template.yml b/templates/ruleset/template.yml index f7937a3..ebcf320 100644 --- a/templates/ruleset/template.yml +++ b/templates/ruleset/template.yml @@ -44,6 +44,11 @@ spec: - linux - windows description: "The operating systems to test on." + jobs: + default: config version os + description: "The space-separated list of jobs to include." + regex: ^(config|version|os|\s)+$ + --- include: - local: "/templates/ruleset/version.yml" @@ -54,6 +59,8 @@ include: needs: $[[inputs.needs]] roots: $[[inputs.roots]] versions: $[[inputs.versions]] + rules: + - if: '"$[[inputs.jobs]]" =~ /version/' - local: "/templates/ruleset/config.yml" inputs: image: "$[[inputs.image]]" @@ -62,6 +69,8 @@ include: needs: $[[inputs.needs]] roots: $[[inputs.roots]] configs: $[[inputs.configs]] + rules: + - if: '"$[[inputs.jobs]]" =~ /config/' - local: "/templates/ruleset/os.yml" inputs: image: "$[[inputs.image]]" @@ -70,6 +79,8 @@ include: needs: $[[inputs.needs]] roots: $[[inputs.roots]] oses: $[[inputs.oses]] + rules: + - if: '"$[[inputs.jobs]]" =~ /os/' - local: "/templates/ruleset/semantic-release.yml" inputs: image: "$[[inputs.image]]" -- GitLab