From 33123b1c42722bc81bcbfc4e4396d035c34a6647 Mon Sep 17 00:00:00 2001 From: Dax Date: Wed, 11 Nov 2026 16:17:46 -0500 Subject: [PATCH] ci: deploy dev workers in anomaly-dev (#63379) --- .github/release/cloudflare-token.sh | 4 ++ .github/release/deploy-data.sh | 3 +- .github/release/deploy-files.sh | 3 +- .github/release/deploy-legacy.sh | 3 +- .github/release/deploy-site.sh | 3 +- .github/release/lib.sh | 8 ++++ .github/release/targets/data/dev/default.json | 38 +++++++++---------- .github/release/targets/data/dev/root.json | 2 +- .../release/targets/files/dev/wrangler.json | 3 +- .github/release/targets/legacy/dev/root.json | 2 +- .../release/targets/legacy/dev/worker.json | 2 +- .github/release/targets/site/dev/root.json | 2 +- .github/release/targets/site/dev/worker.json | 4 +- .github/workflows/deploy-files.yml | 2 +- .github/workflows/deploy-site.yml | 2 +- .github/workflows/deploy.yml | 4 +- services/data/cloudflare.config.ts | 6 +-- services/data/og.config.ts | 4 +- services/data/stage.ts | 4 ++ services/data/sync.config.ts | 4 +- services/files/wrangler.jsonc | 3 +- services/legacy/cloudflare.config.ts | 4 +- services/site/cloudflare.config.ts | 6 +-- 23 files changed, 69 insertions(+), 47 deletions(-) diff --git a/.github/release/cloudflare-token.sh b/.github/release/cloudflare-token.sh index bc8e59d80c4..478f0599cdf 100755 --- a/.github/release/cloudflare-token.sh +++ b/.github/release/cloudflare-token.sh @@ -12,6 +12,10 @@ set +x url=${CLOUDFLARE_TOKEN_URL:-https://kjivkui2evldapbok5fhrrl6oy0fctkp.lambda-url.us-east-1.on.aws/} account=${CLOUDFLARE_ACCOUNT_ID:-15d29c8639fd3733b1b5486a2acfd968} +if [[ $# == 1 ]]; then + . "$(dirname "$0")/lib.sh" + account=$(stage_account "$1") +fi # One argv value, never a line in curl's config: a newline in an override must not be able to # inject curl options or move the AWS credentials into Basic auth. diff --git a/.github/release/deploy-data.sh b/.github/release/deploy-data.sh index 156db5a5c23..48a5a6a03d1 100755 --- a/.github/release/deploy-data.sh +++ b/.github/release/deploy-data.sh @@ -32,7 +32,8 @@ done : "${CLOUDFLARE_API_TOKEN:?Set CLOUDFLARE_API_TOKEN}" # Pinned in targets/ and in the token issuer's config (anomalyco/secrets). -export CLOUDFLARE_ACCOUNT_ID=15d29c8639fd3733b1b5486a2acfd968 +CLOUDFLARE_ACCOUNT_ID=$(stage_account "$mode") +export CLOUDFLARE_ACCOUNT_ID unexpected=$(cd "$src" && find . ! -type d ! -type f -o -type f ! -path ./SHA256SUMS \ ! -path ./v0/config.json \ diff --git a/.github/release/deploy-files.sh b/.github/release/deploy-files.sh index a9635300780..0215545894a 100755 --- a/.github/release/deploy-files.sh +++ b/.github/release/deploy-files.sh @@ -24,7 +24,8 @@ target="$release/targets/files/$mode/wrangler.json" : "${CLOUDFLARE_API_TOKEN:?Set CLOUDFLARE_API_TOKEN}" # Pinned in targets/ and in the token issuer's config (anomalyco/secrets). -export CLOUDFLARE_ACCOUNT_ID=15d29c8639fd3733b1b5486a2acfd968 +CLOUDFLARE_ACCOUNT_ID=$(stage_account "$mode") +export CLOUDFLARE_ACCOUNT_ID unexpected=$(cd "$src" && find . ! -type d ! -type f -o -type f ! -path ./SHA256SUMS ! -path ./index.js) [ -z "$unexpected" ] || die "Unexpected files in the files artifact: $unexpected" diff --git a/.github/release/deploy-legacy.sh b/.github/release/deploy-legacy.sh index 4fd7b684cae..e4000dd5cf0 100755 --- a/.github/release/deploy-legacy.sh +++ b/.github/release/deploy-legacy.sh @@ -24,7 +24,8 @@ target="$release/targets/legacy/$mode" : "${CLOUDFLARE_API_TOKEN:?Set CLOUDFLARE_API_TOKEN}" # Pinned in targets/ and in the token issuer's config (anomalyco/secrets). -export CLOUDFLARE_ACCOUNT_ID=15d29c8639fd3733b1b5486a2acfd968 +CLOUDFLARE_ACCOUNT_ID=$(stage_account "$mode") +export CLOUDFLARE_ACCOUNT_ID unexpected=$(cd "$src" && find . ! -type d ! -type f -o -type f ! -path ./SHA256SUMS \ ! -path ./v0/config.json \ diff --git a/.github/release/deploy-site.sh b/.github/release/deploy-site.sh index 77d92d02f88..5b6c5ad2d45 100755 --- a/.github/release/deploy-site.sh +++ b/.github/release/deploy-site.sh @@ -24,7 +24,8 @@ target="$release/targets/site/$mode" : "${CLOUDFLARE_API_TOKEN:?Set CLOUDFLARE_API_TOKEN}" # Pinned in targets/ and in the token issuer's config (anomalyco/secrets). -export CLOUDFLARE_ACCOUNT_ID=15d29c8639fd3733b1b5486a2acfd968 +CLOUDFLARE_ACCOUNT_ID=$(stage_account "$mode") +export CLOUDFLARE_ACCOUNT_ID unexpected=$(cd "$src" && find . ! -type d ! -type f -o -type f ! -path ./SHA256SUMS \ ! -path ./v0/config.json \ diff --git a/.github/release/lib.sh b/.github/release/lib.sh index ed4b74a4caa..a7d06fffe9c 100644 --- a/.github/release/lib.sh +++ b/.github/release/lib.sh @@ -23,6 +23,14 @@ dry_run() { [ "${OPENCODE_DRY_RUN:-false}" = true ] } +stage_account() { + case "$1" in + dev) echo d8e944f537ceef3f06a5bd3aec1d7a53 ;; + production) echo 15d29c8639fd3733b1b5486a2acfd968 ;; + *) die "Unknown Cloudflare stage: $1" ;; + esac +} + sha256() { if command -v sha256sum > /dev/null; then sha256sum "$@"; else shasum -a 256 "$@"; fi } diff --git a/.github/release/targets/data/dev/default.json b/.github/release/targets/data/dev/default.json index ee773890be6..fd29e9c8d03 100644 --- a/.github/release/targets/data/dev/default.json +++ b/.github/release/targets/data/dev/default.json @@ -3,25 +3,25 @@ "compatibilityDate": "2026-07-25", "compatibilityFlags": ["nodejs_compat"], "triggers": [ - { "type": "fetch", "pattern": "dev.opencode.ai/data*", "zone": "opencode.ai" }, - { "type": "fetch", "pattern": "dev.opencode.ai/en/data*", "zone": "opencode.ai" }, - { "type": "fetch", "pattern": "dev.opencode.ai/zh/data*", "zone": "opencode.ai" }, - { "type": "fetch", "pattern": "dev.opencode.ai/zht/data*", "zone": "opencode.ai" }, - { "type": "fetch", "pattern": "dev.opencode.ai/ko/data*", "zone": "opencode.ai" }, - { "type": "fetch", "pattern": "dev.opencode.ai/de/data*", "zone": "opencode.ai" }, - { "type": "fetch", "pattern": "dev.opencode.ai/es/data*", "zone": "opencode.ai" }, - { "type": "fetch", "pattern": "dev.opencode.ai/fr/data*", "zone": "opencode.ai" }, - { "type": "fetch", "pattern": "dev.opencode.ai/it/data*", "zone": "opencode.ai" }, - { "type": "fetch", "pattern": "dev.opencode.ai/da/data*", "zone": "opencode.ai" }, - { "type": "fetch", "pattern": "dev.opencode.ai/ja/data*", "zone": "opencode.ai" }, - { "type": "fetch", "pattern": "dev.opencode.ai/pl/data*", "zone": "opencode.ai" }, - { "type": "fetch", "pattern": "dev.opencode.ai/ru/data*", "zone": "opencode.ai" }, - { "type": "fetch", "pattern": "dev.opencode.ai/uk/data*", "zone": "opencode.ai" }, - { "type": "fetch", "pattern": "dev.opencode.ai/ar/data*", "zone": "opencode.ai" }, - { "type": "fetch", "pattern": "dev.opencode.ai/no/data*", "zone": "opencode.ai" }, - { "type": "fetch", "pattern": "dev.opencode.ai/br/data*", "zone": "opencode.ai" }, - { "type": "fetch", "pattern": "dev.opencode.ai/th/data*", "zone": "opencode.ai" }, - { "type": "fetch", "pattern": "dev.opencode.ai/tr/data*", "zone": "opencode.ai" } + { "type": "fetch", "pattern": "dev.opencode.ai/data*", "zone": "dev.opencode.ai" }, + { "type": "fetch", "pattern": "dev.opencode.ai/en/data*", "zone": "dev.opencode.ai" }, + { "type": "fetch", "pattern": "dev.opencode.ai/zh/data*", "zone": "dev.opencode.ai" }, + { "type": "fetch", "pattern": "dev.opencode.ai/zht/data*", "zone": "dev.opencode.ai" }, + { "type": "fetch", "pattern": "dev.opencode.ai/ko/data*", "zone": "dev.opencode.ai" }, + { "type": "fetch", "pattern": "dev.opencode.ai/de/data*", "zone": "dev.opencode.ai" }, + { "type": "fetch", "pattern": "dev.opencode.ai/es/data*", "zone": "dev.opencode.ai" }, + { "type": "fetch", "pattern": "dev.opencode.ai/fr/data*", "zone": "dev.opencode.ai" }, + { "type": "fetch", "pattern": "dev.opencode.ai/it/data*", "zone": "dev.opencode.ai" }, + { "type": "fetch", "pattern": "dev.opencode.ai/da/data*", "zone": "dev.opencode.ai" }, + { "type": "fetch", "pattern": "dev.opencode.ai/ja/data*", "zone": "dev.opencode.ai" }, + { "type": "fetch", "pattern": "dev.opencode.ai/pl/data*", "zone": "dev.opencode.ai" }, + { "type": "fetch", "pattern": "dev.opencode.ai/ru/data*", "zone": "dev.opencode.ai" }, + { "type": "fetch", "pattern": "dev.opencode.ai/uk/data*", "zone": "dev.opencode.ai" }, + { "type": "fetch", "pattern": "dev.opencode.ai/ar/data*", "zone": "dev.opencode.ai" }, + { "type": "fetch", "pattern": "dev.opencode.ai/no/data*", "zone": "dev.opencode.ai" }, + { "type": "fetch", "pattern": "dev.opencode.ai/br/data*", "zone": "dev.opencode.ai" }, + { "type": "fetch", "pattern": "dev.opencode.ai/th/data*", "zone": "dev.opencode.ai" }, + { "type": "fetch", "pattern": "dev.opencode.ai/tr/data*", "zone": "dev.opencode.ai" } ], "observability": { "enabled": true }, "workersDev": false, diff --git a/.github/release/targets/data/dev/root.json b/.github/release/targets/data/dev/root.json index 20a9b8c1006..53faf94c4a7 100644 --- a/.github/release/targets/data/dev/root.json +++ b/.github/release/targets/data/dev/root.json @@ -1,4 +1,4 @@ { - "accountId": "15d29c8639fd3733b1b5486a2acfd968", + "accountId": "d8e944f537ceef3f06a5bd3aec1d7a53", "buildContext": { "isPreview": false, "mode": "dev" } } diff --git a/.github/release/targets/files/dev/wrangler.json b/.github/release/targets/files/dev/wrangler.json index 5635c6e631a..edc4853318e 100644 --- a/.github/release/targets/files/dev/wrangler.json +++ b/.github/release/targets/files/dev/wrangler.json @@ -1,11 +1,12 @@ { "name": "opencode-dev-files", + "account_id": "d8e944f537ceef3f06a5bd3aec1d7a53", "main": "index.js", "no_bundle": true, "compatibility_date": "2026-08-01", "workers_dev": false, "preview_urls": false, "vars": { "STAGE": "dev" }, - "routes": [{ "pattern": "dev.opencode.ai/files/*", "zone_name": "opencode.ai" }], + "routes": [{ "pattern": "dev.opencode.ai/files/*", "zone_name": "dev.opencode.ai" }], "r2_buckets": [{ "binding": "FILES", "bucket_name": "opencode-dev-files" }] } diff --git a/.github/release/targets/legacy/dev/root.json b/.github/release/targets/legacy/dev/root.json index 20a9b8c1006..53faf94c4a7 100644 --- a/.github/release/targets/legacy/dev/root.json +++ b/.github/release/targets/legacy/dev/root.json @@ -1,4 +1,4 @@ { - "accountId": "15d29c8639fd3733b1b5486a2acfd968", + "accountId": "d8e944f537ceef3f06a5bd3aec1d7a53", "buildContext": { "isPreview": false, "mode": "dev" } } diff --git a/.github/release/targets/legacy/dev/worker.json b/.github/release/targets/legacy/dev/worker.json index fd5f0fb9431..eec130a4ceb 100644 --- a/.github/release/targets/legacy/dev/worker.json +++ b/.github/release/targets/legacy/dev/worker.json @@ -3,7 +3,7 @@ "compatibilityDate": "2026-07-25", "compatibilityFlags": ["nodejs_compat"], "domains": ["dev.opncd.ai", "api.dev.opencode.ai"], - "logpush": true, + "logpush": false, "observability": { "enabled": true }, "workersDev": false, "previewUrls": false, diff --git a/.github/release/targets/site/dev/root.json b/.github/release/targets/site/dev/root.json index 20a9b8c1006..53faf94c4a7 100644 --- a/.github/release/targets/site/dev/root.json +++ b/.github/release/targets/site/dev/root.json @@ -1,4 +1,4 @@ { - "accountId": "15d29c8639fd3733b1b5486a2acfd968", + "accountId": "d8e944f537ceef3f06a5bd3aec1d7a53", "buildContext": { "isPreview": false, "mode": "dev" } } diff --git a/.github/release/targets/site/dev/worker.json b/.github/release/targets/site/dev/worker.json index 93a0ed61bc5..f9b5fa32426 100644 --- a/.github/release/targets/site/dev/worker.json +++ b/.github/release/targets/site/dev/worker.json @@ -24,8 +24,8 @@ }, "domains": ["dev.opencode.ai", "docs.dev.opencode.ai"], "triggers": [ - { "type": "fetch", "pattern": "dev.opencode.ai", "zone": "opencode.ai" }, - { "type": "fetch", "pattern": "dev.opencode.ai/*", "zone": "opencode.ai" } + { "type": "fetch", "pattern": "dev.opencode.ai", "zone": "dev.opencode.ai" }, + { "type": "fetch", "pattern": "dev.opencode.ai/*", "zone": "dev.opencode.ai" } ], "observability": { "enabled": true }, "workersDev": false, diff --git a/.github/workflows/deploy-files.yml b/.github/workflows/deploy-files.yml index bdd8a8ce0a1..7824f8f4c56 100644 --- a/.github/workflows/deploy-files.yml +++ b/.github/workflows/deploy-files.yml @@ -106,7 +106,7 @@ jobs: # It is a step output, so only the Deploy step gets it. - name: Cloudflare token id: cloudflare-token - run: bash .github/release/cloudflare-token.sh + run: bash .github/release/cloudflare-token.sh "$GITHUB_REF_NAME" env: CLOUDFLARE_TOKEN_URL: ${{ vars.CLOUDFLARE_TOKEN_URL }} diff --git a/.github/workflows/deploy-site.yml b/.github/workflows/deploy-site.yml index 4bcae5a50fd..0ee926abd61 100644 --- a/.github/workflows/deploy-site.yml +++ b/.github/workflows/deploy-site.yml @@ -99,7 +99,7 @@ jobs: # It is a step output, so only the Deploy step gets it. - name: Cloudflare token id: cloudflare-token - run: bash .github/release/cloudflare-token.sh + run: bash .github/release/cloudflare-token.sh "$GITHUB_REF_NAME" env: CLOUDFLARE_TOKEN_URL: ${{ vars.CLOUDFLARE_TOKEN_URL }} diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 5f7db94c271..867c04a8c81 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -96,7 +96,7 @@ jobs: # It is a step output, so only the Deploy step gets it. - name: Cloudflare token id: cloudflare-token - run: bash .github/release/cloudflare-token.sh + run: bash .github/release/cloudflare-token.sh "$GITHUB_REF_NAME" env: CLOUDFLARE_TOKEN_URL: ${{ vars.CLOUDFLARE_TOKEN_URL }} @@ -185,7 +185,7 @@ jobs: - name: Cloudflare token id: cloudflare-token - run: bash .github/release/cloudflare-token.sh + run: bash .github/release/cloudflare-token.sh "$GITHUB_REF_NAME" env: CLOUDFLARE_TOKEN_URL: ${{ vars.CLOUDFLARE_TOKEN_URL }} diff --git a/services/data/cloudflare.config.ts b/services/data/cloudflare.config.ts index 778a2dc23c0..5adf9eef829 100644 --- a/services/data/cloudflare.config.ts +++ b/services/data/cloudflare.config.ts @@ -1,7 +1,7 @@ import { bindings, defineConfig, triggers } from "cf/config" import { LOCALES } from "../../packages/data/app/src/lib/language" import { ogWorkerName } from "./og.config" -import { stage, stageHost } from "./stage" +import { stage, stageAccount, stageHost } from "./stage" // The data site (packages/data/app, SolidStart) at /data and //data on the main host. `--mode dev` deploys // opencode-data-dev on dev.opencode.ai and `--mode production` opencode-data-production on opencode.ai; any other @@ -14,7 +14,7 @@ export default defineConfig(({ mode }) => { const host = stageHost(current) return { // Anomaly - accountId: "15d29c8639fd3733b1b5486a2acfd968", + accountId: stageAccount(current), worker: { name: `opencode-data-${current}`, compatibilityDate: "2026-07-25", @@ -33,7 +33,7 @@ export default defineConfig(({ mode }) => { DATA_DATABASE_PASSWORD: bindings.secret(), }, triggers: ["data", ...LOCALES.map((locale) => `${locale}/data`)].map((prefix) => - triggers.fetch({ pattern: `${host}/${prefix}*`, zone: "opencode.ai" }), + triggers.fetch({ pattern: `${host}/${prefix}*`, zone: host }), ), workersDev: false, previewUrls: false, diff --git a/services/data/og.config.ts b/services/data/og.config.ts index 923ec01c803..db6e21cb132 100644 --- a/services/data/og.config.ts +++ b/services/data/og.config.ts @@ -1,5 +1,5 @@ import { defineConfig } from "cf/config" -import { stage } from "./stage" +import { stage, stageAccount } from "./stage" export const ogWorkerName = (mode: string | undefined) => `opencode-data-og-${stage(mode)}` @@ -8,7 +8,7 @@ export const ogWorkerName = (mode: string | undefined) => `opencode-data-og-${st // Worker doesn't load the Wasm engines and fonts it ships as modules (script/build.ts). export default defineConfig(({ mode }) => ({ // Anomaly - accountId: "15d29c8639fd3733b1b5486a2acfd968", + accountId: stageAccount(stage(mode)), worker: { name: ogWorkerName(mode), compatibilityDate: "2026-07-01", diff --git a/services/data/stage.ts b/services/data/stage.ts index 6500e1dc435..fd5075ae9e4 100644 --- a/services/data/stage.ts +++ b/services/data/stage.ts @@ -16,3 +16,7 @@ export function stage(mode: string | undefined): Stage { export function stageHost(value: Stage) { return hosts[value] } + +export function stageAccount(value: Stage) { + return value === "dev" ? "d8e944f537ceef3f06a5bd3aec1d7a53" : "15d29c8639fd3733b1b5486a2acfd968" +} diff --git a/services/data/sync.config.ts b/services/data/sync.config.ts index 8d7985c9dde..62a6448b712 100644 --- a/services/data/sync.config.ts +++ b/services/data/sync.config.ts @@ -1,5 +1,5 @@ import { bindings, defineConfig, exports, triggers } from "cf/config" -import { stage } from "./stage" +import { stage, stageAccount } from "./stage" // The Worker that syncs R2 SQL aggregates into the data database (packages/data/server/src/worker.ts): the // DataSyncWorkflow, and the cron handler that starts its runs. The schedules must match @@ -9,7 +9,7 @@ export default defineConfig(({ mode }) => { const name = `opencode-data-sync-${current}` return { // Anomaly - accountId: "15d29c8639fd3733b1b5486a2acfd968", + accountId: stageAccount(current), worker: { name, compatibilityDate: "2026-07-25", diff --git a/services/files/wrangler.jsonc b/services/files/wrangler.jsonc index 8ea83447e81..3860221bc2b 100644 --- a/services/files/wrangler.jsonc +++ b/services/files/wrangler.jsonc @@ -8,8 +8,9 @@ "env": { "dev": { "name": "opencode-dev-files", + "account_id": "d8e944f537ceef3f06a5bd3aec1d7a53", "vars": { "STAGE": "dev" }, - "routes": [{ "pattern": "dev.opencode.ai/files/*", "zone_name": "opencode.ai" }], + "routes": [{ "pattern": "dev.opencode.ai/files/*", "zone_name": "dev.opencode.ai" }], "r2_buckets": [{ "binding": "FILES", "bucket_name": "opencode-dev-files" }], }, "production": { diff --git a/services/legacy/cloudflare.config.ts b/services/legacy/cloudflare.config.ts index 425342b6df7..22a15d0ae21 100644 --- a/services/legacy/cloudflare.config.ts +++ b/services/legacy/cloudflare.config.ts @@ -9,7 +9,7 @@ export default defineConfig(({ mode }) => { const dev = mode === "dev" return { // Anomaly - accountId: "15d29c8639fd3733b1b5486a2acfd968", + accountId: dev ? "d8e944f537ceef3f06a5bd3aec1d7a53" : "15d29c8639fd3733b1b5486a2acfd968", worker: { name: dev ? "opencode-legacy-dev" : "opencode-legacy-production", compatibilityDate: "2026-07-25", @@ -24,7 +24,7 @@ export default defineConfig(({ mode }) => { }, workersDev: false, previewUrls: false, - logpush: true, + logpush: !dev, observability: { enabled: true }, }, } diff --git a/services/site/cloudflare.config.ts b/services/site/cloudflare.config.ts index fd1d50b2be1..515ce62e952 100644 --- a/services/site/cloudflare.config.ts +++ b/services/site/cloudflare.config.ts @@ -15,7 +15,7 @@ export default defineConfig(({ mode }) => { const host = dev ? "dev.opencode.ai" : "opencode.ai" return { // Anomaly - accountId: "15d29c8639fd3733b1b5486a2acfd968", + accountId: dev ? "d8e944f537ceef3f06a5bd3aec1d7a53" : "15d29c8639fd3733b1b5486a2acfd968", worker: { name: dev ? "opencode-site-dev" : "opencode-site-production", compatibilityDate: "2026-07-25", @@ -39,8 +39,8 @@ export default defineConfig(({ mode }) => { triggers: dev || productionOwnsRoot ? [ - triggers.fetch({ pattern: host, zone: "opencode.ai" }), - triggers.fetch({ pattern: `${host}/*`, zone: "opencode.ai" }), + triggers.fetch({ pattern: host, zone: host }), + triggers.fetch({ pattern: `${host}/*`, zone: host }), ] : [], // The bare host is a custom domain (it also supplies the DNS record), and cf detaches any domain