this will create a metadata artifact and allow to add them to the
release.
closes#4669closes#4682
---------
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
This PR adds retry logic to the process of cloning a git repository.
Currently, it retries only if the output of the git clone command
contains the string `Connection reset`.
Probably, there are more cases where retry is reasonable, but I'm not
sure what they are.
The number of retries is hardcoded to 10 with increasing delay between
retries — in the same way as it is done in #4265, which served me as an
example.
The initial use case is described in #4724.
- using the sha256 of the git url as repo name so we avoid race
conditions
- actually made the git client have a global lock so it doesn't step
over itself
closes#4679
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
<!--
Hi, thanks for contributing!
Please make sure you read our CONTRIBUTING guide.
Also, add tests and the respective documentation changes as well.
-->
<!-- If applied, this commit will... -->
Allow for using a projectID for a gitlab homebrew tap destination. There
are still some issues here because I can't use our full project name but
one step at a time.
<!-- Why is this change being made? -->
According to the goreleaser [gitlab
doc](https://goreleaser.com/customization/release/#gitlab), gitlab's
project IDs are supported. Before this change that isn't true for
homebrew formulas.
<!-- # Provide links to any relevant tickets, URLs or other resources
-->
Some conversation here:
https://github.com/goreleaser/goreleaser/issues/4664#issuecomment-1986056251.
Co-authored-by: Brad Reynolds <brad@shipium.com>
Co-authored-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
<!--
Hi, thanks for contributing!
Please make sure you read our CONTRIBUTING guide.
Also, add tests and the respective documentation changes as well.
-->
<!-- If applied, this commit will... -->
...
<!-- Why is this change being made? -->
...
<!-- # Provide links to any relevant tickets, URLs or other resources
-->
...
Signed-off-by: standstaff <zhengxingru@yeah.net>
Use the latest schema `1.6.0` available on winget-pkgs.
The new schema supports some new fields, but they do not affect
goreleaser. Hence, this PR is safe to merge, like
https://github.com/goreleaser/goreleaser/pull/4298 was 👍🏻
The PR refactors tests:
- change two lines `require.Error + require.Contains` with one
`require.ErrorContains`;
- change `require.Error + require.Equal` with `require.EqualError`.
Previously end-users would see missing artifacts if trying to use latest
version while artifacts are being uploaded.
This currently applies only to GitHub releases. GitLab does not support
drafts, and I don't dare to make the change for Gitea since I don't use
it (and can't test easily).
---------
Co-authored-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
refs #4630
<!--
Hi, thanks for contributing!
Please make sure you read our CONTRIBUTING guide.
Also, add tests and the respective documentation changes as well.
-->
<!-- If applied, this commit will... -->
...
<!-- Why is this change being made? -->
...
<!-- # Provide links to any relevant tickets, URLs or other resources
-->
...
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
The PR fixes lint issues, pins `golangci-lint` to `v1.56.2`, disables
`only-new-issues`, and enables `fail-on-issues` in the lint workflow.
After this, all new lint issues will fail CI.
The full log of fixed lint issues:
```sh
❯ golangci-lint run
cmd/docs.go:24:14: unused-parameter: parameter 'cmd' seems to be unused, consider removing or renaming it as _ (revive)
RunE: func(cmd *cobra.Command, args []string) error {
^
cmd/man.go:26:14: unused-parameter: parameter 'cmd' seems to be unused, consider removing or renaming it as _ (revive)
RunE: func(cmd *cobra.Command, args []string) error {
^
cmd/healthcheck.go:36:14: unused-parameter: parameter 'cmd' seems to be unused, consider removing or renaming it as _ (revive)
RunE: func(cmd *cobra.Command, args []string) error {
^
cmd/build.go:72:33: unused-parameter: parameter 'cmd' seems to be unused, consider removing or renaming it as _ (revive)
RunE: timedRunE("build", func(cmd *cobra.Command, args []string) error {
^
cmd/schema.go:29:14: unused-parameter: parameter 'cmd' seems to be unused, consider removing or renaming it as _ (revive)
RunE: func(cmd *cobra.Command, args []string) error {
^
internal/pipe/nix/nix_test.go:547:5: error-is-as: second argument to require.ErrorAs should not be *error (testifylint)
require.ErrorAs(t, err, &tt.expectDefaultErrorIs)
^
internal/pipe/nix/nix_test.go:556:5: error-is-as: second argument to require.ErrorAs should not be *error (testifylint)
require.ErrorAs(t, err, &tt.expectRunErrorIs)
^
internal/pipe/nix/nix_test.go:567:5: error-is-as: second argument to require.ErrorAs should not be *error (testifylint)
require.ErrorAs(t, err, &tt.expectPublishErrorIs)
^
internal/pipe/winget/winget_test.go:709:5: error-is-as: second argument to require.ErrorAs should not be *error (testifylint)
require.ErrorAs(t, err, &tt.expectPublishErrorIs)
^
internal/pipe/winget/winget_test.go:728:5: error-is-as: second argument to require.ErrorAs should not be *error (testifylint)
require.ErrorAs(t, err, &tt.expectPublishErrorIs)
^
internal/pipe/docker/docker_test.go:56:29: unused-parameter: parameter 'use' seems to be unused, consider removing or renaming it as _ (revive)
return func(t *testing.T, use string) {
^
internal/gio/safe_test.go:23:4: go-require: require must only be used in the goroutine running the test function (testifylint)
require.Equal(t, 1, s)
^
internal/gio/safe_test.go:24:4: go-require: require must only be used in the goroutine running the test function (testifylint)
require.NoError(t, err)
^
internal/pipe/gomod/gomod_proxy_test.go:126:3: useless-assert: asserting of the same variable (testifylint)
require.Equal(t, ctx.ModulePath, ctx.ModulePath)
^
internal/pipe/gomod/gomod_proxy_test.go:152:3: useless-assert: asserting of the same variable (testifylint)
require.Equal(t, ctx.ModulePath, ctx.ModulePath)
^
internal/pipe/gomod/gomod_proxy_test.go:178:3: useless-assert: asserting of the same variable (testifylint)
require.Equal(t, ctx.ModulePath, ctx.ModulePath)
^
internal/pipe/gomod/gomod_proxy_test.go:239:3: useless-assert: asserting of the same variable (testifylint)
require.Equal(t, ctx.ModulePath, ctx.ModulePath)
^
internal/artifact/artifact_test.go:638:46: unused-parameter: parameter 'a' seems to be unused, consider removing or renaming it as _ (revive)
require.EqualError(t, artifacts.Visit(func(a *Artifact) error {
^
internal/pipe/milestone/milestone.go:79: File is not `gofumpt`-ed (gofumpt)
internal/http/http_test.go:217:19: unused-parameter: parameter 'k' seems to be unused, consider removing or renaming it as _ (revive)
assetOpen = func(k string, a *artifact.Artifact) (*asset, error) {
^
internal/middleware/logging/logging_test.go:12:37: unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
require.NoError(t, Log("foo", func(ctx *context.Context) error {
^
internal/middleware/logging/logging_test.go:16:40: unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
require.NoError(t, PadLog("foo", func(ctx *context.Context) error {
^
internal/pipe/chocolatey/chocolatey_test.go:277:15: unused-parameter: parameter 'cmd' seems to be unused, consider removing or renaming it as _ (revive)
exec: func(cmd string, args ...string) ([]byte, error) {
^
internal/client/gitlab.go:325: File is not `gofumpt`-ed (gofumpt)
internal/pipe/linkedin/client_test.go:58:77: unused-parameter: parameter 'req' seems to be unused, consider removing or renaming it as _ (revive)
server := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
^
internal/middleware/errhandler/error_test.go:15:34: unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
require.NoError(t, Handle(func(ctx *context.Context) error {
^
internal/middleware/errhandler/error_test.go:21:34: unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
require.NoError(t, Handle(func(ctx *context.Context) error {
^
internal/middleware/errhandler/error_test.go:27:32: unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
require.Error(t, Handle(func(ctx *context.Context) error {
^
internal/middleware/errhandler/error_test.go:36:37: unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
require.NoError(t, memo.Wrap(func(ctx *context.Context) error {
^
internal/middleware/errhandler/error_test.go:42:37: unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
require.NoError(t, memo.Wrap(func(ctx *context.Context) error {
^
internal/middleware/errhandler/error_test.go:48:37: unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
require.NoError(t, memo.Wrap(func(ctx *context.Context) error {
^
internal/pipe/ko/ko.go:175:29: unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
build.WithBaseImages(func(ctx stdctx.Context, s string) (name.Reference, build.Result, error) {
^
```
<!--
Hi, thanks for contributing!
Please make sure you read our CONTRIBUTING guide.
Also, add tests and the respective documentation changes as well.
-->
<!-- If applied, this commit will... -->
...
<!-- Why is this change being made? -->
...
<!-- # Provide links to any relevant tickets, URLs or other resources
-->
...
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
<!--
Hi, thanks for contributing!
Please make sure you read our CONTRIBUTING guide.
Also, add tests and the respective documentation changes as well.
-->
<!-- If applied, this commit will... -->
...
<!-- Why is this change being made? -->
...
<!-- # Provide links to any relevant tickets, URLs or other resources
-->
...
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
<!--
Hi, thanks for contributing!
Please make sure you read our CONTRIBUTING guide.
Also, add tests and the respective documentation changes as well.
-->
<!-- If applied, this commit will... -->
Fix the order in which brew artifacts are sorted.
<!-- Why is this change being made? -->
* The order occasionally switches, which results in a larger diff:
https://github.com/confluentinc/homebrew-tap/pull/41
* The artifacts are already grouped by OS before `lessFnFor()` is
called, so `list[i].OS > list[j].OS` always evaluates to `false` and the
order remains unchanged. This PR removes that statement.
* It looks like a `map` is used earlier, while filtering the artifacts,
which might explain why the order occasionally switches.
* Update the remaining statement in `lessFnFor()` to actually use `<` as
the function suggests.
<!-- # Provide links to any relevant tickets, URLs or other resources
-->
This adds `nfpm.libdirs` to allow to set where to put libraries built,
as well as include them in the search for artifacts when building the
package.
closes#4346
---
PS: I'm not sure about the default dirs, let me know what you think!
---------
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
this could potentially leak environment variables.
closes GHSA-h3q2-8whx-c29h
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
Logs when no artifacts were found, and also allow to publish source
archives.
refs https://github.com/orgs/goreleaser/discussions/4585
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
## If applied, this commit will...
If applied this change will allow goreleaser to handle relative remotes
when attempting to parse a repo URL from git.
## Why is this change being made?
To fix the error that I recently came across while trying to test my
goreleaser configuration:
```
% goreleaser check
• checking path=
⨯ configuration is invalid error=invalid scm url: .
⨯ .goreleaser.yml error=configuration is invalid: invalid scm url: .
⨯ command failed error=1 out of 1 configuration file(s) have issues
```
This change happened while on a branch doing some development. As part
of that development I needed to test a change to my goreleaser config.
My git config at the time looked like (repo obfuscated):
```
% cat .git/config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = git@gitlab.com:some/repo
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "main"]
remote = origin
merge = refs/heads/main
[branch "release_fixes"]
remote = .
merge = refs/heads/main
```
It is fairly common for git to add remotes with a `.` when branch
tracking is enabled.
While, in general, there aren't many use cases that require a user to
need to release from a non-primary branch, there are cases where the
user may want to test their configuration with `goreleaser check` and
the error of `invalid scm url: .` isn't very helpful.
---------
Co-authored-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
- use stdenvNoCC instead of pkgs.stdenvNoCC
- always include stdenvNoCC, even if no deps
- use stdenvNoCC.is(Darwin/Linux) instead of stdenv's
refs #4358
refs 003a8815
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
From the Go specification [^1]:
> "3. If the map is nil, the number of iterations is 0."
Therefore, it is not required to do a nil check for the map before the
loop.
[^1]: https://go.dev/ref/spec#For_range
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
- refactors brew template into separated files using embed.FS
- moves the macos and linux packages to different template files
- includes and indent those accordingly to which OSes are supported
closes#4561
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>