Skip to content

Commit c7643e5

Browse files
authored
fix(ci): scope build-binary and build-docs to production environment (#773)
## Summary The Bun binary's sourcemaps have **never** been uploaded to Sentry. Every main-branch build logged: ``` SENTRY_AUTH_TOKEN: ← empty! No SENTRY_AUTH_TOKEN, skipping sourcemap upload ``` Root cause: `SENTRY_AUTH_TOKEN` is scoped to the **production** GitHub environment (not a repo secret). Jobs without `environment: production` cannot access it. - `build-binary` → **missing environment** → token empty → upload skipped - `build-docs` → **missing environment** → `env.SENTRY_AUTH_TOKEN != ''` gate fails silently - `build-npm` → had `environment: production` → token available → sourcemaps uploaded ✓ ## Verification Sentry artifact bundles (`sentry api projects/sentry/cli/files/artifact-bundles/`): | File | Bundle count | |---|---:| | `~/index.cjs` (npm) | **100** | | `~/dist-bin/bin.js` (binary) | **0** | Every Sentry event from the Bun binary (e.g. `CLI-15H`, `CLI-SS`) shows minified function names like `xE`, `yxe`, `oet` — server-side symbolication has nothing to resolve against. ## Fix Add `environment: production` to `build-binary` and `build-docs`, matching the pattern already used by `build-npm`. ## Expected impact - Next build on `main` uploads the Bun binary's sourcemap for the first time - New binary-originated events resolve to real function names (`viewCommand.func`, `withTelemetry`, …) - Grouping quality improves — combined with the server-side fingerprint rules from #769, most fragmentation should disappear
1 parent 169f8fe commit c7643e5

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,10 @@ jobs:
218218
name: Build Binary (${{ matrix.target }})
219219
needs: [changes, lint, test-unit]
220220
runs-on: ${{ matrix.os }}
221+
# SENTRY_AUTH_TOKEN is scoped to the production environment so sourcemap
222+
# upload works on main/release branches. Without this, every binary build
223+
# skips the upload and Sentry stack traces show minified names (e.g., xE).
224+
environment: ${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/')) && 'production' || '' }}
221225
strategy:
222226
fail-fast: false
223227
matrix: ${{ fromJSON(needs.changes.outputs.build-targets) }}
@@ -683,6 +687,9 @@ jobs:
683687
name: Build Docs
684688
needs: [lint, build-binary]
685689
runs-on: ubuntu-latest
690+
# SENTRY_AUTH_TOKEN is scoped to the production environment. Needed by
691+
# the "Inject debug IDs and upload sourcemaps" step below.
692+
environment: ${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/')) && 'production' || '' }}
686693
steps:
687694
- uses: actions/checkout@v6
688695
- uses: oven-sh/setup-bun@v2

0 commit comments

Comments
 (0)