workers-sdk icon indicating copy to clipboard operation
workers-sdk copied to clipboard

`wrangler versions` commands are tricky to automate because of IDs

Open theoephraim opened this issue 1 month ago • 1 comments

Describe the solution

The current iterations of the wrangler versions commands seem really geared towards interactive usage only. If I want to do a new deployment with a secret, I must do the 3 step dance:

  1. wrangler versions upload
  2. wrangler versions secret put
  3. wrangler versions deploy

Step 2 allows passing no id, and it will use the latest version from step 1, so that's fine, although explicitly expressing "latest" might be nice.

Step 3 however requires I either select the version interactively or pass in an ID. Currently we must either extract the id from the output of step 2, or run wrangler versions list and extract the id, which is very awkward in bash. A few things could make this easier:

  • let me use latest as an alias for an id
  • allow using tags or an ID I generate to select a specific version instead of the CF generated id
  • if --yes option is used with no version id, assume the user means latest (similar to other commands)
  • add flags that make the output simpler, or even write to a file, so its easier to get ids without needing sed/awk or involving JS

Sidenote - allowing me to deploy with secrets attached in one step would let me avoid this altogether.

theoephraim avatar Dec 04 '25 23:12 theoephraim

Thanks for the issue @theoephraim. These are good points and we will investigate the best solution here.

jamesopstad avatar Dec 08 '25 11:12 jamesopstad

+1 just started implementing a bunch of monkey business around wrangler versions upload | tee deploy.txt ... making this easier would be great. I personally can't use latest because we have a high volume of preview deploys running through CI/CD all day, but agree that would be nice-to-have.

The suggestion from #10933 would solve my use case even better so I can reuse a build version as my tag and refer to the the active deployment that way!

sodabrew avatar Dec 16 '25 00:12 sodabrew

One more papercut - if you provide --version-id 12345 without --yes, even in a script, wrangler puts up an interactive selection of versions to choose from

sodabrew avatar Dec 17 '25 17:12 sodabrew

@sodabrew - https://github.com/cloudflare/workers-sdk/issues/5709

theoephraim avatar Dec 17 '25 17:12 theoephraim

I personally can't use latest because we have a high volume of preview deploys running through CI/CD all day

Great point - allowing end users to pass in an ID/tag would be much better.

theoephraim avatar Dec 17 '25 18:12 theoephraim