Use Case
If a Job fails a script needs to be run to send a specific message to Pagerduty.
In this script is some additional information to find the problem…
Example gitlab-ci.yml
stages:
- build
- deploy
- notify-deploy-failed
- undeploy
- notify-undeploy-failed
destroy:
stage: undeploy
dependencies:
- apply
only:
- master
when: manual
allow_failure: true
script:
- export TF_WARN_OUTPUT_ERRORS=1
- terraform destroy -force
notify_undeploy_failed:
stage: notify-undeploy-failed
when: on_failure
allow_failure: true
script:
- ./scripts/notify.sh
Problem
When the destroy fails the notify-undeploy-failed is not run.
From the pipeline the destroy is marked with a problem. But the notify-undeploy-failed is not triggerd.
Any suggestions or advice?