screwdriver
screwdriver copied to clipboard
Trigger job on a failed build
What happened: I want to run a job if by current job's build fails, however there is no existing feature. This is so that I can do actions rollback or cleanup after a deployment job.
What you expected to happen:
Some way for job B to run if job A fails. This would be especially useful for template pipelines, where I (as template author) would want to setup some negative tests (make sure template fails build correctly) for the newly-created template version.
As a random idea, perhaps specify this in requires
somewhere, e.g. requires: [ validate-pass, !validate-fail ]
.
How to reproduce it:
I want to rollback automatically when a deploy job or some functional test is failed.
an example sd.yaml is like below:
shared:
image: kubectl-available-image
jobs:
deploy:
requires: [~commit]
steps:
- deploy: kubectl apply -f foo-deployment.yaml
functional-test:
requires: [deploy]
steps:
- test: some test
rollback:
requires: [failed@functional-test]
steps:
- rollback: kubectl rollout undo deploy/foo-deployment
Related:
-
on_failure
step hook is available in Concourse on_failure step hook - Concourse CI
We still receive requests for this feature every now and then. I feel that we are approaching the stage where we can seriously consider implementation.
For reference, CircleCI seems to provide a similar functionality with when: on_fail
.
https://circleci.com/docs/2.0/configuration-reference/#the-when-attribute