Skip to content

Extract Ci::EnqueueJobService to standardize way to enqueue jobs

Leaminn Ma requested to merge 326490-extract-ci-enqueuejobservice into master

What does this MR do and why?

Describe in detail what your merge request does and why.

In !56492 (comment 529230865) we highlighted the need to add a generalized way to enqueue jobs. We seem to do it slightly differently in different places and this could cause problems if the logic differs.

When a job is enqueued we always need to:

  • assign the current user to it
  • pass in any variables
  • enqueue the job consistently
  • call Ci::AfterRequeueJobService to run the side-effects if enqueue is successful

This MR extracts a Ci::EnqueueJobService that does the above and is reused in:

  • Ci::PlayBuildService
  • Ci::PlayBridgeService
  • Ci::Pipeline#reset_source_bridge!
  • Ci::RetryJobService --> Does not need refactoring at this time. See follow-up

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 #326490 (closed)

Edited by Leaminn Ma

Merge request reports