cloudflare / workers-sdk

⛅️ Home to Wrangler, the CLI for Cloudflare Workers®
https://developers.cloudflare.com/workers/
Apache License 2.0
2.75k stars 736 forks source link

🚀 Feature Request: Deployment Rollback #1394

Open awthwathje opened 2 years ago

awthwathje commented 2 years ago

Describe the solution

Hello and first of all a huge thank you for building this groundbreaking platform!

I want to file a quick suggestion to enhance Wrangler CLI. So more stuff could be done without the need to access the Dashboard (especially given the fact that not everyone in the company has an access to the Dashboard, which is increasingly the case in bigger companies).

Deployment Rollback

This feature is already available in the Dashboard, so porting it to Wrangler shouldn't be a big effort, but it can make a big impact to help teams with organizing their workflows to easily recover from some unwanted deployment regressions.

The API could be as simple as:

wrangler pages deployment rollback --project-name myproject --to-id 1xx11xx1x1xx1x1xx1x1

where --to-id flag specifies the id of the deployment to roll back to.

Thanks!

sidharthachatterjee commented 2 years ago

Thanks for the feature request! I'll keep this open for now to track this. Cheers!

@nevikashah

awthwathje commented 1 year ago

We now have this https://developers.cloudflare.com/workers/wrangler/commands/#rollback

Will that work for a Pages project?

vorant94 commented 1 month ago

@awthwathje from my experience it doesn't. i'm getting the following error when I run wrangler rollback in the root of my pages project and pass it correct deployment id (took it from cf dashboard)

  This Worker does not exist on your account. [code: 10007]
irvinebroque commented 1 month ago

@vorant94 — for Pages, you need to rollback using the Cloudflare dashboard: https://developers.cloudflare.com/pages/configuration/rollbacks/

The wrangler rollback works with Workers.

Workers now support static assets, so you may be able to use Workers for your project, if you need to use this: https://developers.cloudflare.com/workers/static-assets/compatibility-matrix/

More generally, working towards bringing Workers and Pages closer together in functionality, know that it is confusing to have both and to get this error.

Seems like when you run wrangler rollback in the directory of a Pages project, we could throw a more helpful error here.

vorant94 commented 1 month ago

@irvinebroque yeah, after I got the error from above I realized that dashboard is the only option for now

It's not fitting my case unfortunately, because my initial case was to build a GH workflow that goes something like this "build->publish->e2e test->rollback if published, but e2e failed". And it is possible only with rollbacks via cli (telling all of this just for the sake of sharing the case, where this feature might be needed)

Currently I'm thinking about alternatives

irvinebroque commented 1 month ago

@vorant94 try deploying your project to Workers, curious what you run into.

And talk to @aninibread about that workflow — would love to be able to handle more of that ourselves for you as part of builds.