Repository navigation
feat: update pullgate from Telegram: a notice for each new release, /update installs it with its units - #43
Merged
Conversation
…update installs it with its units pullgate update (root, pullgate-update.timer and pullgate-update.path) looks for a new release with the copy of install.sh built into the binary. It sends one notice per new release that passed the SHA-256 and attestation checks (a security release says so and repeats daily), and a warning for a release that failed them. /update asks with the version, the SHA-256 and the release link. Apply installs only that tarball, with every check again, then the units the new binary carries, reloads, re-enables and restarts them, restarts the listener last, and rolls back when the listener does not stay active. Fixes #9 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3 tasks
7 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #9
What it does
pullgate update(root) runs frompullgate-update.timer(daily) andpullgate-update.path(/updateand taps). It uses the copy ofinstall.shthat is built into the binary (embed.go).### Securitysection in its notes) says so first and repeats every 23 h until installed. A release that fails a check gets a warning, never the hint.[updates] check = falseinlistener.tomlturns it off./update: the listener writes a check request to_update/check/request(no data from the message). Root checks the release and asks with the version, the tarball, its SHA-256 and the release link. A newer release closes an open question and asks again..pullgate.prev(hard link), runsinstall.sh --version V --sha256 H --forward-only(every check again; the tarball must have the SHA-256 of the question), runspullgate version, installs the units the new binary prints (pullgate units) where they differ,daemon-reload,reenable+restart, restarts the listener last and checks that it stays active. On failure it puts back the old binary and units. The new listener sends the report, with the units it changed and every drop-in._update(not a valid instance name).install.shflags:--check-only(no code of the release runs before the tap),--sha256,--forward-only./update".Tests
internal/selfupdate: real built-ininstall.shagainst a fake release (fake curl, gh, uname):TestUpdateAsksAndInstalls,TestUpdateDenyPaths(wrong SHA-256, failed attestation, before the question and on Apply),TestWrongVersion,TestApplyInstallsOnlyTheApprovedFile,TestOlderVersionIsNeverInstalled,TestNewerReleaseClosesTheOpenQuestion,TestSkip,TestExpiredQuestion,TestNewBinaryDoesNotStart(rollback),TestCrashInTheSwap(T10),TestDailyNotice,TestUnitUpdate,TestRollbackOfANewTemplate,TestUnitListCheck,TestUpdateRequestLimit,TestDevBuildDoesNotUpdate.TestUpdateCommand,TestUpdateCommandWithoutDirectory,TestUpdateQuestionsAreTheirOwn(an instance namedpullgatedoes not touch the updates).embed_test.go: the enable list is the README start block; the embedded files are the repo's.install-loop(test: CI installs pullgate as the README says and runs a full loop under the real units #27): builds this commit as 900.0.0 and 900.0.1, installs the first by the README, then/updateon the fake Telegram installs the second from a fake GitHub (fake/usr/bin/curl, fake gh via[updates] gh, because a CI build has no attestation), puts back a changed unit and lists a drop-in.Reviews
A security review subagent and a correctness review subagent ran on the diff. Fixed: the daily look ran the new binary before a tap (now
--check-onlyruns no release code); the rollback now runs with a context that a stop does not cancel; a rollback disables instances of a new template unit; the output cap; a lost question is sent again on/update; an/updatesent with a tap is not dropped silently; a broken state removes the request and tells the owner; question IDs come from the clock; network errors before the checks are not reported as a failed release; the CI fake release has the tag API path.Not fixed, on purpose (low):
systemctlhelper has a 2-minute timeout but no output cap or process-group kill (systemctl is the system's own program).gh attestation verify(Sigstore root fetch) is reported as a failed check, once per release..tmp-file is caught by theHasCheck/ approvals test only partly.🤖 Generated with Claude Code