You've already forked goreleaser
mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-07-17 01:42:37 +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 7e4b1eb244
.
This commit is contained in:
committed by
GitHub
parent
7cab12cf74
commit
516c348f6e
@ -11,7 +11,6 @@ import (
|
|||||||
|
|
||||||
"github.com/apex/log"
|
"github.com/apex/log"
|
||||||
"github.com/goreleaser/goreleaser/internal/artifact"
|
"github.com/goreleaser/goreleaser/internal/artifact"
|
||||||
"github.com/goreleaser/goreleaser/internal/deprecate"
|
|
||||||
"github.com/goreleaser/goreleaser/internal/pipe"
|
"github.com/goreleaser/goreleaser/internal/pipe"
|
||||||
"github.com/goreleaser/goreleaser/internal/semerrgroup"
|
"github.com/goreleaser/goreleaser/internal/semerrgroup"
|
||||||
"github.com/goreleaser/goreleaser/internal/tmpl"
|
"github.com/goreleaser/goreleaser/internal/tmpl"
|
||||||
@ -35,27 +34,6 @@ func (Pipe) Default(ctx *context.Context) error {
|
|||||||
for i := range ctx.Config.Dockers {
|
for i := range ctx.Config.Dockers {
|
||||||
var docker = &ctx.Config.Dockers[i]
|
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 == "" {
|
if docker.Goos == "" {
|
||||||
docker.Goos = "linux"
|
docker.Goos = "linux"
|
||||||
}
|
}
|
||||||
@ -80,7 +58,7 @@ func (Pipe) Default(ctx *context.Context) error {
|
|||||||
|
|
||||||
// Run the pipe
|
// Run the pipe
|
||||||
func (Pipe) Run(ctx *context.Context) error {
|
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")
|
return pipe.Skip("docker section is not configured")
|
||||||
}
|
}
|
||||||
_, err := exec.LookPath("docker")
|
_, err := exec.LookPath("docker")
|
||||||
@ -101,10 +79,6 @@ func (Pipe) Publish(ctx *context.Context) error {
|
|||||||
return nil
|
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 {
|
func doRun(ctx *context.Context) error {
|
||||||
var g = semerrgroup.New(ctx.Parallelism)
|
var g = semerrgroup.New(ctx.Parallelism)
|
||||||
for _, docker := range ctx.Config.Dockers {
|
for _, docker := range ctx.Config.Dockers {
|
||||||
|
@ -169,12 +169,11 @@ func TestRunPipe(t *testing.T) {
|
|||||||
ImageTemplates: []string{
|
ImageTemplates: []string{
|
||||||
registry + "goreleaser/multiplefiles2:latest",
|
registry + "goreleaser/multiplefiles2:latest",
|
||||||
},
|
},
|
||||||
Goos: "linux",
|
Goos: "linux",
|
||||||
Goarch: "amd64",
|
Goarch: "amd64",
|
||||||
Dockerfile: "testdata/Dockerfile",
|
Dockerfile: "testdata/Dockerfile",
|
||||||
Binaries: []string{"mybin"},
|
Binaries: []string{"mybin"},
|
||||||
TagTemplates: []string{"latest"},
|
Files: []string{"testdata/extra_file.txt"},
|
||||||
Files: []string{"testdata/extra_file.txt"},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
expect: []string{
|
expect: []string{
|
||||||
@ -572,11 +571,7 @@ func TestRunPipe(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, d := range docker.dockers {
|
for _, d := range docker.dockers {
|
||||||
if d.ImageTemplates == nil {
|
docker.assertImageLabels(tt, len(d.ImageTemplates))
|
||||||
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
|
// 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{
|
Config: config.Project{
|
||||||
Dockers: []config.Docker{
|
Dockers: []config.Docker{
|
||||||
{
|
{
|
||||||
Binary: "foo",
|
Binaries: []string{"foo"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -730,31 +725,6 @@ func TestDefaultSet(t *testing.T) {
|
|||||||
assert.Equal(t, "Dockerfile.foo", docker.Dockerfile)
|
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) {
|
func Test_processImageTemplates(t *testing.T) {
|
||||||
var ctx = &context.Context{
|
var ctx = &context.Context{
|
||||||
Config: config.Project{
|
Config: config.Project{
|
||||||
|
@ -262,16 +262,13 @@ type Checksum struct {
|
|||||||
|
|
||||||
// Docker image config
|
// Docker image config
|
||||||
type Docker struct {
|
type Docker struct {
|
||||||
Binary string `yaml:",omitempty"`
|
|
||||||
Binaries []string `yaml:",omitempty"`
|
Binaries []string `yaml:",omitempty"`
|
||||||
Goos string `yaml:",omitempty"`
|
Goos string `yaml:",omitempty"`
|
||||||
Goarch string `yaml:",omitempty"`
|
Goarch string `yaml:",omitempty"`
|
||||||
Goarm string `yaml:",omitempty"`
|
Goarm string `yaml:",omitempty"`
|
||||||
Image string `yaml:",omitempty"`
|
|
||||||
Dockerfile string `yaml:",omitempty"`
|
Dockerfile string `yaml:",omitempty"`
|
||||||
ImageTemplates []string `yaml:"image_templates,omitempty"`
|
ImageTemplates []string `yaml:"image_templates,omitempty"`
|
||||||
SkipPush string `yaml:"skip_push,omitempty"`
|
SkipPush string `yaml:"skip_push,omitempty"`
|
||||||
TagTemplates []string `yaml:"tag_templates,omitempty"`
|
|
||||||
Files []string `yaml:"extra_files,omitempty"`
|
Files []string `yaml:"extra_files,omitempty"`
|
||||||
BuildFlagTemplates []string `yaml:"build_flag_templates,omitempty"`
|
BuildFlagTemplates []string `yaml:"build_flag_templates,omitempty"`
|
||||||
}
|
}
|
||||||
|
@ -196,9 +196,13 @@ archives:
|
|||||||
format: zip
|
format: zip
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Expired deprecation notices
|
||||||
|
|
||||||
|
The following options were deprecated for ~6 months and are now fully removed.
|
||||||
|
|
||||||
### docker.binary
|
### docker.binary
|
||||||
|
|
||||||
> since 2018-10-01
|
> since 2018-10-01, removed 2019-08-02
|
||||||
|
|
||||||
You can now create a Docker image with multiple binaries.
|
You can now create a Docker image with multiple binaries.
|
||||||
|
|
||||||
@ -221,7 +225,7 @@ dockers:
|
|||||||
|
|
||||||
### docker.image
|
### 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`.
|
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.
|
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
|
### 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`.
|
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.
|
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 }}'
|
- 'foo/bar:{{ .Tag }}'
|
||||||
```
|
```
|
||||||
|
|
||||||
## Expired deprecation notices
|
|
||||||
|
|
||||||
The following options were deprecated for ~6 months and are now fully removed.
|
|
||||||
|
|
||||||
### git.short_hash
|
### git.short_hash
|
||||||
|
|
||||||
> since 2018-10-03, removed 2019-01-19
|
> since 2018-10-03, removed 2019-01-19
|
||||||
|
Reference in New Issue
Block a user