Skip to content

Run after_script for cancelled jobs

Kamil Trzciński requested to merge ajwalker/after_script-kamil into master

This is build on top of !2350 (closed)

What does this MR do?

Changes the behaviour of after_script to always be executed if the build was canceled with a remote job state of canceling.

Why was this MR needed?

Future versions of GitLab will cancel a build with the job state canceling, rather than canceled. canceling instructs Runner to cancel the build and always run after_script, rather than abort the build entirely.

gitlab#15603

What's the best way to test this MR?

Each executor has it's own Test*BuildCancel test. For example, the docker executor:

go test -v -run TestDockerCommandBuildCancel ./executors/docker

This test checks that we enter, or don't enter, the correct stages during a canceled execution.

What are the relevant issue numbers?

gitlab#15603

Closes #4843 (closed)

Edited by Steve Xuereb

Merge request reports