The when parameter can be one four values, and controls under which conditions a job is run. The possible values are as follows:
- on_success: The default behavior; a job will only be executed if the preceeding jobs/stages have passed
- on_failure: The job will only run if at least one job earlier in the pipeline has failed
- always: The task will always be executed, on both success and failures
- manual: A task that requires manual intervention to be started, such as from the GitLab web UI
One example use case of when is as follows:
stages: - build - cleanup_buildbuild_job: stage: build script: - webpackcleanup_build_job: stage: cleanup_build script: - rm /dist/* when: on_failure
In the preceding case, the build job is always ...