Backend: Gitlab ignores new manual job variable values when you run a job the second time
Current Status
When Frontend: Surface the used custom variables for... (#361237 - closed) is fixed we will re-test this to see if it is resolved OR edit to call out new use cases that need support.
Summary
After the first launch of a manual job with the input of variables - they are read. But if you abort the job and enter the variables again - they are ignored. Gitlab 12.2
Steps to reproduce
- Create MR and start new pipeline.
- Start new job with manual variables(see https://gitlab.com/gitlab-org/gitlab-ce/issues/24935)
- See\read this environments.
- Cancel job OR Wait until it finished and Erase job log
- Enter the variables, press start, wait and make sure that they will not be in the environment variables
What is the current bug behavior?
I can't read entered variables after retry job(see (4) above).
What is the expected behavior?
I can see the entered variables after retry jobs.
Proposed Changes
TBD
Technical notes
The steps I followed:
- Update the .gitlab-ci.yml file to include a manual job
- Create MR
- Once the pipeline finished running, I go to view the jobs and I see that one is manual and didn't run. One that was not manual did run.
- By clicking the "manual" status label, I am able to set manual job variables that I already set in the .gitlab-ci.yml so I am basically overwriting the variable.
- When click play, it runs the job. I get an echo with my variable that I updated above.
- If I clear the job my pressing the bin icon, it shows me variable form again.
- When I set same variable with different value and run the pipeline, I see in the stack trace that my old value I set in point 4 is still there.
Bottom line: looks like the manual job variables unfortunately don't updated.
Looks like it might be this POST request that is not reassigning the variable correctly:
Request URL: http://127.0.0.1:3000/root/<project name>/-/jobs/<id>/play
Payload: {"job_variables_attributes":[{"key":"TEST_VAR_JOB","secret_value":"new"}]}
Additional note: Seems like I need to bin the previous job to be able to set new variables again on the job, not sure if that is intentional.