Repository navigation
Homebrew install: brew install p10node/tap/k10s - #29
Merged
Merged
Conversation
packaging/homebrew/formula.sh takes a release tag and that release's checksums.txt and prints Formula/k10s.rb for p10node/homebrew-tap: the prebuilt macOS and Linux archives, arm64 and amd64, each with the sha256 that checksums.txt lists for it, so brew install takes seconds and needs no Go. `just brew-formula <tag> <checksums.txt>` runs it. It refuses anything but a full release tag (vMAJOR.MINOR.PATCH), and a manifest that does not list each archive exactly once with a well-formed digest. The formula has no version line: Homebrew reads the version out of the release URLs, and brew audit --strict calls such a line redundant. Its livecheck follows the latest GitHub release, and its test checks that k10s --version names the version. The script gives the same output under bash 3.2 and zsh. A test-only Go package next to it runs it against a fixture manifest, so a change to the script, or to the archive names it reads, fails a pull request rather than the tap. Its comparison with zsh skips where zsh is not installed, as on GitHub's Ubuntu runners, so bash 3.2 and zsh were checked by hand. Refs p10node#26 Signed-off-by: Adao Oliveira Jr <[email protected]>
homebrew.yml writes Formula/k10s.rb for a release and pushes it to p10node/homebrew-tap. release.yml calls it (next commit), and it can be run by hand with a tag, to publish a release the tap missed. Before it writes anything it checks that the tag is a full release tag (passed through env, never into a script), that its release is published and is neither a draft nor a pre-release, and that each of the four archives matches checksums.txt and carries the build provenance attestation release.yml signed for that tag (gh attestation verify with --signer-workflow, --source-ref and --deny-self-hosted-runners). It never moves the tap backwards: the version the tap already has is a no-op, and an older one leaves a warning. HOMEBREW_TAP_TOKEN, a fine-grained token with Contents read and write on the tap and nothing else, is used for the tap checkout and the push only, and neither checkout keeps credentials. The workflow token reads contents and attestations, nothing more. Without the secret, a run from a release leaves a notice and changes nothing; a run by hand fails. Refs p10node#26 Signed-off-by: Adao Oliveira Jr <[email protected]>
A job after the release job calls homebrew.yml with the tag. A pre-release tag (one with a hyphen) skips it. Until HOMEBREW_TAP_TOKEN is set the job only leaves a notice, so merging this before the secret exists cannot fail a release, and the release, published by then, stands even when updating the tap fails. Refs p10node#26 Signed-off-by: Adao Oliveira Jr <[email protected]>
A binary that Homebrew installed sits in a keg, Cellar/k10s/<version>/, and Homebrew keeps a record of the version it put there. k10s update and /update wrote the new release over it, which left the keg holding a build Homebrew knows nothing about. internal/update now recognises a keg: os.Executable with symlinks resolved (macOS reports the bin/k10s link, Linux the keg itself), matched as whole path segments, so neither a directory that only has "Cellar" in its name nor the plain file install.sh puts in /opt/homebrew/bin counts as one. For a keg: - k10s update prints "installed by Homebrew, which updates it: run brew upgrade k10s" and exits 1, without checking for a release or writing anything; - /update, and the status-bar badge, show the same line instead of the install dialog; - the daily notice names brew upgrade k10s instead of /update, and /version says that Homebrew installed it. update.disabled and /update skip work as before. Apply refuses a keg too, before its writability check puts a temporary file in the directory, so no way into the install can write there; a test pins that order. Refs p10node#26 Signed-off-by: Adao Oliveira Jr <[email protected]>
README, docs/install.md and docs/update.md: brew install p10node/tap/k10s, brew upgrade k10s, what k10s update and /update do on a Homebrew install, and what to do when coming from install.sh, whose copy in /usr/local/bin or /opt/homebrew/bin stops brew at the link step. Tap trust as Homebrew documents it (https://docs.brew.sh/Tap-Trust): since Homebrew 6.0.0 a formula from a third-party tap loads only once it is trusted. Installing by the full name trusts that one formula by itself; the short name needs brew trust --formula p10node/tap/k10s first, and a Brewfile entry needs trusted: true. docs/maintaining.md describes homebrew.yml and the HOMEBREW_TAP_TOKEN secret: what it holds, what happens without it or once it expires, and how to run the workflow again for a tag. docs/dev.md points there. Refs p10node#26 Signed-off-by: Adao Oliveira Jr <[email protected]>
7 tasks
v1.4.0 read like a planned version. The workflow's input descriptions, the Justfile and formula.sh's usage comments now say vX.Y.Z, and the workflow's error for a bad tag names only the pattern. formula.sh's test fixture uses v9.9.9, like the update tests: the script refuses a tag that is not a version, so a placeholder cannot stand in there. Refs p10node#26 Signed-off-by: Adao Oliveira Jr <[email protected]>
This was referenced Nov 8, 2026
p10node#28 adds a sentence after the same table, so the two pull requests conflicted in docs/maintaining.md. Above the table, both apply in either order. Signed-off-by: Adao Oliveira Jr <[email protected]>
pierreneter
approved these changes
Nov 9, 2026
pierreneter
left a comment
Member
There was a problem hiding this comment.
Thanks for putting this together. I've added the HOMEBREW_TAP_TOKEN secret to the repo, so feel free to merge.
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.
Refs #26. Everything in the issue that is code is here. The rest is at the end: the tap repository, which now exists, and the secret, which needs an admin.
Commit 1 adds
packaging/homebrew/formula.sh. Given a tag and that release'schecksums.txt, it printsFormula/k10s.rb, which installs the prebuilt macOS and Linux archives (arm64 and amd64) with the sha256 thatchecksums.txtlists for each: no Go, seconds to install.just brew-formula <tag> <checksums.txt>runs it. It refuses a tag that is notvMAJOR.MINOR.PATCH, and a manifest that does not list each archive exactly once with a well-formed digest. A test-only package beside the script runs it in CI.Commit 2 adds
.github/workflows/homebrew.yml, callable with a tag (workflow_call) and runnable by hand with one (workflow_dispatch). Before it writes anything it checks the tag, that the release is published and is neither a draft nor a pre-release, and each archive againstchecksums.txtand against the build provenance attestationrelease.ymlsigned for that tag. It never moves the tap backwards (the version the tap already has is a no-op), then commitsk10s <version>to the tap'smainand pushes it withHOMEBREW_TAP_TOKEN, which is used for the tap checkout and the push and nothing else. The workflow token iscontents: readandattestations: read.Commit 3 calls it from
release.ymlafter the release job, for full releases only. Without the secret the job leaves a notice instead of failing, so this can merge before the secret exists.Commit 4 makes
k10s updateand/updatestep aside for a binary inside a Homebrew keg (Cellar/k10s/<version>/, symlinks resolved, matched as whole path segments).k10s updateprintsk10s: installed by Homebrew, which updates it: run brew upgrade k10sand exits 1 without checking for a release or writing anything,/updateshows the same line, and the daily notice namesbrew upgrade k10sinstead of/update.Applyitself refuses a keg before it writes anything, and a test pins that it refuses before its writability probe.update.disabledand/update skipare unchanged.Commit 5 documents it: the README, docs/install.md (with tap trust, as Homebrew documents it: the full name trusts the formula by itself, the short name and a Brewfile need a trust step), docs/update.md, and docs/maintaining.md (the workflow and the secret).
Checked:
go vetandgo testpass on Go 1.26.10 and 1.27.3 on top of chore(deps): bump the kubernetes group across 1 directory with 6 updates #20 and chore(deps): bump the charm group across 1 directory with 2 updates #21, and the fullgo test ./...passes on 1.27.3. Taking out any one of the new guards makes its test fail.gh attestation verifycommand the workflow runs passes for the four v0.1.8 archives, and fails with a wrong--source-ref.brew stylefinds no offenses,brew audit --strict --onlineis clean for macOS and Linux, arm and intel, and with--new, andbrew livecheckfinds 0.1.8.brew installlinksbin/k10stoCellar/k10s/0.1.8/bin/k10s,brew testpasses, and it fails with a wrong version. The real release binary was not run.Outside the code:
brew install p10node/tap/k10sworks now. v0.1.8 predates commit 4, so a v0.1.8 installed with brew still updates itself over its keg until the next release replaces it;brew upgradeputs that right.p10node/homebrew-taponly, Contents: read and write) and add it to this repository asHOMEBREW_TAP_TOKEN? If the organization only allows fine-grained tokens after approval, it needs approving there too.After that the next full release updates the tap by itself, and
homebrewcan be run by hand for a tag it missed. Once a release with commit 4 is in the tap andbrew install p10node/tap/k10shas been tried on a Mac and on Linux, #26 can close.