From eb137fdbf597ca0ed3c3ce2263bea9bed99b1c67 Mon Sep 17 00:00:00 2001 From: Admin Date: Sun, 5 Apr 2026 20:25:27 +0500 Subject: [PATCH] =?UTF-8?q?fix:=20source=20maps=20=E2=80=94=20ship=20pre-b?= =?UTF-8?q?uilt=20artifact=20with=20injected=20debug=20IDs=20to=20Docker?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The docker-ui job was rebuilding the UI from scratch inside Docker, producing chunk hashes and JS files that didn't match the source maps uploaded to GlitchTip, causing all stack traces to appear minified. Fix: - ui/Dockerfile: add PREBUILT=1 ARG; skip npm run build when set - release.yaml upload-sourcemaps: re-upload artifact after sentry-cli inject - release.yaml docker-ui: download injected artifact into ui/build/ and pass PREBUILT=1 so Docker reuses the exact same JS files whose debug IDs are in GlitchTip --- .gitea/workflows/release.yaml | 14 ++++++++++++++ ui/Dockerfile | 6 +++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/release.yaml b/.gitea/workflows/release.yaml index b92c1a4..1a3b8c9 100644 --- a/.gitea/workflows/release.yaml +++ b/.gitea/workflows/release.yaml @@ -171,6 +171,13 @@ jobs: SENTRY_ORG: libnovel SENTRY_PROJECT: ui + - name: Upload injected build (for docker-ui) + uses: actions/upload-artifact@v3 + with: + name: ui-build-injected + path: build + retention-days: 1 + - name: Create GlitchTip release run: sentry-cli releases new ${{ steps.ver.outputs.version }} env: @@ -226,6 +233,12 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Download injected build (debug IDs already embedded) + uses: actions/download-artifact@v3 + with: + name: ui-build-injected + path: ui/build + - uses: docker/setup-buildx-action@v3 - name: Log in to Docker Hub @@ -255,6 +268,7 @@ jobs: BUILD_VERSION=${{ steps.meta.outputs.version }} BUILD_COMMIT=${{ gitea.sha }} BUILD_TIME=${{ gitea.event.head_commit.timestamp }} + PREBUILT=1 cache-from: type=registry,ref=${{ secrets.DOCKER_USER }}/libnovel-ui:latest cache-to: type=inline diff --git a/ui/Dockerfile b/ui/Dockerfile index 36e29a8..8b68e67 100644 --- a/ui/Dockerfile +++ b/ui/Dockerfile @@ -21,7 +21,11 @@ ENV PUBLIC_BUILD_VERSION=$BUILD_VERSION ENV PUBLIC_BUILD_COMMIT=$BUILD_COMMIT ENV PUBLIC_BUILD_TIME=$BUILD_TIME -RUN npm run build +# PREBUILT=1 skips npm run build — used in CI when the build/ directory has +# already been compiled (and debug IDs injected) by a prior job. The caller +# must copy the pre-built build/ into the Docker context before building. +ARG PREBUILT=0 +RUN [ "$PREBUILT" = "1" ] || npm run build # ── Runtime image ────────────────────────────────────────────────────────────── # adapter-node bundles most server-side code, but packages with dynamic