Skip to content

Support when:graceful for after_script

Lyubomir Raykov requested to merge run-on-cancel-after-script into master

This allows Gitlab to tell the runner whether after_script and any following stages should run when the job is canceled.

The long term goal is to allow Gitlab to specify which steps should run when the job is canceled and which - not. This is adding the support just for after_script. The generic case can be implemented as part of #25439 when !1963 (merged) is merged.

What does this MR do?

It creates a new context for after_script and subsequent jobs if when: graceful is set on the after_script step.

Why was this MR needed?

Context in the issue attached.

Are there points in the code the reviewer needs to double check?

  • with this implementation after_script will run on system interrupt as well. I think this is the consistent behaviour, but I'm not confident about that statement.
  • if canceled userScript will return an error that the context is canceled. This essentially means that from the two artifact upload stages only uploadArtifactsOnFailure will be executed.

Does this MR meet the acceptance criteria?

  • Documentation created/updated
  • Added tests for this feature/bug
  • In case of conflicts with master - branch was rebased

What are the relevant issue numbers?

#4843 (closed)

Edited by Steve Xuereb

Merge request reports

Loading