Exit `wait_for_job_to_be_done` as error if the job fails
What does this MR do?
If a script is waiting for a job to be done and that job fails, exit with an error status so that the script doesn't continue with a prerequisite in an invalid state.
More info
For example this package-and-qa
job was waiting for gitlab:assets:compile
to complete, but it failed and package-and-qa
continued: https://gitlab.com/gitlab-org/gitlab-ce/-/jobs/137873724
$ wait_for_job_to_be_done "gitlab:assets:compile"
GET https://gitlab.com/api/v4/projects/13083/pipelines/41025847/jobs?per_page=100&page=1
GET https://gitlab.com/api/v4/projects/13083/pipelines/41025847/jobs?per_page=100&page=2
The 'gitlab:assets:compile' job ID is 137873857
Waiting for the 'gitlab:assets:compile' job to finish...
GET https://gitlab.com/api/v4/projects/13083/jobs/137873857
............................Waited 'gitlab:assets:compile' for 14 minutes.
The 'gitlab:assets:compile' failed.
$ ./$SCRIPT_NAME omnibus
Triggered downstream pipeline: https://gitlab.com/gitlab-org/omnibus-gitlab/pipelines/41028166
And then all the qa jobs failed: https://gitlab.com/gitlab-org/gitlab-qa/pipelines/41034645
What are the relevant issue numbers?
Does this MR meet the acceptance criteria?
- [-] Changelog entry added, if necessary
- [-] Documentation created/updated
- [-] Tests added for this feature/bug
- [-] Tested in all supported browsers
-
Conforms to the code review guidelines -
Conforms to the merge request performance guidelines -
Conforms to the style guides -
Conforms to the database guides - [-] Link to e2e tests MR added if this MR has Requires e2e tests label. See the Test Planning Process.
- [-] Security reports checked/validated by reviewer
/cc @rymai just FYI