Skip to content

Updates the PlayBuildService to use can_enqueue

What does this MR do and why?

In Ci::PlayBuildService#play, we run two commands: build.enqueue, followed by build.update(current_user: ..., job_variables_attributes: ...)

It's theoretically possible for us to enqueue a build, which is then picked up and run without the correct user or job variables set.

Fixes: #30360 (closed)

How to set up and validate locally

Steps to reproduce

This has to be done on main/master:

  1. In order to reproduce this, place a sleep(500) between build.enqueue and build.update in the PlayBuildService
  2. Create a config with a manual job with variables:
variables:
   DEPLOY_TO_STAGE:
   value: "this is variable deploy to test"

deploy_job:
   when: manual
   script: echo "$DEPLOY_TO_STAGE" # for ease of testing
  1. Run a pipeline
  2. Click on the manual job deploy_job:
    Screenshot_2022-09-16_at_13.45.55
  3. Change the value of DEPLOY_TO_STAGE and click on Trigger this manual action:
    Screenshot_2022-09-16_at_13.46.32

You will see the variable has NOT changes to the new value.

MR acceptance checklist

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

Edited by Laura Montemayor

Merge request reports

Loading