1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2024-12-31 01:53:50 +02:00
Commit Graph

107 Commits

Author SHA1 Message Date
Carlos Alexandro Becker
4266634752
feat: improve output (#4206)
- 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>
2023-07-25 08:26:44 -03:00
Carlos Alexandro Becker
2a3009757a
test: fix init test
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2023-07-19 00:52:11 +00:00
Carlos Alexandro Becker
498931561d
feat: init improvements
- do not override an existing configuration file
- do not add `dist/` to the `.gitignore` if it already contains it

closes #4162
2023-07-18 12:21:09 +00:00
Carlos Alexandro Becker
7eb6af3839
fix: properly log file with issues on check 2023-07-11 18:25:33 +00:00
Carlos Alexandro Becker
9364d9983a
fix: improve log 2023-07-04 12:34:59 +00:00
Eng Zer Jun
73e59160de
test: use t.Setenv to set env vars (#4140)
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>
2023-06-25 09:54:10 -03:00
Carlos Alexandro Becker
72cf8404c1
feat: continue on error (#4127)
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>
2023-06-20 09:33:59 -03:00
Ville Skyttä
1c9b4d56b4
feat: completion improvements (#4071)
See individual commits for details.
2023-06-06 00:21:17 -03:00
Carlos Alexandro Becker
d0cf457136
feat: improve verbose output (#4017)
- 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)
2023-05-27 00:18:39 -03:00
Carlos Alexandro Becker
950cebee57
fix(cmd): check with no args 2023-05-24 03:32:37 +00:00
Carlos Alexandro Becker
cebdf0d8a6
fix: goreleaser build index out of range (#4007)
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>
2023-05-12 15:50:12 -03:00
Carlos Alexandro Becker
3707fe4d82
feat: allow to goreleaser check multiple files (#3980)
This will be more useful for goreleaser pro than for oss, but I thought
it might worth it having it in both versions.
2023-05-03 23:28:55 -03:00
Carlos Alexandro Becker
01e9810ab2
chore: thanks for using goreleaser! 2023-04-30 17:48:36 +00:00
Carlos Alexandro Becker
d62abe0b16
fix: pass goversion.Info instead of string
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2023-04-30 17:26:17 +00:00
Carlos Alexandro Becker
9aeea7b430
feat: new --version output (#3962)
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>
2023-04-30 14:19:55 -03:00
Carlos Alexandro Becker
a33a1871b0
refactor: improve method name
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2023-04-30 00:03:03 +00:00
Kazuki Matsumaru
b495c905d5
fix: set parallelism to match Linux container CPU (#3901)
<!--

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.
2023-04-02 17:16:41 -03:00
Carlos A Becker
4c44ecedf8
docs: updates
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
2023-03-03 12:57:54 -03:00
Carlos A Becker
68cd12b506
test: use ErrorIs
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
2023-03-03 10:36:45 -03:00
Carlos Alexandro Becker
874d698564
feat: add healthcheck cmd (#3826)
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>
2023-03-03 09:50:15 -03:00
Carlos Alexandro Becker
f544c5ce69
test: testctx pkg (#3807)
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>
2023-03-02 00:01:11 -03:00
Carlos Alexandro Becker
81914757da
build: use go1.20 (#3757)
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>
2023-02-05 13:39:39 -03:00
Carlos A Becker
b1dc5b8daf
chore: comment
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
2023-01-30 21:35:27 -03:00
Carlos Alexandro Becker
4954815ae4
fix: improve handling of --rm-dist deprecation (#3728)
- 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>
2023-01-29 00:24:11 -03:00
Carlos Alexandro Becker
d18adfb57e
feat: deprecate --rm-dist in favor of new --clean flag (#3702)
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>
2023-01-20 23:47:08 -03:00
Carlos Alexandro Becker
2450746e5c
feat: add ko support (#3653)
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 #2556
closes #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>
2023-01-16 22:34:49 -03:00
Carlos Alexandro Becker
da2335791a
fix: native changeloger without previous tag (#3668)
closes #3662

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
2022-12-29 10:41:59 -03:00
Carlos Alexandro Becker
e54656438b
feat: deprecate replacements (#3589)
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>
2022-11-25 15:26:14 -03:00
Carlos Alexandro Becker
6279e1a431
fix: annotate flags so they complete better (#3444) 2022-10-06 11:24:13 +02:00
Carlos Alexandro Becker
a8b3806e7e
refactory: making merges with pro easier (#3400)
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
2022-09-25 18:19:53 -03:00
Carlos Alexandro Becker
0ea3e0f572
fix: build --single-target when using specific targets (#3381)
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.
2022-09-15 22:17:40 -03:00
Carlos Alexandro Becker
8cb4eb1654
fix: ruleguard and semgrep scans and fixes (#3364)
run semgrep-go ruleguard and semgrep scans

https://github.com/dgryski/semgrep-go

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
2022-09-11 15:32:23 -03:00
Engin Diri
fac8135b6b
feat: add fig autocomplete support (#3329)
This PR releates to #3328 and fix the first part of the doings in the issue
2022-08-21 21:28:57 -03:00
Carlos A Becker
ce264f1fca
fix: jsonschema
very hacky, fixes #3238 for good

refs https://github.com/invopop/jsonschema/issues/26

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
2022-08-17 23:50:14 -03:00
Carlos Alexandro Becker
ee17c9583d
feat(ci): compile with go 1.19 (#3278)
* 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
2022-08-06 18:44:23 -03:00
Carlos A Becker
731f43b80e
test: fix test
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
2022-08-04 15:37:19 -03:00
Carlos A Becker
d22d67d923
fix: clarifying build --single-target
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>
2022-07-28 22:30:43 -03:00
Carlos Alexandro Becker
f24f1a0a70
fix: improve output on github actions (#3221)
* 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>
2022-07-04 16:12:24 -03:00
Carlos Alexandro Becker
cf3c758356
feat: allow multiple ids to be passed to build (#3212)
* Allow multiple ids to be passed to build

goreleaser build --id build 1 --id build2

* addressing cr

* addressing cr

* fix: rename to ids

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>

* fix: improve output

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>

Co-authored-by: JD <jdpcbs@gmail.com>
2022-06-28 23:37:38 -03:00
Carlos Alexandro Becker
4162772819
feat: allow to load config from stdin (#3175)
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>
2022-06-22 22:03:00 -03:00
Carlos Alexandro Becker
d79484ef1d
feat: added --skip-before flag (#3182)
* 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>
2022-06-22 21:56:53 -03:00
Carlos Alexandro Becker
ae399220ef
feat: add --skip-docker (#3176)
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>
2022-06-22 21:39:20 -03:00
Carlos Alexandro Becker
9efea360b9
refactory: make easier to manage merges with pro (#3178)
* 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>
2022-06-22 01:48:11 -03:00
Carlos Alexandro Becker
fe7e2123bd
feat: replacing the log library (#3139)
* 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>
2022-06-21 21:11:15 -03:00
Carlos Alexandro Becker
ad3c6fdcdd
feat: update jsonschema library (#3159)
* 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>
2022-06-12 22:31:30 -03:00
Carlos A Becker
d1291650f2
feat: migrate back to cobra
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>
2022-05-06 20:38:50 -03:00
Andreas Deininger
38bc6b504e
docs: fix typos (#3054) 2022-04-19 19:34:24 -03:00
Carlos A Becker
0ba753c496
fix: man pages
closes #3048

Signed-off-by: Carlos A Becker <caarlos0@gmail.com>
2022-04-16 15:31:43 -03:00
Carlos Alexandro Becker
ce9058ac8c
refactor: use context on git exec calls (#3032) 2022-04-12 08:35:19 -03:00
Carlos Alexandro Becker
3c4e797150
feat: upgrade to go 1.18 (#2978)
* feat: upgrade to go 1.18

* chore: go mod tidy

Signed-off-by: Carlos A Becker <caarlos0@gmail.com>

* test: fix

* fix: more updates

* test: fix test
2022-03-16 21:51:48 -03:00