Repository navigation
ci(release): pre-releases publish to Homebrew as fluree-beta - #2045
Conversation
Every release now publishes to the tap. A stable release updates `fluree` and `fluree-beta`; a pre-release updates only `fluree-beta`, a keg-only copy of the dist formula that installs beside `fluree`. dist's own publish-prereleases stays off: it writes a pre-release as `fluree.rb`. Formulae are staged outside the tap checkout, so only the chosen ones reach it. Each push attempt rebuilds on the tap's latest commit, skips an unchanged formula and never moves one to an older version.
aaj3f
left a comment
There was a problem hiding this comment.
@bplatz this is a nice design, and no pushback from me on it: deriving fluree-beta from dist's own formula, staging outside the tap so a pre-release structurally can't reach fluree.rb, and the never-backwards guard together cover every case I could think of, and I ran them. One note on order with #2041: a tag runs the workflow at the tagged commit, so if this lands before v4.2.4 is tagged, the stable 4.2.4 run (the one that writes fluree.rb for everyone) becomes this job's first real run, rather than the next beta as the body says. I ran that path and expect it to be fine, so I don't think either PR needs to wait on the other; merging this one after the tag just means the first real run lands on the opt-in formula.
Full review below:
✅ Approve with nits.
Thanks @bplatz, this is carefully built. The part I most wanted to see is structural: dist's formula never lands in the tap checkout, so a pre-release can only reach Formula/fluree.rb through the manifest, and only an explicit announcement_is_prerelease: false puts it there. I ran the step's script in the runner's userland across the cases in your body plus a few more (details on line 381), and all of them behaved as described. There's one small hardening note inline and a couple of notes here.
- 🟡
keg_onlyisn't checked (release.yml:391, inline). A missinglicenseline yields a non-keg-onlyfluree-betaand a green job. It's a one-line flag. - First real run. The body says the next pre-release tag is this job's first real run. That holds only if this merges after
v4.2.4is tagged. If it's onmainwhen #2041 merges and you tag, the stable 4.2.4 run comes first. I ran that path (commitfluree 4.2.4, fluree-beta 4.2.4, both formulae moved), so I don't expect trouble. If it did fail, a re-run wouldn't help (same workflow file at the tag), and the fix would be a hand commit to the tap like 4.1.5's. Merging after the tag avoids even that, but it's your call. - 🟡 The tap's README still lists only
fluree. It's a two-line change influree/homebrew-tap, and since this PR is what createsfluree-betathere, I'd push it alongside. Minor, but if you agree, I'd rather it go out with this than after.
What I checked and found clean:
- With the
if:gone, the job runs exactly whenhostsucceeded: every tag that made a GitHub Release, never a PR (it was skipped along withhoston this PR's Release run). Docker and AUR keep their stable-onlyif:.announcenow waits on the tap job for pre-releases too, but its only step is a checkout. - The dpkg-with-
~ordering agrees with Homebrew's ownVersioncomparison on the pairs that matter (4.2.4 > 4.2.4-beta.2,beta.10 > beta.2,rc.1 > beta.2,5.0.0-beta.1 > 4.2.5; checked withbrew ruby). Sobrew upgradedoes move a beta install to the stable release that supersedes it, as the quickstart says. - The generated
fluree-beta.rbdiffers from dist's in exactly the class,descandkeg_onlylines. url, sha256 and version are untouched, andruby -cpasses.Formulary.class_s("fluree@beta")isFluree@beta, so the naming reasoning holds. - actionlint 1.7.12 with CI's flags passes. With shellcheck on, the new script is clean (the four remaining reports are in dist's unchanged steps).
- The README anchor
#option-2-homebrew-macos--linuxmatches the quickstart heading.
Adherence to repo commitments:
- Patterns/abstractions: ✔ Stays inside dist's generated job (
allow-dirty = ["ci"]) and derives the beta from dist's formula rather than templating a second one.releasing.mdrecords whypublish-prereleasesstays off. - Performance (speed first, memory second): ✔ n/a: release workflow and docs only, no engine code.
- Deployment targets: ✔ n/a for the engine. The job's one host is the
ubuntu-22.04runner, and the evidence (yours and mine) comes fromubuntu:22.04containers. - Testing:
⚠️ Nothing in CI executes this job (publish jobs are skipped on PRs by construction), so the coverage is the two container runs plusworkflow-lint. That's the right evidence for a tag-only job, just worth knowing. - Conventions: ✔ Multi-line commit body, self-describing title, and docs updated in all three places a user or releaser would look.
Verified locally at dc338bc3a: the step's script in ubuntu:22.04 against a bare copy of the tap (ten cases, all as described); the awk with and without a license line; Homebrew's Version ordering and class naming via brew ruby; actionlint with CI's flags and shellcheck on the new script; read-only gh api for check runs, release manifests, the tap's contents and history, and tags. I didn't run brew style --fix or a real push.
Approving so you can merge when ready, but maybe worth folding in the keg_only check first.
| sub(/^class [A-Za-z0-9]+/, "&Beta") { renamed = 1 } | ||
| /^ desc "/ { sub(/"$/, " (including pre-releases)\"") } | ||
| { print } | ||
| /^ license / { print " keg_only \"it installs the same commands as the stable formula\"" } |
There was a problem hiding this comment.
🟡 Optional: the keg_only line is the one guarantee here the script doesn't check.
The awk fails the job when no class line was renamed (END { exit !renamed }), but keg_only is only printed after a ^ license line, and nothing notices when that line isn't there. I ran this block (mawk, in ubuntu:22.04) on beta.2's fluree.rb with the license line removed: it exits 0 and writes a FlureeBeta with no keg_only.
Today that can't happen, since the workspace sets license = "BUSL-1.1" and dist is pinned at 0.31.0. But a dist bump that moves or drops that line would publish a fluree-beta that Homebrew tries to link, so it would collide with an installed fluree's bin/fluree, or, installed first, become the fluree on PATH. That's the opposite of what the quickstart now promises.
Setting a flag next to the print and checking both in END would make it fail loudly instead (illustrative, lines 391–392):
/^ license / { print " keg_only \"it installs the same commands as the stable formula\""; keg = 1 }
END { exit !(renamed && keg) }I recognize this is minor and non-blocking — but if you agree it's right, I'd rather see it folded in now than lost in the backlog.
There was a problem hiding this comment.
Folded in (7ab08d8), with your flag: keg = 1 beside the print, and END { exit !(renamed && keg) }. I ran the block exactly as it is in the workflow on beta.2's fluree.rb under mawk in ubuntu:22.04 (and macOS awk):
- unchanged, it exits 0, and the output still differs from dist's only in the class,
descandkeg_onlylines; - with the
licenseline removed, it exits 1 and writes nokeg_only; - with the
classline broken, it exits 1.
| brew update | ||
| # We avoid reformatting user-provided data such as the app description and homepage. | ||
| brew style --except-cops FormulaAudit/Homepage,FormulaAudit/Desc,FormulaAuditStrict --fix "Formula/${filename}" || true | ||
| if [ "$prerelease" = false ]; then |
There was a problem hiding this comment.
👍 Only an explicit false writes fluree.rb, and that held up when I ran it.
I ran this step's script verbatim in ubuntu:22.04 (mawk, dpkg 1.21.1, bash 5.1 under -e, with brew stubbed) against a bare copy of the real tap. beta.2 created only Formula/fluree-beta.rb. A re-run made no commit. A stable 4.2.4 moved both. A 4.2.3 re-run left both alone. 5.0.0-beta.1 and then a stable 4.2.5 left fluree-beta on the beta and kept a concurrent fluree-ai commit. A push rejected once by a hook went through on the second attempt.
I also dropped announcement_is_prerelease from the plan entirely: fluree.rb stayed put and only fluree-beta moved. So a manifest change fails toward the opt-in formula rather than the one every brew upgrade user gets. Staging dist's output outside the checkout is what makes that structural rather than careful.
The awk that derives fluree-beta.rb from dist's formula failed when no class line was renamed, but added keg_only only after a license line and never checked it had. A dist change that moved or dropped that line would publish a fluree-beta Homebrew links, colliding with an installed fluree or becoming the fluree on PATH. The job now fails unless both the class rename and the keg_only line happened.
|
@aaj3f thanks. On the two notes in the review body:
The |
Brings in #2102 (one HTTP status table), #2068, #2056, #2053, #2046, #2045 and the v4.2.4 release. - api error.rs: main's exhaustive status_code / error_type tables, with ApiError::ConfigUnavailable and TransactError::ConfigUnavailable classified as 500 err:storage/ReadFailure in both, and rows for them and RequestOverrideRefused in every_variant. - server error.rs: main's derivation from ApiError; this branch's ConfigUnavailable arms move to the API tables. - consensus: SubmissionError keeps both ConfigUnavailable and CommitContention. - server routes/transact.rs: both submission arms and test rows. - transaction.rs, tx_builder.rs: main's txn_attempts loops, with this branch's request-governance argument on every stage_plan / stage_all call.
Pre-releases had no Homebrew path. The tap job skipped them, and turning on dist's
publish-prereleaseswould have written each pre-release overfluree.rb, moving everybrew upgradeuser onto the beta.What changes. The tap gets a second formula,
fluree-beta, which follows the newest release, pre-release or stable. A pre-release tag updates onlyfluree-beta. A stable tag updates both, so beta users move to the stable release once it supersedes their beta.flureestays on stable releases.fluree-betais keg-only: it installs besideflureewithout replacing the one onPATH, and users run it as"$(brew --prefix fluree/tap/fluree-beta)/bin/fluree"or put itsbinfirst inPATH. That suits comparing a beta with the stable release and going back. The name can't befluree@beta, because Homebrew only turns@into a valid class name when a digit follows it.How the job works.
Formula/, which would have overwritten the stablefluree.rbin a pre-release run.FlureeBeta, akeg_onlyline and its owndesc. The job fails unless both the rename and thekeg_onlyline happened, so a change in dist's formula can't publish afluree-betathat Homebrew links.brew style --fixunder aFormula/directory, since Homebrew applies its formula cops by path, so the stable formula gets the same fixes as before.4.xrelease after a5.0.0-betafromnext, leaves the newer formula in place. A re-run that changes nothing makes no commit.Verified. I ran the job's script, taken straight from this workflow, in an
ubuntu:22.04container against a copy of the real tap, with the beta.2 formula from its GitHub release. The cases: a pre-release commit touches onlyFormula/fluree-beta.rb; re-running it makes no commit; a stable release moves both formulae; an older stable re-run leaves both alone; a5.0.0-beta.1and then a stable4.2.5leavefluree-betaat 5.0.0-beta.1; and a push that lost a race to another commit succeeded on retry.Separately, Homebrew installed the generated
fluree-beta(beta.2) from a local tap beside an installedfluree4.2.3.flureeonPATHstayed 4.2.3, the keg reported 4.2.4-beta.2, and Homebrew printed the keg-only caveat.actionlintpasses with CI's flags.The job only runs on a tag. This merges before
v4.2.4is tagged, so the stable 4.2.4 release is its first real run: it movesflureeto 4.2.4 and createsfluree-betaat 4.2.4. A tag runs the workflow file at the tagged commit, so a failed run can't be fixed by re-running; the fallback is a hand commit to the tap, as for 4.1.5. The tap's own README still mentions onlyfluree.