I am implementing my own gitlab-runner custom executor with Nomad as a backend. Consider the following .gitlab-ci.yml
test:
script:
- exit 105
allow_failure:
exit_codes:
- 105
The documentation states that in The Custom executor | GitLab
GitLab Runner provides
BUILD_FAILURE_EXIT_CODE
environment variable which should be used by the executable as an exit code to inform GitLab Runner that there is a failure on the users job. If the executable exits with the code fromBUILD_FAILURE_EXIT_CODE
, the build is marked as a failure appropriately in GitLab CI.
This is confusing. How should the detection of “105” go?
Should the execution of the stage return BUILD_FAILURE_EXIT_CODE? Or should the execution of the build_stage ignore documentation and return 105 exit code? Both cases do not work (BUILD_FAILURE_EXIT_CODE is set by gitlab to 1):
$ exit 105
Cleaning up project directory and file based variables 00:00
ERROR: Job failed: exit status 1
$ exit 105
Cleaning up project directory and file based variables 00:00
ERROR: Job failed (system failure): unknown Custom executor executable exit code 105; executable execution terminated with: exit status 105
The comparison of the actual exit code against the list of exit_codes could be done inside the executor. However, the exit_codes are not passed - I do not see any CUSTOM_ENV_ or other environment variable with it. Where is it stored? Is there a way to extract it? Is this a missing feature and I should make an issue upstream?