You've already forked goreleaser
mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-09-16 09:26:52 +02:00
cleanups
This commit is contained in:
@@ -14,7 +14,10 @@ import (
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// Pipe for checksums
|
||||
// ErrNoDocker is shown when docker cannot be found in $PATH
|
||||
var ErrNoDocker = errors.New("docker not present in $PATH")
|
||||
|
||||
// Pipe for docker
|
||||
type Pipe struct{}
|
||||
|
||||
// Description of the pipe
|
||||
@@ -23,13 +26,17 @@ func (Pipe) Description() string {
|
||||
}
|
||||
|
||||
// Run the pipe
|
||||
func (Pipe) Run(ctx *context.Context) (err error) {
|
||||
if ctx.Config.Dockers[0].Image == "" {
|
||||
func (Pipe) Run(ctx *context.Context) error {
|
||||
if len(ctx.Config.Dockers) == 0 || ctx.Config.Dockers[0].Image == "" {
|
||||
return pipeline.Skip("docker section is not configured")
|
||||
}
|
||||
if ctx.Config.Release.Draft {
|
||||
return pipeline.Skip("release is marked as draft")
|
||||
}
|
||||
_, err := exec.LookPath("docker")
|
||||
if err != nil {
|
||||
return ErrNoDocker
|
||||
}
|
||||
for _, docker := range ctx.Config.Dockers {
|
||||
var imagePlatform = docker.Goos + docker.Goarch + docker.Goarm
|
||||
for platform, groups := range ctx.Binaries {
|
||||
|
@@ -12,6 +12,7 @@ type Pipe interface {
|
||||
Run(ctx *context.Context) error
|
||||
}
|
||||
|
||||
// IsSkip returns true if the error is an ErrSkip
|
||||
func IsSkip(err error) bool {
|
||||
_, ok := err.(ErrSkip)
|
||||
return ok
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package pipeline
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
@@ -13,3 +14,9 @@ func TestSkipPipe(t *testing.T) {
|
||||
assert.Error(err)
|
||||
assert.Equal(reason, err.Error())
|
||||
}
|
||||
|
||||
func TestIsSkip(t *testing.T) {
|
||||
var assert = assert.New(t)
|
||||
assert.True(IsSkip(Skip("whatever")))
|
||||
assert.False(IsSkip(errors.New("nope")))
|
||||
}
|
||||
|
Reference in New Issue
Block a user