Skip to content

Ensure after_script is called for timed out pipelines

Status Update 2024-12-11

For cancelled pipelines: Available as default behavior (&10158 (closed))

For timed out pipelines (Opt-in behavior): users can set appropriate values for timeout and RUNNER_SCRIPT_TIMEOUT or RUNNER_AFTER_SCRIPT_TIMEOUT to get the desired behaviour. See https://docs.gitlab.com/ee/ci/runners/configure_runners.html#set-script-and-after_script-timeouts

Release notes

Problem to Solve

It's possible to want a after_script step for a gitlab-ci.yml, where it's important that it always run. However, the current behavior of after_script is that if a build times out the cleanup stage is skipped (even though this does not appear to be the original intent: https://gitlab.com/gitlab-org/gitlab-ci-multi-runner/issues/102#note_11619214).

Intended users

Proposal

Pending for this use case. The old proposal was moved to Ensure after_script is called for canceled jobs... (#387230 - closed) which will be scheduled first.

Possible Workaround

Users may be able to make use of the Job Event webhook to shut down or cleanup external environments. It should be assumed that no data outside the webhook payload will be available unless explicitly stored in global variables or some other method because the runner may have lost connectivity or otherwise may not be accessible to provide data required for the desired action to be taken.

Further details

Permissions and Security

Documentation

Availability & Testing

What does success look like, and how can we measure that?

What is the type of buyer?

Is this a cross-stage feature?

Links / references

This page may contain information related to upcoming products, features and functionality. It is important to note that the information presented is for informational purposes only, so please do not rely on the information for purchasing or planning purposes. Just like with all projects, the items mentioned on the page are subject to change or delay, and the development, release, and timing of any products, features, or functionality remain at the sole discretion of GitLab Inc.

This page may contain information related to upcoming products, features and functionality. It is important to note that the information presented is for informational purposes only, so please do not rely on the information for purchasing or planning purposes. Just like with all projects, the items mentioned on the page are subject to change or delay, and the development, release, and timing of any products, features, or functionality remain at the sole discretion of GitLab Inc.

Edited by 🤖 GitLab Bot 🤖