ci(deploy): provision Cloudflare infra via pulumi up before deploy - #4
Conversation
The Deploy workflow only ran 'vite build && wrangler deploy', so Pulumi-managed infra (Zero Trust Access policy/app, R2, KV, R2 API token) was never applied on merge — it relied on a manual 't-stack provision'. Access-policy changes (e.g. allowlisting a guest email) silently never reached production. Add a 'pulumi up' step against gaff-cloudflare/production before the Worker deploy, with its own dependency install (infra/cloudflare isn't in the root Bun workspace). Reuses the existing full-scope CLOUDFLARE_* secrets; needs a new PULUMI_ACCESS_TOKEN repo secret.
ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Free Run ID: 📒 Files selected for processing (1)
WalkthroughThe deploy workflow now installs infra dependencies and runs Pulumi ChangesDeploy workflow infrastructure provisioning
Sequence Diagram(s)sequenceDiagram
participant GitHubActions
participant Doppler
participant PulumiAction
participant CloudflareAPI
participant Wrangler
GitHubActions->>Doppler: fetch secrets (exports PULUMI_ACCESS_TOKEN)
GitHubActions->>PulumiAction: install infra deps + run pulumi up (env includes PULUMI_ACCESS_TOKEN, DOPPLER_TOKEN, CF tokens)
PulumiAction->>CloudflareAPI: provision Cloudflare resources/bindings
GitHubActions->>Doppler: read secrets JSON
GitHubActions->>GitHubActions: remove .PULUMI_ACCESS_TOKEN from JSON
GitHubActions->>Wrangler: wrangler secret bulk (upload remaining secrets)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Note 🎁 Summarized by CodeRabbit FreeYour organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login. Comment |
…Worker PULUMI_ACCESS_TOKEN now lives in Doppler (gaff/prd) rather than a GitHub secret. Reorder so Provision runs after Fetch-secrets (which exports it into $GITHUB_ENV for pulumi/actions to read), and strip it from the Worker secret sync with jq del so the account-provisioning token never gets bulk-pushed onto the edge runtime.
Why
The Deploy workflow ran only
vite build && wrangler deploy(+ Worker secret sync). Pulumi-managed infra — the Zero Trust Access policy/app, R2, KV, and the R2 API token — was never applied on merge; it depended on a manualt-stack provision. So the partner-email Access allowlist (#3) merged but never reached production — she still can't get past Cloudflare Access.What
Adds a
pulumi upstep againstgaff-cloudflare/production, before the Worker deploy:main; no-op when nothing underinfra/cloudflarechanged.infra/cloudflareisn't in the root Bun workspace.CLOUDFLARE_API_TOKEN/CLOUDFLARE_ACCOUNT_IDrepo secrets.Credential wiring
PULUMI_ACCESS_TOKENlives in Doppler (gaff/prd), not a GitHub secret. So:$GITHUB_ENV;pulumi/actionsreads it from the environment.jq 'del(.PULUMI_ACCESS_TOKEN)'— a gaff/prd secret would otherwise be bulk-pushed onto the Worker, putting an account-provisioning token on the edge runtime.Test plan
deploy.ymlis valid YAMLjq deldrops only the Pulumi token (verified locally)PULUMI_ACCESS_TOKENpresent in Doppler gaff/prdSummary by CodeRabbit