Merge pull request 'Deploy worker: trigger on worker/ or the lockfile, not package.json scripts' (#57) from worker-deploy-trigger into main
CI / UI screenshots (before/after) (push) Skipped
CI / Lint (eslint) (push) Successful in 18s
CI / Test (jest) (push) Successful in 17s
CI / Security (npm audit) (push) Successful in 14s
CI / Integration (api) (push) Successful in 1m21s
CI / Scan (secrets, workflows, shell) (push) Successful in 1m53s
CI / UI (playwright) (push) Successful in 2m13s
CI / Deploy (push) Failing after 3s
CI / Deploy worker (push) Skipped
CI / Notify (push) Successful in 2s
CI / UI screenshots (before/after) (push) Skipped
CI / Lint (eslint) (push) Successful in 18s
CI / Test (jest) (push) Successful in 17s
CI / Security (npm audit) (push) Successful in 14s
CI / Integration (api) (push) Successful in 1m21s
CI / Scan (secrets, workflows, shell) (push) Successful in 1m53s
CI / UI (playwright) (push) Successful in 2m13s
CI / Deploy (push) Failing after 3s
CI / Deploy worker (push) Skipped
CI / Notify (push) Successful in 2s
This commit was merged in pull request #57.
This commit is contained in:
commit
c35eb82631
2 files changed
+15
-4
No files matched your search
+14
-3
@@ -61,7 +61,17 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
||||||
- name: Audit production and dev dependencies
|
- name: Audit production and dev dependencies
|
||||||
run: npm audit --audit-level=high
|
run: |
|
||||||
|
# Retry only when the registry itself fails (it has returned spurious 400s);
|
||||||
|
# a real advisory fails at once.
|
||||||
|
for attempt in 1 2 3; do
|
||||||
|
if out=$(npm audit --audit-level=high 2>&1); then echo "$out"; exit 0; fi
|
||||||
|
echo "$out"
|
||||||
|
echo "$out" | grep -q "audit endpoint returned an error" || exit 1
|
||||||
|
echo "npm registry error (attempt $attempt); retrying in 20s"
|
||||||
|
sleep 20
|
||||||
|
done
|
||||||
|
exit 1
|
||||||
- name: Software bill of materials (production dependencies)
|
- name: Software bill of materials (production dependencies)
|
||||||
run: npm sbom --sbom-format cyclonedx --omit dev --package-lock-only > sbom.cdx.json
|
run: npm sbom --sbom-format cyclonedx --omit dev --package-lock-only > sbom.cdx.json
|
||||||
- name: Keep the SBOM for each main build
|
- name: Keep the SBOM for each main build
|
||||||
@@ -296,7 +306,8 @@ jobs:
|
|||||||
GIT_SHA: ${{ github.sha }}
|
GIT_SHA: ${{ github.sha }}
|
||||||
run: |
|
run: |
|
||||||
# Restarting the worker briefly interrupts Gandalf's commands, so only
|
# 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 \
|
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(" ")))')
|
| 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}"
|
echo "Workers run: ${running:-none}"
|
||||||
@@ -304,7 +315,7 @@ jobs:
|
|||||||
[ -n "$running" ] || deploy=true
|
[ -n "$running" ] || deploy=true
|
||||||
for v in $running; do
|
for v in $running; do
|
||||||
if ! git cat-file -e "${v}^{commit}" 2>/dev/null \
|
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
|
deploy=true
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -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`.
|
`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
|
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
|
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 <sha> <ts>`, which:
|
worker mid-command. The hook runs `deploy/pulse_worker_deploy.sh <sha> <ts>`, which:
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user