CluPilotCloud/deploy
nexxo 4d4d1dd5d5
tests / pest (push) Failing after 8m4s Details
tests / assets (push) Successful in 22s Details
tests / release (push) Has been skipped Details
Stop the update agent dying on its own tag arithmetic
Since 1.2.0 the agent has ended with a non-zero status on every tick, before
writing anything. The console showed a check that never finished and a
last-checked time frozen at the moment of the deployment, and the update button
could not be reached at all — the one mechanism that would have delivered the
fix.

Two instances of the same trap, both mine, both under `set -Eeuo pipefail`:

The tag count was `release_version_gt … && echo`. The LAST iteration is almost
always a tag that is not newer, so the loop ended non-zero, pipefail carried it
out of the pipeline, the command substitution inherited it, and set -e ended
the agent. `if` rather than `&&` is the whole fix: an if whose condition is
false still returns 0.

The newest tag came from `git tag … | head -1`. head exits after one line, git
takes SIGPIPE, pipefail does the rest. install-agent.sh has carried a written
warning about exactly this since it was written; I read it and wrote it anyway.

Both now live in deploy/lib/release.sh, because the reason neither was caught
is that no PHP test can reach a bash pipeline.
tests/Feature/ReleaseComparisonTest.php runs the real functions in a real
throwaway repository under the agent's own set -Eeuo pipefail, and asserts the
EXIT CODE as well as the answer — an answer nobody lives to read is not an
answer. The SIGPIPE case needs four hundred tags to reproduce, because a short
list finishes writing before head leaves.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-29 00:00:17 +02:00
..
caddy Make the private hostnames look like nothing is there, and close the way past the proxy 2026-07-27 11:26:48 +02:00
lib Stop the update agent dying on its own tag arithmetic 2026-07-29 00:00:17 +02:00
clupilot.env.example Show times on the operator's clock, keep storing them in UTC 2026-07-27 17:32:21 +02:00
install-agent.sh Deploy as the application's user, and take back what root already took 2026-07-28 22:52:09 +02:00
install.sh Deploy as the application's user, and take back what root already took 2026-07-28 22:52:09 +02:00
update-agent.sh Stop the update agent dying on its own tag arithmetic 2026-07-29 00:00:17 +02:00
update.sh Repair ownership by looking inside, not at the door 2026-07-28 23:53:25 +02:00