1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-04-15 11:56:56 +02:00

clean: remove deprecated docker options (#1098)

* clean: remove deprecated docker options

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* ci: gocenter is slowwww

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* clean: remove uneeded test

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* Revert "ci: gocenter is slowwww"

This reverts commit 7e4b1eb244c3d3508d0b5dae7b8d33ff5b8e85ab.
This commit is contained in:
Carlos Alexandro Becker 2019-08-02 21:03:54 -03:00 committed by GitHub
parent 7cab12cf74
commit 516c348f6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 74 deletions

View File

@ -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 {

View File

@ -173,7 +173,6 @@ func TestRunPipe(t *testing.T) {
Goarch: "amd64",
Dockerfile: "testdata/Dockerfile",
Binaries: []string{"mybin"},
TagTemplates: []string{"latest"},
Files: []string{"testdata/extra_file.txt"},
},
},
@ -572,12 +571,8 @@ 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))
}
}
// this might should not fail as the image should have been created when
// the step ran
@ -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{

View File

@ -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"`
}

View File

@ -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