Files
go-otel/build.sh
T
matsandClaude Sonnet 5.5 51a8412ae1 Remove Needle; stop paging on nginx 4xx
Needle scored ~chance on the golden set and never gated alerts, so drop the
sidecar, proxy handlers, UI buttons, k8s container and build step. The labelled
eval sets move to cmd/triage-eval/data.

nginx 4xx (registry 401 challenges, /oauth2/auth, scanner 405s) is now dropped
in FilterActionable instead of only being discounted, so it cannot ride along
with a real 5xx. nginx 5xx still alerts.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-01 11:40:53 +01:00

54 lines
2.3 KiB
Bash
Executable File

#!/bin/bash
set -euo pipefail
RELEASE="${RELEASE:-$(git rev-parse --short HEAD)}"
PUBLIC_SOURCEMAPS="${PUBLIC_SOURCEMAPS:-false}"
UPLOAD_SOURCEMAPS="${UPLOAD_SOURCEMAPS:-true}"
echo "Building otel-debug receiver image..."
docker build \
--build-arg "APP_RELEASE=${RELEASE}" \
--build-arg "PUBLIC_SOURCEMAPS=${PUBLIC_SOURCEMAPS}" \
-t matst80/otel-debug:latest .
docker push matst80/otel-debug:latest
# Shared key that only keeps strangers from uploading source maps. It is not a
# secret, so it is hardcoded here and in k8s/deployment.yaml.
export OTEL_SOURCEMAP_KEY="6901e62e4468631f27f1dc85fd4231f35b5e591c61f5bcfa"
# Roll out first: the new image requires OTEL_SOURCEMAP_KEY, so the manifest has
# to be applied before uploads, or any pod restart in between rejects them.
# Only the app manifests. Not `-f k8s/`: clickhouse.yaml carries a CHANGE_ME
# password Secret that would overwrite the live one, and auth-dev.yaml is a
# partial AuthServer that must be applied by hand with
# `kubectl apply --server-side --field-manager=otel-dev-auth -f k8s/auth-dev.yaml`.
kubectl apply -f k8s/deployment.yaml -f k8s/service.yaml -f k8s/ingress.yaml
kubectl rollout restart deployment otel-debug-receiver -n monitoring
kubectl rollout status deployment/otel-debug-receiver -n monitoring
# Docker builds intentionally omit public source maps. Upload maps from the
# exact UI build that went into the image right after rolling it out; until then
# RUM events can arrive with a release that the resolver cannot map.
if [[ "${UPLOAD_SOURCEMAPS}" == "true" ]]; then
: "${OTEL_URL:?set OTEL_URL (for example https://otel.k6n.net), or set UPLOAD_SOURCEMAPS=false}"
maps_dir="$(mktemp -d)"
trap 'rm -rf "$maps_dir"' EXIT
docker build --target ui-builder \
--build-arg "APP_RELEASE=${RELEASE}" \
-t otel-debug-ui-builder:"${RELEASE}" .
cid="$(docker create otel-debug-ui-builder:"${RELEASE}")"
docker cp "$cid:/app/dist" "$maps_dir/dist"
docker rm "$cid" >/dev/null
found=0
while IFS= read -r -d '' map; do
found=1
bundle="${map%.map}"
RELEASE="${RELEASE}" OTEL_URL="${OTEL_URL}" \
./scripts/upload-sourcemap.sh "$bundle"
done < <(find "$maps_dir" -type f -name '*.js.map' -print0)
[[ "$found" == 1 ]] || { echo "no source maps found in UI build" >&2; exit 1; }
fi
kubectl logs -f deployment/otel-debug-receiver -n monitoring