37 lines
1.3 KiB
Bash
Executable File
37 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
set -euo pipefail
|
|
|
|
RELEASE="${RELEASE:-$(git rev-parse --short HEAD)}"
|
|
PUBLIC_SOURCEMAPS="${PUBLIC_SOURCEMAPS:-false}"
|
|
|
|
echo "Building Needle 3 sidecar image..."
|
|
docker build -t matst80/needle-sidecar:latest cmd/needle-sidecar
|
|
docker push matst80/needle-sidecar:latest
|
|
|
|
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
|
|
kubectl apply -f k8s/
|
|
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. If the public receiver
|
|
# URL is present, build the same release locally and upload maps to the running
|
|
# receiver. The Kubernetes source-map volume is currently
|
|
# emptyDir, so upload after the rollout rather than before it.
|
|
if [[ -n "${OTEL_URL:-}" ]]; then
|
|
VITE_APP_RELEASE="$RELEASE" npm --prefix otel-ui run build
|
|
while IFS= read -r -d '' map; do
|
|
bundle="${map%.map}"
|
|
RELEASE="$RELEASE" OTEL_URL="$OTEL_URL" \
|
|
./scripts/upload-sourcemap.sh "$bundle"
|
|
done < <(find otel-ui/dist -type f -name '*.js.map' -print0)
|
|
find otel-ui/dist -type f -name '*.map' -delete
|
|
fi
|
|
|
|
kubectl logs -f deployment/otel-debug-receiver -n monitoring
|