Skip to content
Snippets Groups Projects

ci: Add support for ONLY_JOBS variable to trigger any validation pipeline

Closed Matthew Pickering requested to merge wip/only_job into master
4 unresolved threads

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)

Edited by Matthew Pickering

Merge request reports

Approved by
Test summary results are being parsed

Closed by Marge BotMarge Bot 5 months ago (Oct 20, 2024 1:55am UTC)

Merge details

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
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))
    1. 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 ||)?
    2. 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 :slight_smile:

    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.

    • Yes currently you can specify one job and it adds it to the pipeline.

      You are proposing that ONLY_JOBS will only run the specified jobs (not in addition to other jobs)?

    • That was my understanding of the motivation – when I started a pipeline to run a single job, you suggested to cancel those I wasn't interested in. If this is about a different use case, please illuminate me :slight_smile:

    • Please register or sign in to reply
  • added 14 commits

    • 273c2df4...c9590ba0 - 13 commits from branch master
    • 67bb8021 - ci: Add support for ONLY_JOBS variable to trigger any validation pipeline

    Compare with previous version

  • Matthew Pickering changed title from ci: Add support for ONLY_JOB variable to trigger any validation pipeline to ci: Add support for ONLY_JOBS variable to trigger any validation pipeline

    changed title from ci: Add support for ONLY_JOB variable to trigger any validation pipeline to ci: Add support for ONLY_JOBS variable to trigger any validation pipeline

  • Matthew Pickering changed the description

    changed the description

  • Torsten Schmits approved this merge request

    approved this merge request

  • added 1 commit

    • 00fc431a - ci: Add support for ONLY_JOBS variable to trigger any validation pipeline

    Compare with previous version

  • added 1 commit

    • ae0ab8d7 - ci: Add support for ONLY_JOBS variable to trigger any validation pipeline

    Compare with previous version

  • added 1 commit

    • 8db02d93 - ci: Add support for ONLY_JOBS variable to trigger any validation pipeline

    Compare with previous version

  • added 1 commit

    • 653f25bd - ci: Add support for ONLY_JOBS variable to trigger any validation pipeline

    Compare with previous version

  • added 28 commits

    • 653f25bd...8584504b - 27 commits from branch master
    • cca59600 - ci: Add support for ONLY_JOBS variable to trigger any validation pipeline

    Compare with previous version

  • I will attempt to batch this MR (!13443 (closed))...

  • Batch MR !13443 (closed) failed: CI failed! I will retry later...

  • Cheng Shao added 77 commits

    added 77 commits

    • cca59600...5bcfefd5 - 76 commits from branch master
    • 0e1f72e1 - ci: Add support for ONLY_JOBS variable to trigger any validation pipeline

    Compare with previous version

  • assigned to @marge-bot

  • I will attempt to batch this MR (!13460 (closed))...

  • closed

  • mentioned in issue #25404 (closed)

  • Ben Gamari mentioned in commit b027f978

    mentioned in commit b027f978

  • Please register or sign in to reply
    Loading