:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(tasks): query hogpanion via sudo in the golden smoke test (#91290)
Tom Owers4a6902f0bee7
diff --git a/products/tasks/backend/sandbox/images/hogland/bake-golden.sh b/products/tasks/backend/sandbox/images/hogland/bake-golden.shindex 97c52ba2b166..d99809a9b0e4 100755--- a/products/tasks/backend/sandbox/images/hogland/bake-golden.sh+++ b/products/tasks/backend/sandbox/images/hogland/bake-golden.sh@@ -222,14 +222,6 @@ if [[ "$setup_rc" -ne 0 ]]; thenfilog "setup-golden.sh completed in the box"-# Diagnostic (temporary): record hogpanion's state at snapshot time. The dev-# smoke finds hogpanion.service with no MainPID in the restored golden; this-# shows whether the daemon is already down HERE (setup left it dead) or only-# after resume. Best-effort over SSH; never fail the bake.-log "hogpanion state at snapshot time (diagnostic)"-"${ssh_base[@]}" "echo '--- hogpanion @ snapshot time ---'; sudo systemctl show hogpanion.service -p MainPID -p ActiveState -p SubState; sudo systemctl status hogpanion.service --no-pager 2>&1 | head -8; echo '--- hogpanion journal (tail) ---'; sudo journalctl -u hogpanion.service --no-pager 2>&1 | tail -40" \- || log "hogpanion snapshot-time diagnostic failed (non-fatal)"-# Snapshot the seed box, then point the candidate alias at the new snapshot id.# `box snapshot` pauses the box and persists it to S3, emitting the record JSON.log "snapshotting seed box $SEED_BOX_ID"diff --git a/products/tasks/backend/sandbox/images/hogland/smoke-golden.sh b/products/tasks/backend/sandbox/images/hogland/smoke-golden.shindex 1cfec2e9ce9b..542027af52ed 100755--- a/products/tasks/backend/sandbox/images/hogland/smoke-golden.sh+++ b/products/tasks/backend/sandbox/images/hogland/smoke-golden.sh@@ -179,13 +179,17 @@ filog "asserting exec-daemon (hogpanion) env carries the container-style env"# shellcheck disable=SC2016 # $pid/$environ must expand on the box, not locallydaemon_env_probe='set -eu-pid=$(systemctl show hogpanion.service -p MainPID --value 2>/dev/null || echo 0)+# Query via sudo. The box runs no system D-Bus daemon, only the systemd+# root-only private socket, so a non-root systemctl fails with "Failed to+# connect to bus" and reports a false MainPID=0. The ssh user hog has+# passwordless sudo, same as the environ read below.+pid=$(sudo systemctl show hogpanion.service -p MainPID --value 2>/dev/null || echo 0)if [ -z "$pid" ] || [ "$pid" = "0" ]; thenecho "hogpanion has no running MainPID" >&2echo "--- hogpanion.service status ---" >&2- systemctl status hogpanion.service --no-pager >&2 2>&1 || true+ sudo systemctl status hogpanion.service --no-pager >&2 2>&1 || trueecho "--- hogpanion journal (tail) ---" >&2- journalctl -u hogpanion.service --no-pager 2>&1 | tail -40 >&2 || true+ sudo journalctl -u hogpanion.service --no-pager 2>&1 | tail -40 >&2 || trueexit 1fienviron=$(sudo cat "/proc/$pid/environ" | tr "\0" "\n")@@ -200,7 +204,7 @@ printf "%s\n" "$environ" | grep -qx "HOME=/root" || { echo "daemon env missing H# the guard is actually there so the guarded path the daemon exposes is real.test -x /opt/posthog/bin/git || { echo "/opt/posthog/bin/git missing" >&2; exit 1; }grep -q POSTHOG_ALLOW_UNSIGNED_GIT /opt/posthog/bin/git || { echo "/opt/posthog/bin/git is not the git guard" >&2; exit 1; }-systemctl show hogpanion.service -p Environment -p EnvironmentFiles --no-pager >&2'+sudo systemctl show hogpanion.service -p Environment -p EnvironmentFiles --no-pager >&2'if ! ssh_assert "$daemon_env_probe"; thenlog "FAIL: hogpanion daemon env is not the container-style env (restart likely did not take before snapshot)"exit 1