-
-
Notifications
You must be signed in to change notification settings - Fork 1k
fix(brew,nix): support txz, tgz, tzst, tar.zst #5746
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Deploying goreleaser with
|
Latest commit: |
3b34db5
|
Status: | ✅ Deploy successful! |
Preview URL: | https://1f7a2a17.goreleaser.pages.dev |
Branch Preview URL: | https://brew-tgz.goreleaser.pages.dev |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR extends Homebrew support to additional archive formats and updates tests accordingly.
- Updates artifact names and formats in tests to support txz, tgz, tzst, tar.zst
- Centralizes allowed archive formats in brew.go and updates corresponding error messages
Reviewed Changes
Copilot reviewed 2 out of 12 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
internal/pipe/brew/brew_test.go | Updates test artifacts with new archive formats and refines file creation logic |
internal/pipe/brew/brew.go | Introduces a centralized formats list and updates error messages and filtering logic |
Files not reviewed (10)
- internal/pipe/brew/testdata/TestFullPipe/custom_block.rb.golden: Language not supported
- internal/pipe/brew/testdata/TestFullPipe/custom_download_strategy.rb.golden: Language not supported
- internal/pipe/brew/testdata/TestFullPipe/custom_require.rb.golden: Language not supported
- internal/pipe/brew/testdata/TestFullPipe/default.rb.golden: Language not supported
- internal/pipe/brew/testdata/TestFullPipe/default_gitlab.rb.golden: Language not supported
- internal/pipe/brew/testdata/TestFullPipe/git_remote.rb.golden: Language not supported
- internal/pipe/brew/testdata/TestFullPipe/open_pr.rb.golden: Language not supported
- internal/pipe/brew/testdata/TestFullPipe/valid_repository_templates.rb.golden: Language not supported
- internal/pipe/brew/testdata/TestFullPipe/with_header.rb.golden: Language not supported
- internal/pipe/brew/testdata/TestFullPipe/with_many_headers.rb.golden: Language not supported
Comments suppressed due to low confidence (1)
internal/pipe/brew/brew_test.go:423
- [nitpick] Avoid shadowing the err variable if it is already defined; using assignment (err = runAll(ctx, client)) would maintain consistency in error handling.
err := runAll(ctx, client)
internal/pipe/brew/brew_test.go
Outdated
require.NoError(t, err) | ||
require.NoError(t, f.Close()) | ||
for _, a := range ctx.Artifacts.List() { | ||
if !strings.HasPrefix(a.Path, folder) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Consider using filepath.Rel to verify that the artifact path is within the test folder instead of strings.HasPrefix, to avoid potential false positives.
if !strings.HasPrefix(a.Path, folder) { | |
relPath, err := filepath.Rel(folder, a.Path) | |
require.NoError(t, err) | |
if strings.HasPrefix(relPath, "..") || filepath.IsAbs(relPath) { |
Copilot uses AI. Check for mistakes.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5746 +/- ##
=======================================
Coverage 82.93% 82.93%
=======================================
Files 161 161
Lines 15924 15928 +4
=======================================
+ Hits 13206 13210 +4
Misses 2144 2144
Partials 574 574 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
glad to help you spot this bug! thank you for the fix |
tested and the fix worked
before fix
same manifest: https://github.com/lfaoro/ssm/blob/main/.config/goreleaser.yaml |
@caarlos0 NIX has the same tgz issue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the archive format filtering logic to support additional archive types (txz, tgz, tzst, tar.zst) by excluding archives with a raw ".gz" format and adjusts related tests accordingly.
- Change archive filtering in both nix.go and brew.go from accepting only specific formats to excluding ".gz" formats.
- Update brew test cases and expected artifact counts to reflect the new supported formats.
- Introduce the Not filter in artifact.go to simplify negation of format filters.
Reviewed Changes
Copilot reviewed 5 out of 15 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
internal/pipe/nix/nix.go | Alters the filter to exclude archives with a "gz" format rather than only including zip and tar.gz archives. |
internal/pipe/brew/brew.go | Updates archive filtering logic similarly to nix.go using the new Not filter. |
internal/pipe/brew/brew_test.go | Adjusts test artifact names and implements a loop to create files for each artifact based on their path. |
internal/artifact/artifact_test.go | Updates expected counts for filtered artifacts to account for the newly supported archive formats. |
internal/artifact/artifact.go | Adds a new Not filter function for negating filters. |
Files not reviewed (10)
- internal/pipe/brew/testdata/TestFullPipe/custom_block.rb.golden: Language not supported
- internal/pipe/brew/testdata/TestFullPipe/custom_download_strategy.rb.golden: Language not supported
- internal/pipe/brew/testdata/TestFullPipe/custom_require.rb.golden: Language not supported
- internal/pipe/brew/testdata/TestFullPipe/default.rb.golden: Language not supported
- internal/pipe/brew/testdata/TestFullPipe/default_gitlab.rb.golden: Language not supported
- internal/pipe/brew/testdata/TestFullPipe/git_remote.rb.golden: Language not supported
- internal/pipe/brew/testdata/TestFullPipe/open_pr.rb.golden: Language not supported
- internal/pipe/brew/testdata/TestFullPipe/valid_repository_templates.rb.golden: Language not supported
- internal/pipe/brew/testdata/TestFullPipe/with_header.rb.golden: Language not supported
- internal/pipe/brew/testdata/TestFullPipe/with_many_headers.rb.golden: Language not supported
Comments suppressed due to low confidence (1)
internal/artifact/artifact_test.go:139
- [nitpick] The updated expected count for artifacts filtered by 'darwin' has increased. Please verify that this change is intentional and document the reasoning in the test or accompanying commit message to avoid future confusion.
require.Len(t, artifacts.Filter(ByGoos("darwin")).items, 3)
@@ -219,7 +219,7 @@ func preparePkg( | |||
artifact.ByGoarch("all"), | |||
), | |||
artifact.And( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure that using artifact.Not(artifact.ByFormats("gz")) correctly excludes only pure gzipped artifacts while allowing the supported archive formats such as txz, tgz, tzst, and tar.zst. Adding a brief comment to explain this filtering logic would improve code readability.
artifact.And( | |
artifact.And( | |
// Exclude pure .gz files while allowing supported archive formats like .tgz, .txz, .tzst, and .tar.zst. |
Copilot uses AI. Check for mistakes.
internal/pipe/brew/brew_test.go
Outdated
require.NoError(t, err) | ||
require.NoError(t, f.Close()) | ||
for _, a := range ctx.Artifacts.List() { | ||
if !strings.HasPrefix(a.Path, folder) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] When iterating over artifacts to create files, the check using strings.HasPrefix(a.Path, folder) should be reviewed to ensure it reliably identifies files in the intended directory; consider using a more robust path comparison if available.
if !strings.HasPrefix(a.Path, folder) { | |
relPath, err := filepath.Rel(folder, a.Path) | |
require.NoError(t, err) | |
if strings.HasPrefix(relPath, "..") { |
Copilot uses AI. Check for mistakes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates archive filter logic and test expectations to support additional archive formats (txz, tgz, tzst, tar.zst) while excluding raw gz, as well as adding a new Not filter helper.
- Replaces explicit format filtering (e.g., "tar.gz") with a more flexible exclusion of "gz" formats in both nix and brew pipelines.
- Updates tests to account for the additional archive artifacts and file creation.
- Introduces a Not() helper function to simplify filter expressions.
Reviewed Changes
Copilot reviewed 5 out of 15 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
internal/pipe/nix/nix.go | Replaces ByFormats("zip", "tar.gz") with Not(ByFormats("gz")) to exclude gz. |
internal/pipe/brew/brew_test.go | Updates test artifacts names and creates files for each artifact in a loop. |
internal/pipe/brew/brew.go | Updates archive filter to use Not(ByFormats("gz")) consistently. |
internal/artifact/artifact_test.go | Adjusts expected artifact counts in tests to reflect filtering changes. |
internal/artifact/artifact.go | Adds a new Not() helper function for filter negation. |
Files not reviewed (10)
- internal/pipe/brew/testdata/TestFullPipe/custom_block.rb.golden: Language not supported
- internal/pipe/brew/testdata/TestFullPipe/custom_download_strategy.rb.golden: Language not supported
- internal/pipe/brew/testdata/TestFullPipe/custom_require.rb.golden: Language not supported
- internal/pipe/brew/testdata/TestFullPipe/default.rb.golden: Language not supported
- internal/pipe/brew/testdata/TestFullPipe/default_gitlab.rb.golden: Language not supported
- internal/pipe/brew/testdata/TestFullPipe/git_remote.rb.golden: Language not supported
- internal/pipe/brew/testdata/TestFullPipe/open_pr.rb.golden: Language not supported
- internal/pipe/brew/testdata/TestFullPipe/valid_repository_templates.rb.golden: Language not supported
- internal/pipe/brew/testdata/TestFullPipe/with_header.rb.golden: Language not supported
- internal/pipe/brew/testdata/TestFullPipe/with_many_headers.rb.golden: Language not supported
Comments suppressed due to low confidence (5)
internal/pipe/brew/brew_test.go:394
- Replacing the single file creation with a loop to create files for all artifact paths improves test robustness. Consider adding assertions to verify file existence and properties to further strengthen test coverage.
for _, a := range ctx.Artifacts.List() {
internal/artifact/artifact_test.go:139
- The expected artifact count for 'darwin' artifacts has been updated from 2 to 3; ensure this new expectation accurately reflects the filtering changes introduced in this PR.
require.Len(t, artifacts.Filter(ByGoos("darwin")).items, 3)
internal/pipe/nix/nix.go:222
- The change to use Not(ByFormats("gz")) excludes artifacts whose format exactly equals 'gz' and aligns with the new requirement. Please verify that valid formats (e.g., 'tgz', 'txz', 'tar.zst') are not inadvertently filtered out.
artifact.Not(artifact.ByFormats("gz")),
internal/pipe/brew/brew.go:218
- Updating the archive filter to use Not(ByFormats("gz")) ensures consistency across pipelines. Please double-check that this exact match approach does not exclude any intended formats.
artifact.Not(artifact.ByFormats("gz")),
internal/artifact/artifact.go:603
- The addition of a Not() helper function simplifies filter negation and improves clarity. It would be beneficial to verify its behavior through existing tests to confirm it handles all expected edge cases.
func Not(filter Filter) Filter {
in reality, we just don't want
.gz
because its just the binary gzipped