Repository navigation
Use postflight_steps for the thv Homebrew cask hook - #6870
Merged
Merged
Conversation
Homebrew 7.0.10 deprecated the Ruby postflight block that hooks.post.install generates, so every stacklok/tap user sees a warning whenever brew loads the thv cask. Write the quarantine-removal hook as a postflight_steps stanza via custom_block instead. GoReleaser's own install_steps option would generate the same stanza, but it is not in a stable release yet. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Use the same xattr -dr call with Homebrew's staged_path token that GoReleaser's install_steps generates. -dr exits 0 when the attribute is absent, so real failures are no longer masked by must_succeed: false, and the later switch to install_steps changes only the stanza's position in the cask. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6870 +/- ##
==========================================
- Coverage 79.81% 79.77% -0.05%
==========================================
Files 820 820
Lines 83723 83723
==========================================
- Hits 66826 66788 -38
- Misses 16892 16930 +38
Partials 5 5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This was referenced Oct 20, 2026
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.
Summary
Homebrew 7.0.10 deprecated the Ruby
postflightblock in casks in favour ofpostflight_steps. Ourthvcask usespostflightto remove macOS's quarantine flag, so everystacklok/tapuser now sees this whenever brew loads the cask (brew update,brew list,brew upgrade,brew info):GoReleaser's
hooks.post.installcan only generate the oldpostflightblock. Its replacement,install_steps, is only in v2.19 nightlies, and the v2.18 our releases use rejects it.hooks.post.installwith acustom_blockthat writes the same quarantine removal as apostflight_stepsstanza, on macOS only.install_stepsgenerates (goreleaser/goreleaser@4ebadf5):run "/usr/bin/xattr", args: ["-dr", "com.apple.quarantine", "{{staged_path}}/thv"].{{staged_path}}is a Homebrew token. It is escaped in.goreleaser.yamlso GoReleaser's own templating leaves it alone.Type of change
Test plan
Manual testing (describe below)
goreleaser checkpasses on v2.15.4 and v2.18.3. Agoreleaser release --snapshotwith v2.18.3 writes a cask whose first stanza ispostflight_steps, with nopostflight.On macOS arm64 with Homebrew 7.0.10, I installed throwaway casks from a local test tap using the v0.55.1 release tarballs:
com.apple.quarantine. This confirms the hook is still needed.postflight_steps: no deprecation warning on install orbrew info, the quarantine flag is removed, andthv versionruns.custom_blockputs it: same result.-drwith{{staged_path}}): no warning, the quarantine flag is removed, andthvruns.xattr -drexits 0 when the flag is already gone, so the step has no failure mode beyond a genuinexattrerror.Does this introduce a user-facing change?
Yes, for Homebrew users.
postflightdeprecation warning whenever it loads thethvcask.This applies from the next release, which is when the regenerated cask reaches the tap.
Special notes for reviewers
postflight_stepsfirst shipped in Homebrew 5.1.14 (May 2026). On anything older the cask fails to load, rather than just warning. Homebrew updates itself by default, so this only affects users who disabled auto-update and haven't updated in about five months.custom_blockputs the stanza at the top of the cask.brew auditwould flag that order in an official tap, but install and upgrade don't care, and I tested that order specifically.on_macoswhen the step runs (Homebrew::SimulateSystem.simulating_or_running_on_macos?ininstall_steps.rb), so Linux skips the step. Intel Macs run the same/usr/bin/xattrcall as arm64. The stanza parses identically on every platform, since the DSL has no OS-specific methods.custom_blocktohooks.post.install_steps(using{{ .StagedPath }}). The generated stanza is identical. Only its position in the cask moves, to afterbinary. Notarizing the darwin builds would remove the need for the hook altogether.🤖 Generated with Claude Code