mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-03-17 20:47:50 +02:00
fix: improve docker error handling (#726)
improved the case in which a docker image may be declared but have no binaries matching it (which can really happen) and the case of a binary + goos + goarch + goarm combination matching more than one binary (can't happen right now). Later it will just warn on the first case and do things wrong on the second, now it will error in both cases.
This commit is contained in:
parent
ee706ae502
commit
ce83c85bfc
@ -95,15 +95,14 @@ func doRun(ctx *context.Context) error {
|
||||
},
|
||||
),
|
||||
).List()
|
||||
if len(binaries) == 0 {
|
||||
log.Warnf("no binaries found for %s", docker.Binary)
|
||||
if len(binaries) != 1 {
|
||||
return fmt.Errorf(
|
||||
"%d binaries match docker definition: %s: %s_%s_%s",
|
||||
len(binaries),
|
||||
docker.Binary, docker.Goos, docker.Goarch, docker.Goarm,
|
||||
)
|
||||
}
|
||||
for _, binary := range binaries {
|
||||
if err := process(ctx, docker, binary, seed); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
return process(ctx, docker, binaries[0], seed)
|
||||
})
|
||||
}
|
||||
return g.Wait()
|
||||
|
@ -314,7 +314,7 @@ func TestRunPipe(t *testing.T) {
|
||||
Dockerfile: "testdata/Dockerfile",
|
||||
},
|
||||
},
|
||||
assertError: shouldNotErr,
|
||||
assertError: shouldErr(`0 binaries match docker definition: mybinnnn: darwin_amd64_`),
|
||||
},
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user