You've already forked goreleaser
mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-07-17 01:42:37 +02:00
feat: skip_push on docker to match draft releases
This commit is contained in:
committed by
Carlos Alexandro Becker
parent
79a48eae7b
commit
b5818a7225
@ -183,6 +183,7 @@ type Docker struct {
|
|||||||
Image string `yaml:",omitempty"`
|
Image string `yaml:",omitempty"`
|
||||||
Dockerfile string `yaml:",omitempty"`
|
Dockerfile string `yaml:",omitempty"`
|
||||||
Latest bool `yaml:",omitempty"`
|
Latest bool `yaml:",omitempty"`
|
||||||
|
SkipPush bool `yaml:"skip_push,omitempty"`
|
||||||
OldTagTemplate string `yaml:"tag_template,omitempty"`
|
OldTagTemplate string `yaml:"tag_template,omitempty"`
|
||||||
TagTemplates []string `yaml:"tag_templates,omitempty"`
|
TagTemplates []string `yaml:"tag_templates,omitempty"`
|
||||||
Files []string `yaml:"extra_files,omitempty"`
|
Files []string `yaml:"extra_files,omitempty"`
|
||||||
|
@ -200,6 +200,11 @@ func publish(ctx *context.Context, docker config.Docker, images []string) error
|
|||||||
log.Warn(pipeline.ErrSkipPublishEnabled.Error())
|
log.Warn(pipeline.ErrSkipPublishEnabled.Error())
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
if docker.SkipPush {
|
||||||
|
// TODO: this should also be better handled
|
||||||
|
log.Warn(pipeline.Skip("skip_push is set").Error())
|
||||||
|
return nil
|
||||||
|
}
|
||||||
for _, image := range images {
|
for _, image := range images {
|
||||||
if err := dockerPush(ctx, docker, image); err != nil {
|
if err := dockerPush(ctx, docker, image); err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -92,6 +92,33 @@ func TestRunPipe(t *testing.T) {
|
|||||||
},
|
},
|
||||||
assertError: shouldNotErr,
|
assertError: shouldNotErr,
|
||||||
},
|
},
|
||||||
|
"valid_skip_push": {
|
||||||
|
publish: true,
|
||||||
|
docker: config.Docker{
|
||||||
|
Image: registry + "goreleaser/test_run_pipe",
|
||||||
|
Goos: "linux",
|
||||||
|
Goarch: "amd64",
|
||||||
|
Dockerfile: "testdata/Dockerfile",
|
||||||
|
Binary: "mybin",
|
||||||
|
SkipPush: true,
|
||||||
|
TagTemplates: []string{
|
||||||
|
"{{.Tag}}-{{.Env.FOO}}",
|
||||||
|
"v{{.Major}}",
|
||||||
|
"v{{.Major}}.{{.Minor}}",
|
||||||
|
"latest",
|
||||||
|
},
|
||||||
|
Files: []string{
|
||||||
|
"testdata/extra_file.txt",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
expect: []string{
|
||||||
|
registry + "goreleaser/test_run_pipe:v1.0.0-123",
|
||||||
|
registry + "goreleaser/test_run_pipe:v1",
|
||||||
|
registry + "goreleaser/test_run_pipe:v1.0",
|
||||||
|
registry + "goreleaser/test_run_pipe:latest",
|
||||||
|
},
|
||||||
|
assertError: shouldNotErr,
|
||||||
|
},
|
||||||
"valid_no_latest": {
|
"valid_no_latest": {
|
||||||
publish: true,
|
publish: true,
|
||||||
docker: config.Docker{
|
docker: config.Docker{
|
||||||
|
Reference in New Issue
Block a user