ci: Add support for ONLY_JOBS variable to trigger any validation pipeline
By setting the ONLY_JOBS variable to the name of the job (or multiple jobs), the resulting pipeline will include a validation job for that pipeline.
For example - if you set ONLY_JOBS="x86_64-linux-ubuntu22_04-validate" then a ubuntu22_04 job will be included in the validation pipeline. This is useful for testing specific jobs.
Fixes #25332 (closed)
Merge request reports
Activity
requested review from @torsten.schmits
@torsten.schmits Perhaps we should instead have
ONLY_JOBS
and allow specifying multiple pipelines in the env var? What do you think?644 646 645 647 -- Convert the state of the rule into a string that gitlab understand. 646 648 ruleString :: OnOff -> Rule -> String 647 ruleString On (ValidateOnly vs) = 649 ruleString On (ValidateOnly only_job_name vs) = 648 650 case S.toList vs of 649 [] -> true 650 conds -> or_all (map validateRuleString conds) 651 conds -> or_all (map validateRuleString (OnlyJob only_job_name : conds)) changed this line in version 2 of the diff
- If I understand correctly, this would add a job to a pipeline? If this flag is only considered when
ValidateOnly
matches, doesn't that mean that all jobs are executed (since the condition is combined with||
)? - My intuition is that running multiple jobs won't be such a popular use case that it would be too impractical to manually run multiple pipelines. But once such a feature is available people usually find new reasons to do stuff, and it's a trivial change, so why not
Putting those two together, how about something like this:
ruleString On (ValidateOnly only_job_name vs) = and_all [or_all [onlyJobsEmpty, onlyJobsMatch], or_all (map validateRuleString (S.toList vs))] where onlyJobsEmpty = envVarString "ONLY_JOBS" "\"\"" onlyJobsMatch = "$ONLY_JOBS =~ \"" ++ only_job_name ++ "\""
Maybe we need a more complex regex to avoid substring matches, but it seems like an edge case.
- If I understand correctly, this would add a job to a pipeline? If this flag is only considered when
added 14 commits
-
273c2df4...c9590ba0 - 13 commits from branch
master
- 67bb8021 - ci: Add support for ONLY_JOBS variable to trigger any validation pipeline
-
273c2df4...c9590ba0 - 13 commits from branch
added 1 commit
- 00fc431a - ci: Add support for ONLY_JOBS variable to trigger any validation pipeline
added 1 commit
- ae0ab8d7 - ci: Add support for ONLY_JOBS variable to trigger any validation pipeline
@torsten.schmits Things are not perfect, prefix jobs also get matched.
See here https://gitlab.haskell.org/ghc/ghc/-/pipelines/101470
I tried with
ONLY_JOBS=x86_64-linux-ubuntu22_04-validate aarch64-linux-deb12-validate+llvm
.
added 1 commit
- 8db02d93 - ci: Add support for ONLY_JOBS variable to trigger any validation pipeline
added 1 commit
- 653f25bd - ci: Add support for ONLY_JOBS variable to trigger any validation pipeline
added 28 commits
-
653f25bd...8584504b - 27 commits from branch
master
- cca59600 - ci: Add support for ONLY_JOBS variable to trigger any validation pipeline
-
653f25bd...8584504b - 27 commits from branch
assigned to @marge-bot
I will attempt to batch this MR (!13443 (closed))...
unassigned @marge-bot
Batch MR !13443 (closed) failed: CI failed! I will retry later...
added 77 commits
-
cca59600...5bcfefd5 - 76 commits from branch
master
- 0e1f72e1 - ci: Add support for ONLY_JOBS variable to trigger any validation pipeline
-
cca59600...5bcfefd5 - 76 commits from branch
assigned to @marge-bot
I will attempt to batch this MR (!13460 (closed))...
Merged in eff16c22
mentioned in issue #25404 (closed)
mentioned in commit b027f978