mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-03-19 20:57:53 +02:00
refactor: fixed docker pipe
This commit is contained in:
parent
32fbebcc58
commit
3cfa0787b3
@ -32,20 +32,21 @@ func (Pipe) String() string {
|
|||||||
// Default sets the pipe defaults
|
// Default sets the pipe defaults
|
||||||
func (Pipe) Default(ctx *context.Context) error {
|
func (Pipe) Default(ctx *context.Context) error {
|
||||||
for i := range ctx.Config.Dockers {
|
for i := range ctx.Config.Dockers {
|
||||||
if ctx.Config.Dockers[i].TagTemplate == "" {
|
var docker = &ctx.Config.Dockers[i]
|
||||||
ctx.Config.Dockers[i].TagTemplate = "{{ .Version }}"
|
if docker.TagTemplate == "" {
|
||||||
|
docker.TagTemplate = "{{ .Version }}"
|
||||||
|
}
|
||||||
|
if docker.Goos == "" {
|
||||||
|
docker.Goos = "linux"
|
||||||
|
}
|
||||||
|
if docker.Goarch == "" {
|
||||||
|
docker.Goarch = "amd64"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// only set defaults if there is exacly 1 docker setup in the config file.
|
// only set defaults if there is exacly 1 docker setup in the config file.
|
||||||
if len(ctx.Config.Dockers) != 1 {
|
if len(ctx.Config.Dockers) != 1 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if ctx.Config.Dockers[0].Goos == "" {
|
|
||||||
ctx.Config.Dockers[0].Goos = "linux"
|
|
||||||
}
|
|
||||||
if ctx.Config.Dockers[0].Goarch == "" {
|
|
||||||
ctx.Config.Dockers[0].Goarch = "amd64"
|
|
||||||
}
|
|
||||||
if ctx.Config.Dockers[0].Binary == "" {
|
if ctx.Config.Dockers[0].Binary == "" {
|
||||||
ctx.Config.Dockers[0].Binary = ctx.Config.Builds[0].Binary
|
ctx.Config.Dockers[0].Binary = ctx.Config.Builds[0].Binary
|
||||||
}
|
}
|
||||||
@ -70,12 +71,13 @@ func (Pipe) Run(ctx *context.Context) error {
|
|||||||
func doRun(ctx *context.Context) error {
|
func doRun(ctx *context.Context) error {
|
||||||
// TODO: could be done in parallel.
|
// TODO: could be done in parallel.
|
||||||
for _, docker := range ctx.Config.Dockers {
|
for _, docker := range ctx.Config.Dockers {
|
||||||
|
log.WithField("docker", docker).Debug("looking for binaries matching")
|
||||||
var binaries = ctx.Artifacts.Filter(
|
var binaries = ctx.Artifacts.Filter(
|
||||||
artifact.And(
|
artifact.And(
|
||||||
artifact.ByGoos(docker.Goos),
|
artifact.ByGoos(docker.Goos),
|
||||||
artifact.ByGoarch(docker.Goarch),
|
artifact.ByGoarch(docker.Goarch),
|
||||||
artifact.ByGoarm(docker.Goarm),
|
artifact.ByGoarm(docker.Goarm),
|
||||||
// artifact.ByType(artifact.Binary),
|
artifact.ByType(artifact.Binary),
|
||||||
func(a artifact.Artifact) bool {
|
func(a artifact.Artifact) bool {
|
||||||
return a.Extra["Binary"] == docker.Binary
|
return a.Extra["Binary"] == docker.Binary
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user