Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: docker: skip push skips other builds #1177

Merged
merged 3 commits into from Oct 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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