1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-03-17 20:47:50 +02:00

fix: docker: skip push skips other builds (#1177)

* fix: skip aware semerrgroup

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

* fix: docker: skip push skips other builds

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
This commit is contained in:
Carlos Alexandro Becker 2019-10-06 15:53:38 -03:00 committed by GitHub
parent d338cf7285
commit 792b883f59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 35 additions and 1 deletions

View File

@ -80,7 +80,7 @@ func (Pipe) Publish(ctx *context.Context) error {
}
func doRun(ctx *context.Context) error {
var g = semerrgroup.New(ctx.Parallelism)
var g = semerrgroup.NewSkipAware(semerrgroup.New(ctx.Parallelism))
for _, docker := range ctx.Config.Dockers {
docker := docker
g.Go(func() error {

View File

@ -232,6 +232,35 @@ func TestRunPipe(t *testing.T) {
assertImageLabels: noLabels,
assertError: testlib.AssertSkipped,
},
"one_img_error_with_skip_push": {
dockers: []config.Docker{
{
ImageTemplates: []string{
registry + "goreleaser/one_img_error_with_skip_push:true",
},
Goos: "linux",
Goarch: "amd64",
Dockerfile: "testdata/Dockerfile.true",
Binaries: []string{"mybin"},
SkipPush: "true",
},
{
ImageTemplates: []string{
registry + "goreleaser/one_img_error_with_skip_push:false",
},
Goos: "linux",
Goarch: "amd64",
Dockerfile: "testdata/Dockerfile.false",
Binaries: []string{"mybin"},
SkipPush: "true",
},
},
expect: []string{
registry + "goreleaser/one_img_error_with_skip_push:true",
},
assertImageLabels: noLabels,
assertError: shouldErr("failed to build docker image"),
},
"valid_no_latest": {
dockers: []config.Docker{
{
@ -531,6 +560,7 @@ func TestRunPipe(t *testing.T) {
Dist: dist,
Dockers: docker.dockers,
})
ctx.Parallelism = 1
ctx.Env = docker.env
ctx.Version = "1.0.0"
ctx.Git = context.GitInfo{

View File

@ -0,0 +1,2 @@
FROM alpine
RUN false

View File

@ -0,0 +1,2 @@
FROM alpine
RUN true