mirror of
https://github.com/goreleaser/goreleaser.git
synced 2024-12-31 01:53:50 +02:00
feat: allow to disable checksum pipe (#1760)
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
This commit is contained in:
parent
acfd0024fa
commit
fa5b41332a
@ -11,6 +11,7 @@ import (
|
||||
|
||||
"github.com/apex/log"
|
||||
"github.com/goreleaser/goreleaser/internal/artifact"
|
||||
"github.com/goreleaser/goreleaser/internal/pipe"
|
||||
"github.com/goreleaser/goreleaser/internal/semerrgroup"
|
||||
"github.com/goreleaser/goreleaser/internal/tmpl"
|
||||
"github.com/goreleaser/goreleaser/pkg/context"
|
||||
@ -36,6 +37,9 @@ func (Pipe) Default(ctx *context.Context) error {
|
||||
|
||||
// Run the pipe.
|
||||
func (Pipe) Run(ctx *context.Context) (err error) {
|
||||
if ctx.Config.Checksum.Disable {
|
||||
return pipe.Skip("checksum.disable is set")
|
||||
}
|
||||
artifactList := ctx.Artifacts.Filter(
|
||||
artifact.Or(
|
||||
artifact.ByType(artifact.UploadableArchive),
|
||||
|
@ -6,6 +6,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/goreleaser/goreleaser/internal/artifact"
|
||||
"github.com/goreleaser/goreleaser/internal/testlib"
|
||||
"github.com/goreleaser/goreleaser/pkg/config"
|
||||
"github.com/goreleaser/goreleaser/pkg/context"
|
||||
|
||||
@ -57,6 +58,22 @@ func TestPipe(t *testing.T) {
|
||||
assert.Contains(t, string(bts), "61d034473102d7dac305902770471fd50f4c5b26f6831a56dd90b5184b3c30fc binary.tar.gz")
|
||||
}
|
||||
|
||||
func TestPipeSkipTrue(t *testing.T) {
|
||||
folder, err := ioutil.TempDir("", "goreleasertest")
|
||||
assert.NoError(t, err)
|
||||
var ctx = context.New(
|
||||
config.Project{
|
||||
Dist: folder,
|
||||
Checksum: config.Checksum{
|
||||
Disable: true,
|
||||
},
|
||||
},
|
||||
)
|
||||
err = Pipe{}.Run(ctx)
|
||||
testlib.AssertSkipped(t, err)
|
||||
assert.EqualError(t, err, `checksum.disable is set`)
|
||||
}
|
||||
|
||||
func TestPipeFileNotExist(t *testing.T) {
|
||||
folder, err := ioutil.TempDir("", "goreleasertest")
|
||||
assert.NoError(t, err)
|
||||
|
@ -393,6 +393,7 @@ type Snapshot struct {
|
||||
type Checksum struct {
|
||||
NameTemplate string `yaml:"name_template,omitempty"`
|
||||
Algorithm string `yaml:"algorithm,omitempty"`
|
||||
Disable bool `yaml:"disable,omitempty"`
|
||||
}
|
||||
|
||||
// Docker image config.
|
||||
|
@ -18,6 +18,10 @@ checksum:
|
||||
# Accepted options are sha256, sha512, sha1, crc32, md5, sha224 and sha384.
|
||||
# Default is sha256.
|
||||
algorithm: sha256
|
||||
|
||||
# Disable the generation/upload of the checksum file.
|
||||
# Default is false.
|
||||
disable: true
|
||||
```
|
||||
|
||||
!!! tip
|
||||
|
Loading…
Reference in New Issue
Block a user