Skip to content

Run after_script for cancelled jobs

Arran Walker requested to merge ajwalker/after_script into master

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)

MR Status [2020-09-06]

  • This merge request will not be merged into the Runner code base. We have instead used the implementation provided in !2443 (merged)
Edited by Darren Eastman

Merge request reports