Skip to content

Commit

Permalink
fix: docker: skip push skips other builds (#1177)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
caarlos0 committed Oct 6, 2019
1 parent d338cf7 commit 792b883
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 1 deletion.
2 changes: 1 addition & 1 deletion internal/pipe/docker/docker.go
Expand Up @@ -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 {
Expand Down
30 changes: 30 additions & 0 deletions internal/pipe/docker/docker_test.go
Expand Up @@ -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{
{
Expand Down Expand Up @@ -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{
Expand Down
2 changes: 2 additions & 0 deletions internal/pipe/docker/testdata/Dockerfile.false
@@ -0,0 +1,2 @@
FROM alpine
RUN false
2 changes: 2 additions & 0 deletions internal/pipe/docker/testdata/Dockerfile.true
@@ -0,0 +1,2 @@
FROM alpine
RUN true

0 comments on commit 792b883

Please sign in to comment.