Gate web deploy behind infra in one ordered workflow#8
Merged
Conversation
deploy-web and deploy-infra were separate push-triggered workflows with separate concurrency groups, so a merge touching both ran them in parallel. deploy-web (50s) finished before deploy-infra (1m16s), briefly publishing a web that requested lattice.json ~26s before the lambda that writes it had deployed. Fold both into one ordered `deploy` workflow: a path-filter job gates the work, the infra job deploys the stack and then primes the weather feeds, and the web job `needs` infra — publishing only after infra succeeds, or directly on a web-only merge (and never if infra failed). Web-only and infra-only merges keep their fast single-sided paths via the path filter. - deploy.yml: changes (paths-filter) -> infra (cdk deploy + parallel prime of alerts/temp/windtex) -> web (needs infra) - github-oidc-stack.ts: grant the deploy role lambda:InvokeFunction on the ingest so the prime step can run - delete deploy-web.yml + deploy-infra.yml; update README + comment references
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the deploy-ordering race that surfaced when the temperature-unification PR merged:
deploy-webanddeploy-infrawere separate push-triggered workflows with separateconcurrencygroups, so a merge touching both ran them in parallel.deploy-web(50s) finished beforedeploy-infra(1m16s), so the new app went live requestinglattice.json~26s before the lambda that writes it had deployed — and a brand-new feed stays 404 until its schedule first fires anyway.This folds both into one ordered
deployworkflow:changes—dorny/paths-filtersetsweb/infraflags.infra(if infra changed) —cdk deploy, then primesalerts/temp/windtex(parallel, synchronous invokes) so the data the web reads exists before publish. AFunctionErrorfails the job.web(needs: infra) — publishes only after infra succeeds, or directly when onlyweb/changed (always()+ a result guard, so a failed infra never ships a web that depends on it).Web-only and infra-only merges keep their fast single-sided paths via the path filter. A single
concurrency: deploygroup serializes deploys.The
infrajob's prime step needslambda:InvokeFunction, which this PR adds to the deploy role ingithub-oidc-stack.ts. That stack is deployed locally, not by CI, so before (or right after) merging, run:If you skip it, the first
deployrun's prime step fails with AccessDenied — which the gate turns into a safe failure (thewebjob is held back, so nothing half-broken publishes); deploy the OIDC stack and re-run. (A fresh bootstrap viajust cdk deploy oidcalready includes the grant.)Notes
lattice.jsonwas primed into prod at 15:37 UTC and the site's grid works. This PR is the systemic fix so it can't recur.localprime tooling note: myjust weather primecan't reach the stormdeck account from this machine (ambient creds arenewearth-adminin a different account), which is why the CI prime — running in-account via OIDC — is the right home for it.Verification
actionlintclean on all changed workflows (validated jobs/needs/ifexpressions + shellcheck on the prime script).cdktypecheck passes;ciwillcdk synththe new IAM policy on this PR.Docs & attribution