GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(deploy): run Cloudflare deploys from verified artifacts behind pi… · jerrylee/opencode@7bac5ba

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • .github
    • release
      • README.md
      • cf
        • package-lock.json
        • package.json
      • deploy-data.sh
      • deploy-files.sh
      • deploy-legacy.sh
      • deploy-site.sh
      • deploy-update.sh
      • download
        • action.yml
      • lib.sh
      • targets
        • README.md
        • data
          • dev
            • default.json
            • og.json
            • root.json
            • sync.json
          • production
            • default.json
            • og.json
            • root.json
            • sync.json
        • files
          • dev
            • wrangler.json
          • production
            • wrangler.json
        • legacy
          • dev
            • root.json
            • worker.json
          • production
            • root.json
            • worker.json
        • site
          • dev
            • root.json
            • worker.json
          • production
            • root.json
            • worker.json
        • update/production
          • wrangler.json
      • upload
        • action.yml
      • verify-artifacts.sh
      • wrangler
        • package-lock.json
        • package.json
    • workflows
      • deploy-files.yml
      • deploy-site.yml
      • deploy-update.yml
      • deploy.yml
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎.github/release/README.md‎

Copy file name to clipboard
+61Lines changed: 61 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Deploy boundary
2+
3+
The deploy workflows (`deploy.yml`, `deploy-site.yml`, `deploy-files.yml`,
4+
`deploy-update.yml`) split every service in two:
5+
6+
- **build** runs repository code (`bun install`, `cf build`, `bun script/build.ts`,
7+
`wrangler deploy --dry-run`) with no environment, no secrets, and no OIDC
8+
token. It uploads the deploy-ready output with a `SHA256SUMS` and reports that
9+
manifest's digest as a job output.
10+
- **deploy** runs in the `dev` or `production` environment, assumes the stage's
11+
AWS role, mints a short-lived Cloudflare token from the token issuer
12+
(`cloudflare-token.sh`), and checks out only `.github/release/`. It verifies
13+
the artifact against the digest the build job reported, installs the pinned
14+
`cf`/`wrangler` CLI (`npm ci --ignore-scripts`), and runs only a
15+
`deploy-*.sh` script here.
16+
17+
Repository code outside `.github/` does not need Dax's review, so the deploy job
18+
must never execute it. The scripts treat the artifact as data: Worker code and
19+
assets may change freely, but names, routes, custom domains, crons, Workflow and
20+
export names, and every binding (including service bindings to other Workers)
21+
come from `targets/`. An artifact whose resolved config is not byte-for-byte one
22+
of those pinned targets is refused before the token is used.
23+
24+
For `cf` services the pinned target is also what `cf` reads: the script copies
25+
the target over the artifact's config after validating it. For `wrangler`
26+
services the artifact is only `index.js`; the complete `wrangler.json` is the
27+
pinned target.
28+
29+
## Why the token can be account-wide
30+
31+
Cloudflare has no per-Worker permission for Workflows. The data sync Worker owns
32+
a Workflow, and `PUT /accounts/<id>/workflows/<name>` needs account-wide
33+
`Workers Scripts Write`, so `Individual Workers Editor` fails that deploy.
34+
35+
Dev and production therefore mint a token that can write any Worker on the
36+
account. That is only safe because the code holding it is this directory: one
37+
reviewed script per service, on a verified artifact, with every destination
38+
pinned in `targets/`. Do not move a deploy back into a job that runs repository
39+
code, and do not widen a script's accepted targets without review.
40+
41+
Production keeps this token only for a Dax-approved fast-forward of `dev`; a
42+
`dev` merge cannot reach the production environment.
43+
44+
## Production promotion notes
45+
46+
Moving `dev` to `production` deploys the same pinned targets with the same
47+
scripts, but production holds an account-wide token and a bad deploy is live.
48+
49+
Before promoting:
50+
51+
1. Confirm every dev deploy job is green on the commit being promoted
52+
(`deploy`, `deploy-site`, `deploy-files`; `deploy-update` runs on production
53+
only).
54+
2. Diff `.github/release/targets/` against `origin/production`. Any change here
55+
is a change to what production may deploy.
56+
3. Rollback is a fast-forward back to the previous `production` commit, which
57+
redeploys the previous Worker code from the same pinned targets. If a target
58+
itself changed and must be reverted, revert it with the deploy commit.
59+
4. The production deploy job runs only `.github/release/` at `github.sha`; it
60+
does not run repo code. The build job still runs repo code, but with no
61+
secrets and no OIDC token.

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.