Skip to content

Respect `when` and `allow_failure` in steps coming from Rails

Description

Rails returns steps as part of its requestJob endpoint. They contain a when field which is one of {"on_failure" "on_success" "always"} and a boolean allow_failure field. Right now the runner doesn't use them and runs all steps with as if they have "when": "on_success" and allow_failure: false and has hardcoded that after_script runs always.

Proposal

When executing steps the runner should determine whether to mark the build as failed based on allow_failure:

  • true: the build should fail if the step execution fails
  • false: the build should not be marked as failed based on the step execution

When executing steps the runner should determine whether to execute the following steps based on what's in the when field:

  • on_success: run step only if if the build isn't marked as failed.
  • on_failure: run step only if the build is marked as failed
  • always: run step regardless of whether the build is marked as failure

Links to related issues and merge requests / references

Followup of: #6409 (closed)