I would like to configure a deployment workflow that runs integration tests after a code deploy job. If the integration test job fails, then I want it to automatically run a code rollback job. I’m not asking here how to write the actual code deploy and rollback jobs, that’s a separate issue; what I’m asking is how I can configure a workflow to do that.
I searched and didn’t find a lot of posts about this. I did find this 2018 post from @krhubert :
They asked pretty much the same question I’m asking, but nobody really answered it. @ThiagoBarradas suggested a workflow that has an approval step after the integration test, and a rollback job that depends on the approval: Auto rollback with circleci 2.0 · GitHub
However, there are two issues with this suggestion:
- I think it allows you to run the rollback only if the integration test succeeds, not if it fails.
- It’s not automatic, it requires a person to notice the failure and click the approval. I want an automatic rollback to known good code.
Anyone have any solutions for either (or, ideally, both) of the problems above?