diff --git a/internal/pipe/docker/docker.go b/internal/pipe/docker/docker.go index 0e54d810b..c91f82ed0 100644 --- a/internal/pipe/docker/docker.go +++ b/internal/pipe/docker/docker.go @@ -11,7 +11,6 @@ import ( "github.com/apex/log" "github.com/goreleaser/goreleaser/internal/artifact" - "github.com/goreleaser/goreleaser/internal/deprecate" "github.com/goreleaser/goreleaser/internal/pipe" "github.com/goreleaser/goreleaser/internal/semerrgroup" "github.com/goreleaser/goreleaser/internal/tmpl" @@ -35,27 +34,6 @@ func (Pipe) Default(ctx *context.Context) error { for i := range ctx.Config.Dockers { var docker = &ctx.Config.Dockers[i] - if docker.Image != "" { - deprecate.Notice("docker.image") - deprecate.Notice("docker.tag_templates") - - if len(docker.TagTemplates) == 0 { - docker.TagTemplates = []string{"{{ .Version }}"} - } - - for _, tag := range docker.TagTemplates { - docker.ImageTemplates = append( - docker.ImageTemplates, - fmt.Sprintf("%s:%s", docker.Image, tag), - ) - } - } - - if docker.Binary != "" { - deprecate.Notice("docker.binary") - docker.Binaries = append(docker.Binaries, docker.Binary) - } - if docker.Goos == "" { docker.Goos = "linux" } @@ -80,7 +58,7 @@ func (Pipe) Default(ctx *context.Context) error { // Run the pipe func (Pipe) Run(ctx *context.Context) error { - if len(ctx.Config.Dockers) == 0 || missingImage(ctx) { + if len(ctx.Config.Dockers) == 0 || len(ctx.Config.Dockers[0].ImageTemplates) == 0 { return pipe.Skip("docker section is not configured") } _, err := exec.LookPath("docker") @@ -101,10 +79,6 @@ func (Pipe) Publish(ctx *context.Context) error { return nil } -func missingImage(ctx *context.Context) bool { - return ctx.Config.Dockers[0].Image == "" && len(ctx.Config.Dockers[0].ImageTemplates) == 0 -} - func doRun(ctx *context.Context) error { var g = semerrgroup.New(ctx.Parallelism) for _, docker := range ctx.Config.Dockers { diff --git a/internal/pipe/docker/docker_test.go b/internal/pipe/docker/docker_test.go index 5ad8bd774..b42392add 100644 --- a/internal/pipe/docker/docker_test.go +++ b/internal/pipe/docker/docker_test.go @@ -169,12 +169,11 @@ func TestRunPipe(t *testing.T) { ImageTemplates: []string{ registry + "goreleaser/multiplefiles2:latest", }, - Goos: "linux", - Goarch: "amd64", - Dockerfile: "testdata/Dockerfile", - Binaries: []string{"mybin"}, - TagTemplates: []string{"latest"}, - Files: []string{"testdata/extra_file.txt"}, + Goos: "linux", + Goarch: "amd64", + Dockerfile: "testdata/Dockerfile", + Binaries: []string{"mybin"}, + Files: []string{"testdata/extra_file.txt"}, }, }, expect: []string{ @@ -572,11 +571,7 @@ func TestRunPipe(t *testing.T) { } for _, d := range docker.dockers { - if d.ImageTemplates == nil { - docker.assertImageLabels(tt, len(d.TagTemplates)) - } else { - docker.assertImageLabels(tt, len(d.ImageTemplates)) - } + docker.assertImageLabels(tt, len(d.ImageTemplates)) } // this might should not fail as the image should have been created when @@ -685,7 +680,7 @@ func TestDefaultBinaries(t *testing.T) { Config: config.Project{ Dockers: []config.Docker{ { - Binary: "foo", + Binaries: []string{"foo"}, }, }, }, @@ -730,31 +725,6 @@ func TestDefaultSet(t *testing.T) { assert.Equal(t, "Dockerfile.foo", docker.Dockerfile) } -func TestDefaultWithImage(t *testing.T) { - var ctx = &context.Context{ - Config: config.Project{ - Dockers: []config.Docker{ - { - Goos: "windows", - Goarch: "i386", - Binaries: []string{"bar"}, - Dockerfile: "Dockerfile.foo", - Image: "my/image", - }, - }, - }, - } - assert.NoError(t, Pipe{}.Default(ctx)) - assert.Len(t, ctx.Config.Dockers, 1) - var docker = ctx.Config.Dockers[0] - assert.Equal(t, "windows", docker.Goos) - assert.Equal(t, "i386", docker.Goarch) - assert.Equal(t, "bar", docker.Binaries[0]) - assert.Equal(t, []string{"{{ .Version }}"}, docker.TagTemplates) - assert.Equal(t, "Dockerfile.foo", docker.Dockerfile) - assert.Equal(t, []string{"my/image:{{ .Version }}"}, docker.ImageTemplates) -} - func Test_processImageTemplates(t *testing.T) { var ctx = &context.Context{ Config: config.Project{ diff --git a/pkg/config/config.go b/pkg/config/config.go index 37da254bb..0555fe029 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -262,16 +262,13 @@ type Checksum struct { // Docker image config type Docker struct { - Binary string `yaml:",omitempty"` Binaries []string `yaml:",omitempty"` Goos string `yaml:",omitempty"` Goarch string `yaml:",omitempty"` Goarm string `yaml:",omitempty"` - Image string `yaml:",omitempty"` Dockerfile string `yaml:",omitempty"` ImageTemplates []string `yaml:"image_templates,omitempty"` SkipPush string `yaml:"skip_push,omitempty"` - TagTemplates []string `yaml:"tag_templates,omitempty"` Files []string `yaml:"extra_files,omitempty"` BuildFlagTemplates []string `yaml:"build_flag_templates,omitempty"` } diff --git a/www/content/deprecations.md b/www/content/deprecations.md index f75bdab44..2028927c2 100644 --- a/www/content/deprecations.md +++ b/www/content/deprecations.md @@ -196,9 +196,13 @@ archives: format: zip ``` +## Expired deprecation notices + +The following options were deprecated for ~6 months and are now fully removed. + ### docker.binary -> since 2018-10-01 +> since 2018-10-01, removed 2019-08-02 You can now create a Docker image with multiple binaries. @@ -221,7 +225,7 @@ dockers: ### docker.image -> since 2018-10-20 +> since 2018-10-20, removed 2019-08-02 This property was deprecated in favor of more flexible `image_templates`. The idea is to be able to define several images and tags using templates instead of just one image with tag templates. @@ -246,7 +250,7 @@ dockers: ### docker.tag_templates -> since 2018-10-20 +> since 2018-10-20, removed 2019-08-02 This property was deprecated in favor of more flexible `image_templates`. The idea is to be able to define several images and tags using templates instead of just one image with tag templates. @@ -268,10 +272,6 @@ dockers: - 'foo/bar:{{ .Tag }}' ``` -## Expired deprecation notices - -The following options were deprecated for ~6 months and are now fully removed. - ### git.short_hash > since 2018-10-03, removed 2019-01-19