Repository navigation
feat(worker-turbo): deployTokenEnv gives one component its own Cloudflare token (0.24.0) - #27
Conversation
…lare token (0.24.0) The deploy profile binds one CLOUDFLARE_API_TOKEN per lane, so a component that needs a wider token (a Worker with a Container needs Containers Edit) forced every component in the project onto it. deployTokenEnv names an env var from the component's own secretEnv; its pre-deploy, migrate, deploy and secrets-live steps then export CLOUDFLARE_API_TOKEN from it, failing loudly when it is empty. Left empty, every step keeps the profile's token, so no consumer changes behaviour until it opts in. verify.sh renders both. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 140597db8e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| `us-east-1`), `orgName`, `owner`, `repo` | ||
| - **Optional deploy parameter:** `deployTokenEnv` (default empty). The name | ||
| of an env var from the component's own `secretEnv` (for example | ||
| `CLOUDFLARE_DEPLOY_TOKEN: "secret://<ws>/<project>/CLOUDFLARE_CONTAINERS_TOKEN"`). |
There was a problem hiding this comment.
Include the environment in the token secret URI
When a consumer copies this secretEnv example, the URI omits the environment segment used by the deploy profile and existing component references (secret://<workspace>/<project>/<env>/...). The token lookup will therefore point to the wrong secret path, so the opted-in steps may fail to resolve CLOUDFLARE_DEPLOY_TOKEN; include the environment in the example URI.
Useful? React with 👍 / 👎.
Why. The
cloudflare-worker-turbodeploy profile binds oneCLOUDFLARE_API_TOKENper lane, and a component'ssecretEnvcan't rebind it (the planner rejects two references for one key). So when one component needs a wider token, every component in the project ends up holding it. The case here: a Worker with a Cloudflare Container needs Containers Edit (templateworkers-containers-deploy).What. A new optional parameter,
deployTokenEnv(default empty, pattern^([A-Z_][A-Z0-9_]*)?$), naming an env var from the component's ownsecretEnv.CLOUDFLARE_API_TOKENfrom that variable, and fail with a clear message when it's empty.Checked:
scripts/verify.shpasses. Its new stage renders the two fixture workers: the opted-in one switches tokens in all four steps, and the default one mentions no switch in any of them. The rendered bash was also exercised: it fails loudly when the variable is unset and exports it when set.Includes the README parameter note,
docs/verification.md§8 (the later sections renumbered), andstack.yamlbumped to 0.24.0.🤖 Generated with Claude Code