Skip to content

Add job_variables_attributes to play build API

Avielle Wolfe requested to merge aw-rest-api-manual-job-variables into master

What does this MR do and why?

This MR adds an optional job_variables_attributes param to the REST API endpoint for playing manual jobs. Users can pass custom variables to the param in order to have those variables set on the job.

Implements: #37267 (closed)

Screenshots or screen recordings

N/A

How to set up and validate locally

  1. Set up a pipeline with a manual job that includes script: echo "$TEST_VAR"
  2. Run a pipeline
  3. Navigate to the manual job's show page and get the job ID
  4. Run curl --request POST --header "PRIVATE-TOKEN: <private_access_token>" "<gdk.test>/api/v4/projects/<project_id>/jobs/<job_id>/play" -d "job_variables_attributes%5B%5D%5Bkey%5D=TEST_VAR&job_variables_ attributes%5B%5D%5Bvalue%5D=it+works%21"
  5. See that your manual job has run and printed it works!

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 Avielle Wolfe

Merge request reports