- improves deprecation warning styles a bit so they caught the readers
eye faster and are easier to read
- warns if the user uses `builds.target` in conjunction with other
options which are ignored in that case
- improved env output
- improved no configuration found warning
some of the changes:
<img width="1263" alt="CleanShot 2023-07-24 at 21 38 41@2x"
src="https://github.com/goreleaser/goreleaser/assets/245435/40465853-7177-44d6-b07b-61b67590669a">
---------
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
We have been using `t.Setenv` is most of our tests. This PR replaces the
remaining `os.Setenv` with `t.Setenv`.
Reference: https://pkg.go.dev/testing#T.Setenv
```go
func TestFoo(t *testing.T) {
// before
os.Setenv(key, "new value")
defer os.Unsetenv(key)
// after
t.Setenv(key, "new value")
}
```
---------
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
closes#3989
Basically, when some of these pipes fail, the error will be memorized,
and all errors will be thrown in the end.
Meaning: the exit code will still be 1, but it'll not have stopped in
the first error.
Thinking of maybe adding a `--fail-fast` flag to disable this behavior
as well 🤔
---------
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
- deprecates `--debug` in favor of `--verbose` which is clearer
- improved some debug log outputs
- docs: update documentation to always use the `release` subcommand
(when it makes sense)
If you run `goreleaser build --single-target` with
`universalbinaries[*].replace = true` on a mac, it'll break.
This fixes it by disabling universal binaries when building a single
target.
It isn't useful anyway.
Closes#4004
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
using the same output as most cloud-native Go-written CLI's use, i.e.
using
[sigs.k8s.io/release-utils](https://github.com/kubernetes-sigs/release-utils).
---------
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.
-->
Currently Goreleaser uses `runtime.NumCPU()` as the default value if
`--parallelism` is not set.
However, this will get the number of CPUs on the host even when
Goreleaser is run in a container with a limit on the maximum number of
CPUs that can be used (typically in a Kubernetes pod).
Actually, `docker run --cpus=1 goreleaser/goreleaser --debug` shows
`parallelism: 4` on my machine.
This behavior causes CPU throttling, which increases execution time and,
in the worst case, terminates with an error.
I ran into this problem with Jenkins where the agent runs on pod
([Kubernetes plugin for
Jenkins](https://plugins.jenkins.io/kubernetes/)).
This commit introduces
[automaxprocs](https://github.com/uber-go/automaxprocs) to fix this
issue.
This library sets `GOMAXPROCS` to match Linux container CPU quota.
I have also looked for a library that can get CPU quota more directly,
but this seems to be the best I could find.
The reason it is set in a different notation from the automaxprocs
README is to prevent logs from being displayed
([comment](https://github.com/uber-go/automaxprocs/issues/18#issuecomment-511330567)).
I would have liked to write a test, but this change is dependent on the
number of CPUs in the execution environment, so I could not.
Instead, I wrote a Dockerfile for testing
```Dockerfile
FROM golang:1.20.2
WORKDIR /go/app
RUN sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin
COPY . .
RUN task build
```
and confirmed built binary shows expected parallelism by following
commands:
```sh
docker build --file Dockerfile.test . -t test-goreleaser
docker run --cpus=1 test-goreleaser ./goreleaser build --snapshot --debug # parallelism: 1
docker run test-goreleaser ./goreleaser build --snapshot --debug # parallelism: 4
```
I also ran the built binary on my Macbook and it was fine.
here's an idea: `goreleaser healthcheck`
It'll check if the needed dependencies (docker, git, etc) are available
in the path... this way users can preemptively run it before releasing
or to debug issues.
What do you think?
Here's how it looks like:
<img width="1007" alt="CleanShot 2023-03-02 at 23 24 26@2x"
src="https://user-images.githubusercontent.com/245435/222615682-d9cd0733-d900-43d1-9166-23b2be589b3a.png">
---------
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
alternative to #3806
the idea is that both `context.New` and `context.Context{}` are never
used in tests.
not sure yet how much I like it, so far code does look a bit more
readable though.
---------
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
update everything to go 1.20
---------
Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
- improved how we handle `--rm-dist` deprecation so it looks more like
other deprecations
- improved deprecation error message a bit as well
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
After talking with @perylemke, we realized that probably most people
will likely expect it to be called --clean instead of --rm-dist, as its
more similar to the popular `make clean` task.
This adds the --clean flag, and make the --rm-dist one deprecated.
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
continuing the PR by @developer-guy
- [x] should be a publisher, as it does publish the images it builds
every time
- [x] `Default` method does not work
- [x] the `fromConfig` thing should probably be on the defaults, too
- [x] wire `--skip-ko`
- [x] documentation
- [x] more tests
- [x] use same registry as docker tests does
- [ ] see if we can make the log output match goreleaser's
- [ ] ??
closes#2556closes#3490
Signed-off-by: Batuhan Apaydın <batuhan.apaydin@trendyol.com>
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
Co-authored-by: actions-user <actions@github.com>
Co-authored-by: Jason Hall <jason@chainguard.dev>
Co-authored-by: Batuhan Apaydın <batuhan.apaydin@trendyol.com>
The replacements thing was always a bit weird, especially on archives.
We can solve that with templates, so, removing I'm deprecating it.
Also did the same on other places that had it the same feature.
Closes#3588
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
When using specific targets in the config, single target becomes
ineffective. This should fix it. This also removes other build options
like gomips, goarm, goamd64, etc, as go will infer them from the current
OS. In theory we should one day support all the GO* flags go build
supports.
* feat(ci): compile with go 1.19
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
* test: fixing template test
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
* test: improve check
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
* fix: more test and docs fixes
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
* test: fix
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
* test: fix
* test: fix
* fix: lint
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
* test: docker templates
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
* fix: godoc for RequireTemplateError
Make it more clear that it will override whatever is defined in the yaml
config.
fix: clarifying build --single-target
Make it more clear that it will override whatever is defined in the yaml
config.
refs #3265
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
* fix: improve output on github actions
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
* fix: log
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
* test: force ascii
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
allows to load the config from stdin, so things like:
```sh
cat .goreleaser.yml | sed 's/something/else/g' | goreleaser release -f -
```
will now work.
closes#3125
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
* feat: added --skip-before flag
this would allow to skip global before hooks
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
* fix: skip docker test
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
Allow to skip the entire docker images and manifests builds.
Might be useful for faster local builds et al.
closes#3144
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
* refactory: improve cmd code
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
* fix: improve time reporting
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
* fix: improve artifacts json
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
* fix: improve artifacts json
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
* fix: diffs
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
* docs: improve root cmd help
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
* feat: replacing logs
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
* fix: tests et al
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
* feat: update termenv/lipgloss
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
* wip: output
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
* fix: pin dep
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
* fix: update
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
* fix: tests
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
* fix: tests
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
* fix: deps
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
* fix: dep
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
* feat: update jsonschema library
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
* fix: test
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
now that cobra does not require a lot of unused deps because of viper anymore, we can migrate back to it.
Signed-off-by: Carlos A Becker <caarlos0@gmail.com>