From 41480bf30aee35c49de8c39c0085fdd0ca6c61b4 Mon Sep 17 00:00:00 2001 From: Jared Vititoe Date: Sun, 22 Nov 2026 20:17:15 -0500 Subject: [PATCH] Deploy worker: trigger on worker/ or the lockfile, not package.json scripts A lint script change in package.json restarted the worker for nothing. Every dependency change also changes package-lock.json, so that is enough. Co-Authored-By: Claude Opus 5.5 --- .gitea/workflows/ci.yml | 5 +++-- README.md | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index d3b1df7..1d8a0db 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -296,7 +296,8 @@ jobs: GIT_SHA: ${{ github.sha }} run: | # Restarting the worker briefly interrupts Gandalf's commands, so only - # deploy when worker code or its dependencies changed (#40). + # deploy when worker code or its dependencies changed (#40). The lockfile + # changes with every dependency change; package.json alone (scripts) doesn't matter. running=$(curl -fsS --max-time 5 http://10.10.10.65:8080/healthz \ | node -e 'let s="";process.stdin.on("data",d=>s+=d).on("end",()=>console.log((JSON.parse(s).worker_versions||[]).join(" ")))') echo "Workers run: ${running:-none}" @@ -304,7 +305,7 @@ jobs: [ -n "$running" ] || deploy=true for v in $running; do if ! git cat-file -e "${v}^{commit}" 2>/dev/null \ - || ! git diff --quiet "$v" "$GIT_SHA" -- worker/ package.json package-lock.json; then + || ! git diff --quiet "$v" "$GIT_SHA" -- worker/ package-lock.json; then deploy=true fi done diff --git a/README.md b/README.md index 3c396ee..caa5e46 100644 --- a/README.md +++ b/README.md @@ -681,7 +681,7 @@ The only worker today is `pulse-worker-01` (LXC CT 153 on monitor-01, 10.10.10.1 `pulse-worker.service`. The unit file itself is deployed from `jared/pve-infra`. After the server deploys, the `Deploy worker` job checks the commit the connected workers report -(`worker_versions` in `/healthz`). Only if `worker/` or the npm manifests changed since then does it +(`worker_versions` in `/healthz`). Only if `worker/` or `package-lock.json` (any dependency change) changed since then does it call the HMAC-signed `pulse-worker-deploy` hook on CT 153, so unrelated merges don't restart the worker mid-command. The hook runs `deploy/pulse_worker_deploy.sh `, which: