copilot-cli icon indicating copy to clipboard operation
copilot-cli copied to clipboard

Cancel deployment

Open nbarrera opened this issue 4 years ago • 4 comments

Hi guys,

I 've just experimented starting a deployment which introduced changes that made the container fail the health check.

So I just hit ctr+c and interrupted the copilot CLI, fixed the bug then tried to deploy again but the newly issued command fails prompty with:

✘ Proposing infrastructure changes for stack xxx-test-site 
✘ deploy service: stack xxx-test-site is currently being updated and cannot be deployed to

So when I show status

% copilot svc status
Found only one deployed service site in environment test
Task Summary

  Running      ██████████  1/1 desired tasks are running
  Deployments  ░░░░░░░░░░  0/1 running tasks for primary (rev 5)

This means that the deployment with the bug was still trying to be done.

I had to wait a long time until all resources were freed up and was able to make an svc deploy again.

Is there any way to cancel a deployment that's currently running?

This could be useful to avoid a wrong deployment from taking place, or to avoid this long retries of an impossible to succeed deployment.

nbarrera avatar Jun 30 '21 21:06 nbarrera

Hi @nbarrera !

Yon can cancel the stack update through CloudFormation console by clicking "Stack actions" and then "cancel stack updates" Screen Shot 2021-07-01 at 11 38 10 AM

After the rollback is completed, you can run svc deploy again.

Hope this helps!!

Lou1415926 avatar Jul 01 '21 16:07 Lou1415926

Sorry I didn't know about that thanks! 👍

nbarrera avatar Jul 01 '21 16:07 nbarrera

Thank you, took me WAY too long to find this. As a copilot beginner a single wrong setting costs about an hour of waiting time without it. A user friendly way that other apps use are something like this:

  1. After copilot deploy display: To rollback the current deploy press ctrl+c once.
  2. First ctrl+c: Show prompt: Do you want to rollback the current deploy? (y/n).
  3. Second ctrl+c: Show prompt: Are you sure you want to force quit the current deployment, bla bla? (y/n).
  4. Third ctrl+c: Kill everything

runekaagaard avatar May 06 '22 08:05 runekaagaard

Thanks @runekaagaard that UX looks great 🤩

efekarakus avatar May 06 '22 17:05 efekarakus

An aws command line approach to cancel a running stack update is:

$ aws cloudformation cancel-update-stack --stack-name $STACK_NAME

Where $STACK_NAME is what you see in the output after $ copilot svc deploy which typically looks like

$ copilot svc deploy
Updating the infrastructure for stack [STACK_NAME IS HERE]

sxalexander avatar Jul 14 '23 23:07 sxalexander

Hey @sxalexander !

Currently we are actively working on this feature. We will post here once this is released. stay tuned!

KollaAdithya avatar Jul 15 '23 00:07 KollaAdithya

Hello @nbarrera and @sxalexander !

Ctrl-C feature is released in v1.30 🎉 . You can now cancel your stack update to rollback to previous configuration.

KollaAdithya avatar Aug 31 '23 00:08 KollaAdithya