mirror of
https://github.com/bulwarkmail/webmail.git
synced 2026-11-01 16:12:02 +00:00
Every image, the standalone tarballs and the Lite zips are built with source maps (`BULWARK_SOURCE_MAPS=1`). Turbopack builds give each chunk a debug ID themselves; the webpack build in the Docker image gets them from `sentry-cli sourcemaps inject`. `scripts/sourcemaps.mjs collect` then moves every map out of the build before anything is packed, and `scripts/sourcemaps.mjs check` fails the build when a `.map` file, an inline map or a `sourceMappingURL` to a missing file would ship. - Docker images: a `sourcemaps` stage holds only the maps; the amd64 job exports it (a cache hit) and uploads it, since both platforms build identical chunks - standalone tarballs, the Lite zips and the Lite image upload their own maps and check what they ship - `scripts/upload-sourcemaps.sh` uploads to `bulwark-instances` and `bulwark-telemetry` (Bugsink keeps maps per project) and skips with a notice when the `BUGSINK_AUTH_TOKEN` secret is missing
31 lines
1.3 KiB
Bash
31 lines
1.3 KiB
Bash
#!/usr/bin/env bash
|
|
# Upload a folder of source maps (with their chunks, as scripts/sourcemaps.mjs
|
|
# collect leaves them) to Bugsink. Bugsink finds a map by the debug ID alone,
|
|
# so the release name doesn't matter, but it keeps maps per project: every
|
|
# project that gets events for these chunks needs them.
|
|
#
|
|
# BUGSINK_AUTH_TOKEN upload token; without it the upload is skipped with a notice
|
|
# BUGSINK_URL default https://bugsink.internal.bulwarkmail.org/
|
|
# BUGSINK_PROJECTS default "bulwark-instances bulwark-telemetry"
|
|
# SENTRY_CLI_VERSION default 3.8.2
|
|
#
|
|
# https://bulwarkmail.org/docs/admin/monitoring
|
|
set -euo pipefail
|
|
|
|
dir="${1:?usage: upload-sourcemaps.sh <dir>}"
|
|
if [ -z "${BUGSINK_AUTH_TOKEN:-}" ]; then
|
|
echo "::notice::BUGSINK_AUTH_TOKEN is not set: source maps in ${dir} were built but not uploaded"
|
|
exit 0
|
|
fi
|
|
if [ -z "$(find "$dir" -name '*.map' -print -quit 2>/dev/null)" ]; then
|
|
echo "::warning::no source maps in ${dir}"
|
|
exit 0
|
|
fi
|
|
|
|
url="${BUGSINK_URL:-https://bugsink.internal.bulwarkmail.org/}"
|
|
cli="@sentry/cli@${SENTRY_CLI_VERSION:-3.8.2}"
|
|
for project in ${BUGSINK_PROJECTS:-bulwark-instances bulwark-telemetry}; do
|
|
SENTRY_AUTH_TOKEN="$BUGSINK_AUTH_TOKEN" npx --yes "$cli" --url "$url" \
|
|
sourcemaps --org bugsinkhasnoorgs --project "$project" upload "$dir"
|
|
done
|