CI/CD Deployment Pipeline
CI/CD Deployment Pipeline
Section titled “CI/CD Deployment Pipeline”Overview
Section titled “Overview”gondolier deploys two artifacts via separate pipelines:
- Workers: Go WASM binary via
wrangler deploy - Pages: Static site via
wrangler pages deploy
Workers Deployment
Section titled “Workers Deployment”Pipeline steps
Section titled “Pipeline steps”- Validate —
go vet ./... && go test ./... && go build ./cmd/gondolier - Push secrets —
wrangler secret put <NAME>for each required secret - Deploy —
wrangler deploy
Secrets management
Section titled “Secrets management”Worker secrets (tokens, keys, environment variables that are not plain env vars) must be set via wrangler secret put, not as environment variables in wrangler.toml. Plain env vars go in wrangler.toml under [vars] or as [env.<name>.vars]. Secrets go via CLI:
wrangler secret put TENANT_FORGE_TOKENAuthentication requirements
Section titled “Authentication requirements”The Wrangler CLI must be authenticated to the Cloudflare account with Workers access.
Pages Deployment
Section titled “Pages Deployment”Pipeline steps
Section titled “Pipeline steps”- Build the site (if applicable)
- Deploy —
wrangler pages deploy ./site --project-name gondolier-site --branch production
Pitfalls
Section titled “Pitfalls”- Pages is upload-based, not branch-based. You must pass
--branch productionto deploy to the production site. There is no auto-deploy from a git push. - Always deploy from a worktree checked out at
origin/mainto avoid deploying stale local changes.
Known Pitfalls (Production Debugging)
Section titled “Known Pitfalls (Production Debugging)”Workers
Section titled “Workers”- Workers Paid plan required for Containers / CloudChamber features. Free plans do not include these capabilities.
- Token permissions: The Cloudflare API token used for Workers deployment must have:
- Workers Scripts (Edit)
- KV (Edit)
- Containers / CloudChamber (Edit)
- Account Settings (Read)
- Workers Routes (Edit)
- Binding-name shadowing: Never set environment variable names that match DO or KV binding names in
wrangler.toml. When a binding exists (e.g.,SESSION_STOREas a KV namespace), setting an env var with the same name causes the Worker to crash with error 1101 (binding resolution failure). Use distinct names. - Worker secrets vs env vars: Secrets that must be encrypted at rest in Cloudflare must be set via
wrangler secret put, not as[vars]entries. - json() response helper CORS: The
json()response helper must include CORS headers (Access-Control-Allow-Origin, etc.) in the actual response body, not just in preflightOPTIONSresponses. Browsers block the response on non-preflight requests if CORS headers are missing from the actual response.
Go / Compile-time
Section titled “Go / Compile-time”- Module-scope functions must not reference
requestparams without defining them locally. Module-level closures that capturerequestwill not compile or will reference the wrong scope at runtime.
Forgejo Actions / OIDC
Section titled “Forgejo Actions / OIDC”- OIDC tokens require
enable-openid-connect: trueat the workflow level (not just repo-level setting). - The audience claim must be
audience: openbao(no template braces). - OpenBao
forgejo-actionsrole configuration:- Must include
user_claim bound_audiencesis requiredbound_claimsmust be valid JSON (not a string representation)- No
bound_subject— omit it entirely or the role will not match
- Must include
Supabase / Database
Section titled “Supabase / Database”- REST filters must be query params, not request bodies. Supabase PostgREST does not accept filter bodies on GET requests. Use
?column=eq.valuesyntax.
General
Section titled “General”- Actions env vars: In GitHub/Forgejo Actions, environment variable references must use
${{ env.X }}syntax, not$VAR. The shell-style$VARis not interpolated in Actions YAML expressions.
Session Expiry Redirect Loop
Section titled “Session Expiry Redirect Loop”The session-expiry redirect loop was caused by a redirect that fired before the session store had been initialized. The fix was to gate the redirect on store readiness and ensure the session validation middleware did not redirect during the auth flow’s own redirect.