Skip to content

Add Ci::CallbackJob model

Tiger Watson requested to merge 415736-add-external-job-model into master

What does this MR do and why?

Adds a new Ci::Processable model, Ci::CallbackJob. Callback jobs will use the :waiting_for_callback state added in !134605 (merged) to wait for external input before proceeding instead of being picked by a runner.

Note that there is currently no way for instances of these models to be created, as they will be configured using a new CI keyword that is to be added in a subsequent issue (#415737). There should therefore be no impact to CI job processing.

For more information, see the epic.

Screenshots or screen recordings

Pipeline view Jobs list
Screenshot_2023-10-20_at_1.14.05_pm Screenshot_2023-10-20_at_1.16.16_pm

How to set up and validate locally

Much the same as !134605 (merged), except the data comes from the new model:

  1. Create a project, ticking "create readme" in the creation form.
  2. In a Rails console, create a dummy pipeline and callback job:
    project = Project.find <project-id>
    pipeline = project.ci_pipelines.create! status: :waiting_for_callback, sha: <sha-of-initial-commit>, ref: 'main', source: :push
    pipeline.callback_jobs.create! status: :waiting_for_callback, name: 'test', ref: 'main', scheduling_type: :stage, project: project, stage: 'test', stage_idx: 0
  3. View the pipeline and job pages to see the state text and icons.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #415736

Edited by Tiger Watson

Merge request reports