Skip to main content

Deploy Runbook (xtranslator3 → Firebase Hosting)

Frontend deployment for the XTranslator web app. Everything in this page is verified against xtranslator3 commit 7800979 (2026-10-15) — when the workflow changes, update this page in the same change.

Pipeline overview​

Workflow: Validate and Deploy Angular SSR to Firebase (.github/workflows/firebase-hosting-deploy.yml in xtranslator3).

  • Triggers: every pull request (validation only) and every push to main (validation + deploy).
  • Runner: self-hosted xtranslator-linux-x64-ui (labels [self-hosted, linux, xtranslator3], machine homeserver).

Job steps, in order. A step failing skips every later step in the same job.

#StepWhenNotes
1Checkoutalwaysfetch-depth: 0 (full history — required by Sentry local-mode set-commits)
2Setup Node.js 20alwaysactions/setup-node@v4
3Install Dependenciesalwaysnpm ci
4Jest unit testsalwaysnpm run test:ci
5Playwright E2E (chromium)alwayshermetic: E2E_BOOT_API=0, --workers=1; report uploaded on failure, 14-day retention
6Build prerendered production appalwaysnpm run firebase:build → output in dist/xtranslator/browser
7Ensure sentry-climain push onlynpm install -g @sentry/cli@3.8.0 if not already on the job PATH
8Sentry Release & Sourcemapsmain push onlysee below — hard gate: if it fails, the deploy never runs
9Deploy to Firebase Hostingmain push onlynpx --yes firebase-tools@15.30.2 deploy --only hosting --project xtranslator-app --non-interactive
10Verify Deploymentmain push onlycurl -f https://xtranslator-app.web.app after a 10 s wait

Sentry release flow​

  • Release name: xtranslator3@<short-sha> — the first 7 chars of the HEAD SHA (git rev-parse --short=7 HEAD). Example: xtranslator3@7800979.
  • Sentry org: xtranslator; project: xtranslator_frontend.
  • Auth: SENTRY_AUTH_TOKEN repo secret; CLI is sentry-cli 3.x (3.8.0 pinned in the provisioning step).
  • The step runs under set -euo pipefail, so any failure fails the job loudly.

Commands as they run in CI:

SHORT_SHA=$(git rev-parse --short=7 HEAD)
RELEASE="xtranslator3@$SHORT_SHA"

# Create the release; on failure check whether it already exists (rerun of the
# same commit is idempotent) and fail loud on anything else.
sentry-cli releases new "$RELEASE" || sentry-cli releases info "$RELEASE"

# Local mode: walks the checked-out git history (previous release commit .. HEAD).
# No --commit flag — sentry-cli 3.x expects REPO@SHA and the org has no
# connected GitHub repo (see "Runner & Sentry gotchas" below).
sentry-cli releases set-commits "$RELEASE" --ignore-missing

# sentry-cli 3.x: top-level `sourcemaps upload` (rewriting is on by default).
# Angular output lives in dist/xtranslator/browser — NOT dist/xtranslator3/browser.
sentry-cli sourcemaps upload dist/xtranslator/browser --release "$RELEASE" --url-prefix "~"

sentry-cli releases finalize "$RELEASE"

Getting job logs (self-hosted runner)​

Both endpoints verified working on 2026-10-16 (authenticated gh):

# Whole run, all jobs (returns a zip):
gh api repos/KhaledSamir/xtranslator3/actions/runs/<run-id>/logs

# Single job, plain text:
gh api repos/KhaledSamir/xtranslator3/actions/jobs/<job-id>/logs

Get run/job IDs with gh run list --workflow firebase-hosting-deploy.yml and gh run view <run-id>. If the API is not available, use the GitHub web UI: repository → Actions → run → job → step.

Runner & Sentry gotchas​

  • The runner service PATH excludes the host's tool node dirs (e.g. ~/.hermes/tools). A CI step must never assume a host-installed CLI is present — provision it in-job. The "Ensure sentry-cli" step is the pattern: npm install -g into the setup-node npm prefix, which is on the job PATH. (/usr/local/bin is not writable from jobs.)
  • The Sentry org has no connected GitHub repo, so set-commits --commit <sha> fails with "Unknown repo" in sentry-cli 3.x (a bare SHA is parsed as the repo name). Use local mode (no --commit flag) with a full-history checkout (fetch-depth: 0).
  • The Sentry step is main-only. Pull-request runs never execute it, so a broken Sentry step can merge without any red run. After any change to the Sentry steps, confirm a green push-to-main run before calling the change done (see the incident below).
  • The Sentry step gates the deploy. It sits before "Deploy to Firebase Hosting" in the same job with no || true fallback: a Sentry failure means the site is not redeployed (the previous build keeps serving).

Incident: Sentry step blocked all deploys (2026-10-15)​

On 2026-10-14 20:18 PDT, PR #68 merged a new "Sentry Release & Sourcemaps" step (run 38675555761). It failed every push to main, so no frontend change was deployed until 2026-10-15 22:20 PDT. The live site kept serving the last good build throughout. Timeline (PDT):

TimeEvent
10-14 20:18#68 merges (run 38675555761) — step uses sentry-cli 2.x syntax (releases upload-sourcemaps, not valid in 3.x) and a wrong output dir (dist/xtranslator3/browser; actual is dist/xtranslator/browser).
10-15 21:12Fix 767002d (3.x syntax, correct dist path, idempotent rerun, set -euo pipefail) — run 38849432762 fails: sentry-cli not on the runner job PATH (host install in a node dir missing from the systemd service PATH).
10-15 22:07Fix f9bc9bf (in-job CLI provisioning) — run 38854180763 fails: set-commits --commit expects REPO@SHA in 3.x; bare SHA parsed as repo name → "Unknown repo".
10-15 22:20Fix 7800979 (local-mode set-commits + fetch-depth: 0) — run 38855251093 green: deploy + verify (site 200), release xtranslator3@7800979 finalized with 20 commits and 79 sourcemaps in project xtranslator_frontend (verified by ops).

Lessons encoded in the pipeline now: in-job CLI provisioning, local-mode set-commits, fetch-depth: 0, loud failures (set -euo pipefail).

Open follow-ups (not yet done):

  • Smoke-test Sentry release creation on PRs (or move the Sentry step after the deploy / make it non-blocking) so the deploy is not gated on an untested main-only step.
  • Bump actions/checkout@v4 / actions/setup-node@v4: GitHub reports a Node.js 20 deprecation annotation (the runner forces Node 24). Cosmetic for now; act when GitHub moves actions fully off Node 20.

Rollback​

The pipeline deploys whatever main builds — there is no separate rollback channel or channel-based promotion in Firebase Hosting here. To roll back:

  1. Identify the last good commit (git log --oneline main).
  2. Land it on main again — prefer git revert <sha> (or the set of shas) + push; avoid force-pushing main.
  3. CI rebuilds and redeploys; verify with curl -f https://xtranslator-app.web.app and the run's "Verify Deployment" step.
  4. Record the rollback in the changelog with the original incident/fix references.