Inform jobs about the "composer" job exit status and bail out early
Problem/Motivation
The phpstan (next major) job is failing due to a curl error: curl: (23) Failure writing output to destination when trying to obtain the phpstan.neon of the sobki_profile_bootstrap repository.
Examples of failure:
https://git.drupalcode.org/project/sobki_profile_bootstrap/-/jobs/2601438
https://git.drupalcode.org/project/sobki_profile_bootstrap/-/jobs/2602278
The "next major" variant has "allow_failure" even in the "composer" job. Note that if this fails, but we allow failure, the other jobs will try to run and might report some errors which are hard to debug, but due to the previous fail.
Proposed resolution
Write a variable at the end of the composer job to the env file and check that variable and its value before running any logic for dependant jobs, and if there was an error, then bail out early and inform the users accordingly.
Testing
To test this MR in your .gitlab-ci.yml file use the following values:
include:
# MR 254 Detect composer failures and halt other jobs.
- project: issue/gitlab_templates-3471235
ref: 3471235-dependencies
and also
variables:
_CURL_TEMPLATES_REPO: issue/gitlab_templates-3471235
_CURL_TEMPLATES_REF: 3471235-dependencies
See the documentation page for a full explanation
Remaining tasks
Related issue: Issue #3475697