1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-07-15 01:34:21 +02:00

feat: remove deprecated blob and sign (#1397)

* feat: remove deprecated blob and sign

you should now use blobs and signs instead.

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

* fix: tests

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
This commit is contained in:
Carlos Alexandro Becker
2020-03-22 16:26:22 -03:00
committed by GitHub
parent 22c9e04efd
commit 0126a1f32b
6 changed files with 19 additions and 40 deletions

View File

@ -4,7 +4,6 @@ import (
"fmt" "fmt"
"strings" "strings"
"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/pkg/context" "github.com/goreleaser/goreleaser/pkg/context"
@ -20,10 +19,6 @@ 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 {
if len(ctx.Config.Blob) > 0 {
deprecate.Notice("blob")
ctx.Config.Blobs = append(ctx.Config.Blobs, ctx.Config.Blob...)
}
for i := range ctx.Config.Blobs { for i := range ctx.Config.Blobs {
blob := &ctx.Config.Blobs[i] blob := &ctx.Config.Blobs[i]

View File

@ -62,12 +62,6 @@ func TestDefaultsNoProvider(t *testing.T) {
func TestDefaults(t *testing.T) { func TestDefaults(t *testing.T) {
var ctx = context.New(config.Project{ var ctx = context.New(config.Project{
Blob: []config.Blob{
{
Bucket: "foobar",
Provider: "gcs",
},
},
Blobs: []config.Blob{ Blobs: []config.Blob{
{ {
Bucket: "foo", Bucket: "foo",
@ -84,11 +78,6 @@ func TestDefaults(t *testing.T) {
Folder: "{{ .ProjectName }}/{{ .Tag }}", Folder: "{{ .ProjectName }}/{{ .Tag }}",
IDs: []string{"foo", "bar"}, IDs: []string{"foo", "bar"},
}, },
{
Bucket: "foobar",
Provider: "gcs",
Folder: "{{ .ProjectName }}/{{ .Tag }}",
},
}, ctx.Config.Blobs) }, ctx.Config.Blobs)
} }

View File

@ -5,11 +5,9 @@ import (
"os" "os"
"os/exec" "os/exec"
"path/filepath" "path/filepath"
"reflect"
"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/ids" "github.com/goreleaser/goreleaser/internal/ids"
"github.com/goreleaser/goreleaser/internal/logext" "github.com/goreleaser/goreleaser/internal/logext"
"github.com/goreleaser/goreleaser/internal/pipe" "github.com/goreleaser/goreleaser/internal/pipe"
@ -27,12 +25,6 @@ func (Pipe) String() string {
// Default sets the Pipes defaults. // Default sets the Pipes defaults.
func (Pipe) Default(ctx *context.Context) error { func (Pipe) Default(ctx *context.Context) error {
if len(ctx.Config.Signs) == 0 {
ctx.Config.Signs = append(ctx.Config.Signs, ctx.Config.Sign)
if !reflect.DeepEqual(ctx.Config.Sign, config.Sign{}) {
deprecate.Notice("sign")
}
}
var ids = ids.New("signs") var ids = ids.New("signs")
for i := range ctx.Config.Signs { for i := range ctx.Config.Signs {
cfg := &ctx.Config.Signs[i] cfg := &ctx.Config.Signs[i]

View File

@ -40,7 +40,11 @@ func TestDescription(t *testing.T) {
} }
func TestSignDefault(t *testing.T) { func TestSignDefault(t *testing.T) {
ctx := &context.Context{} ctx := &context.Context{
Config: config.Project{
Signs: []config.Sign{{}},
},
}
err := Pipe{}.Default(ctx) err := Pipe{}.Default(ctx)
assert.NoError(t, err) assert.NoError(t, err)
assert.Equal(t, ctx.Config.Signs[0].Cmd, "gpg") assert.Equal(t, ctx.Config.Signs[0].Cmd, "gpg")
@ -87,10 +91,12 @@ func TestSignArtifacts(t *testing.T) {
expectedErrMsg: "sign: exit failed", expectedErrMsg: "sign: exit failed",
ctx: context.New( ctx: context.New(
config.Project{ config.Project{
Sign: config.Sign{ Signs: []config.Sign{
Artifacts: "all", {
Cmd: "exit", Artifacts: "all",
Args: []string{"1"}, Cmd: "exit",
Args: []string{"1"},
},
}, },
}, },
), ),
@ -99,8 +105,8 @@ func TestSignArtifacts(t *testing.T) {
desc: "sign single", desc: "sign single",
ctx: context.New( ctx: context.New(
config.Project{ config.Project{
Sign: config.Sign{ Signs: []config.Sign{
Artifacts: "all", {Artifacts: "all"},
}, },
}, },
), ),

View File

@ -366,12 +366,10 @@ type Project struct {
Dockers []Docker `yaml:",omitempty"` Dockers []Docker `yaml:",omitempty"`
Artifactories []Upload `yaml:",omitempty"` Artifactories []Upload `yaml:",omitempty"`
Uploads []Upload `yaml:",omitempty"` Uploads []Upload `yaml:",omitempty"`
Puts []Upload `yaml:",omitempty"` // TODO: remove this Puts []Upload `yaml:",omitempty"` // TODO: remove this
Blob []Blob `yaml:"blob,omitempty"` // TODO: remove this
Blobs []Blob `yaml:"blobs,omitempty"` Blobs []Blob `yaml:"blobs,omitempty"`
Changelog Changelog `yaml:",omitempty"` Changelog Changelog `yaml:",omitempty"`
Dist string `yaml:",omitempty"` Dist string `yaml:",omitempty"`
Sign Sign `yaml:",omitempty"` // TODO: remove this
Signs []Sign `yaml:",omitempty"` Signs []Sign `yaml:",omitempty"`
EnvFiles EnvFiles `yaml:"env_files,omitempty"` EnvFiles EnvFiles `yaml:"env_files,omitempty"`
Before Before `yaml:",omitempty"` Before Before `yaml:",omitempty"`

View File

@ -85,10 +85,13 @@ nfpms:
- file_name_template: foo - file_name_template: foo
``` ```
## Expired deprecation notices
The following options were deprecated for ~6 months and are now fully removed.
### blob ### blob
> since 2019-08-02 > since 2019-08-02, removed 2020-03-22
Blob was deprecated in favor of its plural form. Blob was deprecated in favor of its plural form.
It was already accepting multiple inputs, but its pluralized now so its more It was already accepting multiple inputs, but its pluralized now so its more
@ -110,7 +113,7 @@ blobs:
### sign ### sign
> since 2019-07-20 > since 2019-07-20, removed 2020-03-22
Sign was deprecated in favor of its plural form. Sign was deprecated in favor of its plural form.
@ -129,10 +132,6 @@ signs:
# etc # etc
``` ```
## Expired deprecation notices
The following options were deprecated for ~6 months and are now fully removed.
### brew ### brew
> since 2019-06-09, removed 2020-01-26 > since 2019-06-09, removed 2020-01-26