Support 17.0 Readiness - Breaking Change - after_script keyword will run for cancelled jobs
Summary
The after_script keyword portion of a CI job config used to not be executed when a job is cancelled. While the original intent always was to have after_script running after a timeout or cancellation during before_script and script, that behavior has not been actually in place for more than half a decade, so users will be very used to the "bug" behavior by now.
Links to Change:
- https://docs.gitlab.com/ee/update/deprecations.html#after_script-keyword-will-run-for-cancelled-jobs
- gitlab-org/gitlab#437789 (closed)
Assignee: @manuelgrabowski
Impact Assessment
Impacts anyone with after_script in their CI config (only when a job is cancelled).
Mitigations/Workarounds
- Refactor CI, move parts that shouldn't be run upon cancellation into
scriptsection. - Self-managed should be able to disable the
ci_canceling_statusFF (see comment) - Due to a bug,
$CI_JOB_STATUSis currently not set correctly. Once that has been fixed via gitlab-org/gitlab-runner!4717 (merged) (hopefully in 17.1), it could be used to adapt scripts with conditional execution