Add custom CI job exit code functions into scripts/utils.sh
What does this MR do and why?
Part 1 of !177976 (closed)
I decided to submit multiple MRs for the custom exit code change, starting with just the script itself and docs. I will not be using this script in any job yet, instead will make separate CI MRs to switch jobs to use the script individually. This way we can also easily revert only the CI changes if anything goes wrong.
re: Map CI/CD failures to failure categories (#512594 - closed)
References
Please include cross links to any resources that are relevant to this MR. This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.
- first draft: Draft: Add a script file for custom exit code (!177976 - closed)
- issue: Map CI/CD failures to failure categories (#512594 - closed)
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
| Before | After |
|---|---|
How to set up and validate locally
I ran 2 tests for the script in CI jobs:
Scenario 1: when job exits with 0
Job: https://gitlab.com/gitlab-org/gitlab/-/jobs/9020970173
This job runs with custom exit code, and the script passes. We confirm that the exit code 0 is correctly returned
Scenario 2: when job exits with 1, while logging indicates gitaly spawn failure
Job: https://gitlab.com/gitlab-org/gitlab/-/jobs/9021120615
This job runs with custom exit code, and the job's command was modified to print "gitaly spawn failed" and exit with error. We confirm that the exit code 162 is correctly returned at the end of the job

