Rollback via rerun deploy job

I currently use CircleCI for building docker images, pushing to ECR and deploying to ECS.

I want to be able to manually rollback a deploy if any issues are detected on production.

The way I can think of is to rerun the previous deploy job so that we can redeploy previous ECR image. I currently find a button to “Rerun Job with SSH” which allows me to rerun a previous deploy job.

I want to make sure this is the right way to rollback. And I want to ask whether there is a way to rerun a job without SSH since I don’t need the SSH connection for this case.

Hi @wangxiaoyou1993 welcome to the CircleCI community! At this time there are two ways to manually re-run a previously run job.

The first being the Rerun Job with SSH feature you’ve identified, which works best for debugging purposes by accessing a spun up container and manually running commands. While there is an option to rerunning a workflow from failed / start, I don’t recommend this for a rollback unless your config.yml is set up with logic to handle this.

Another way is by adding an approval step to your workflow, where anyone with push access can manually approve a job to run. You can read more about approval jobs here:

As I mentioned earlier, you can also have your config.yml include logic to handle rollbacks. This could include having a build, test, deploy and rollback workflow, where the rollback job checks for any issues with the deployment and will rollback as needed. You can even utilize the when attribute and our v2 API to trigger a parametrized pipeline with the rollback job as a separate workflow.

Let us know how these options would work for you!