I’m looking for feedback/brainstorming on how to solve the following with a drone pipeline.
- deploy an application to a test environment
- run a series of tests against the newly deployed version of the application
- if the above fails: rollback the deployment.
This works pretty easily with the
status: failure conditional, but it starts to get more complicated when we consider adding the same three steps for a production deployment. So if all three of the above succeed: do the same for prod. With all 6 steps, the
status: failure becomes a trap because a failure in the test environment would then result in a rollback of the production environment…
pipeline: deploy: image: alpine commands: - echo 'executing a deployment' test: image: alpine commands: - echo 'running some tests' - exit 1 rollback: image: alpine when: status: failure commands: - echo 'rolling back a deployment' promotion: image: alpine commands: - echo 'promoting a deployment' test-promotion: image: alpine commands: - echo 'running some tests' rollback-promotion: image: alpine when: status: failure commands: - echo 'rolling back a promotion'
I’ve come up with some incredibly ugly solutions to this… but wanted to know if anyone else has come up with something that feels a bit cleaner?