Repository: goreleaser/goreleaser
Pull request #1399 (2020-03-22 20:03:17)

fix: build.binary and artifact.extra.binary
closes https://github.com/goreleaser/goreleaser/issues/1398

3 things:

1. make archive pipe work when `build.binary` is a path
2. `artifact.extra[binary]` should not have the path to the binary, just its name...
3. scoop pipe was using the `artifact.extra[binary]` field instead of just `artifact.name`


Patch:
diff --git a/go.mod b/go.mod
index 555c04a6..cdc0643b 100644
--- a/go.mod
+++ b/go.mod
@@ -12,14 +12,14 @@ require (
 	github.com/fatih/color v1.9.0
 	github.com/google/go-github/v28 v28.1.1
 	github.com/goreleaser/nfpm v1.2.1
-	github.com/imdario/mergo v0.3.8
+	github.com/imdario/mergo v0.3.9
 	github.com/jarcoal/httpmock v1.0.5
 	github.com/kamilsk/retry/v4 v4.7.2
 	github.com/mattn/go-zglob v0.0.1
 	github.com/mitchellh/go-homedir v1.1.0
 	github.com/pkg/errors v0.9.1
 	github.com/stretchr/testify v1.5.1
-	github.com/xanzy/go-gitlab v0.28.0
+	github.com/xanzy/go-gitlab v0.29.0
 	gocloud.dev v0.19.0
 	golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa // indirect
 	golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d
diff --git a/go.sum b/go.sum
index d41bc82f..3b28b02c 100644
--- a/go.sum
+++ b/go.sum
@@ -129,6 +129,11 @@ github.com/goreleaser/nfpm v1.2.1/go.mod h1:TtWrABZozuLOttX2uDlYyECfQX7x5XYkVxhj
 github.com/grpc-ecosystem/grpc-gateway v1.8.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
 github.com/grpc-ecosystem/grpc-gateway v1.9.2 h1:S+ef0492XaIknb8LMjcwgW2i3cNTzDYMmDrOThOJNWc=
 github.com/grpc-ecosystem/grpc-gateway v1.9.2/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
+github.com/hashicorp/go-cleanhttp v0.5.1 h1:dH3aiDG9Jvb5r5+bYHsikaOUIpcM0xvgMXVoDkXMzJM=
+github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
+github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ=
+github.com/hashicorp/go-retryablehttp v0.6.4 h1:BbgctKO892xEyOXnGiaAwIoSq1QZ/SS4AhjoAh9DnfY=
+github.com/hashicorp/go-retryablehttp v0.6.4/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY=
 github.com/hashicorp/go-version v1.2.0 h1:3vNe/fWF5CBgRIguda1meWhsZHy3m8gCJ5wx+dIzX/E=
 github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
 github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
@@ -137,6 +142,8 @@ github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ
 github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
 github.com/imdario/mergo v0.3.8 h1:CGgOkSJeqMRmt0D9XLWExdT4m4F1vd3FV3VPt+0VxkQ=
 github.com/imdario/mergo v0.3.8/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
+github.com/imdario/mergo v0.3.9 h1:UauaLniWCFHWd+Jp9oCEkTBj8VO/9DKg3PV3VCNMDIg=
+github.com/imdario/mergo v0.3.9/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
 github.com/jarcoal/httpmock v1.0.4 h1:jp+dy/+nonJE4g4xbVtl9QdrUNbn6/3hDT5R4nDIZnA=
 github.com/jarcoal/httpmock v1.0.4/go.mod h1:ATjnClrvW/3tijVmpL/va5Z3aAyGvqU3gCT8nX0Txik=
 github.com/jarcoal/httpmock v1.0.5 h1:cHtVEcTxRSX4J0je7mWPfc9BpDpqzXSJ5HbymZmyHck=
@@ -210,6 +217,8 @@ github.com/ulikunitz/xz v0.5.6 h1:jGHAfXawEGZQ3blwU5wnWKQJvAraT7Ftq9EXjnXYgt8=
 github.com/ulikunitz/xz v0.5.6/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8=
 github.com/xanzy/go-gitlab v0.28.0 h1:nsyjDVvBrP4KRXEN4b1m1ewiqmTNL4BOWW041nKGV7k=
 github.com/xanzy/go-gitlab v0.28.0/go.mod h1:t4Bmvnxj7k37S4Y17lfLx+nLqkf/oQwT2HagfWKv5Og=
+github.com/xanzy/go-gitlab v0.29.0 h1:9tMvAkG746eIlzcdpnRgpcKPA1woUDmldMIjR/E5OWM=
+github.com/xanzy/go-gitlab v0.29.0/go.mod h1:sPLojNBn68fMUWSxIJtdVVIP8uSBYqesTfDUseX11Ug=
 github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 h1:nIPpBwaJSVYIxUFsDv3M8ofmx9yWTog9BfvIu0q41lo=
 github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8/go.mod h1:HUYIGzjTL3rfEspMxjDjgmT5uz5wzYJKVo23qUhYTos=
 go.opencensus.io v0.15.0/go.mod h1:UffZAU+4sDEINUGP/B7UfBBkq4fqLu9zXAX7ke6CHW0=
@@ -289,6 +298,8 @@ golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
 golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
 golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
 golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
+golang.org/x/time v0.0.0-20191024005414-555d28b269f0 h1:/5xXl8Y5W96D+TtHSlonuFqGHIWVuyCkGJLwGh9JJFs=
+golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
 golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
 golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
 golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
diff --git a/internal/builders/golang/build.go b/internal/builders/golang/build.go
index 6c6b10a9..3812213f 100644
--- a/internal/builders/golang/build.go
+++ b/internal/builders/golang/build.go
@@ -81,7 +81,7 @@ func (*Builder) Build(ctx *context.Context, build config.Build, options api.Opti
 		Goarm:  target.arm,
 		Gomips: target.mips,
 		Extra: map[string]interface{}{
-			"Binary": build.Binary,
+			"Binary": filepath.Base(build.Binary),
 			"Ext":    options.Ext,
 			"ID":     build.ID,
 		},
diff --git a/internal/client/client.go b/internal/client/client.go
index 2a2bdbb2..bcdf7d13 100644
--- a/internal/client/client.go
+++ b/internal/client/client.go
@@ -4,6 +4,7 @@ package client
 import (
 	"os"
 
+	"github.com/apex/log"
 	"github.com/goreleaser/goreleaser/internal/artifact"
 	"github.com/goreleaser/goreleaser/pkg/config"
 	"github.com/goreleaser/goreleaser/pkg/context"
@@ -25,6 +26,7 @@ type Client interface {
 
 // New creates a new client depending on the token type
 func New(ctx *context.Context) (Client, error) {
+	log.WithField("type", ctx.TokenType).Info("token type")
 	if ctx.TokenType == context.TokenTypeGitHub {
 		return NewGitHub(ctx)
 	}
@@ -36,3 +38,16 @@ func New(ctx *context.Context) (Client, error) {
 	}
 	return nil, nil
 }
+
+// RetriableError is an error that will cause the action to be retried.
+type RetriableError struct {
+	Err error
+}
+
+func (e RetriableError) Error() string {
+	return e.Err.Error()
+}
+
+func (e RetriableError) Retriable() bool {
+	return true
+}
diff --git a/internal/client/gitea.go b/internal/client/gitea.go
index 34b30600..c46f25cb 100644
--- a/internal/client/gitea.go
+++ b/internal/client/gitea.go
@@ -184,5 +184,8 @@ func (c *giteaClient) Upload(
 	repoName := releaseConfig.Gitea.Name
 
 	_, err = c.client.CreateReleaseAttachment(owner, repoName, giteaReleaseID, file, artifact.Name)
-	return err
+	if err != nil {
+		return RetriableError{err}
+	}
+	return nil
 }
diff --git a/internal/client/github.go b/internal/client/github.go
index e85fc021..ec0c0ef1 100644
--- a/internal/client/github.go
+++ b/internal/client/github.go
@@ -158,7 +158,7 @@ func (c *githubClient) Upload(
 	if err != nil {
 		return err
 	}
-	_, _, err = c.client.Repositories.UploadReleaseAsset(
+	_, resp, err := c.client.Repositories.UploadReleaseAsset(
 		ctx,
 		ctx.Config.Release.GitHub.Owner,
 		ctx.Config.Release.GitHub.Name,
@@ -168,5 +168,8 @@ func (c *githubClient) Upload(
 		},
 		file,
 	)
-	return err
+	if resp.StatusCode == 422 {
+		return err
+	}
+	return RetriableError{err}
 }
diff --git a/internal/client/gitlab.go b/internal/client/gitlab.go
index 7ad145b0..d8aedf4a 100644
--- a/internal/client/gitlab.go
+++ b/internal/client/gitlab.go
@@ -263,7 +263,7 @@ func (c *gitlabClient) Upload(
 		})
 
 	if err != nil {
-		return err
+		return RetriableError{err}
 	}
 
 	log.WithFields(log.Fields{
@@ -284,7 +284,7 @@ func (c *gitlabClient) Upload(
 	// in following publish pipes like brew, scoop
 	artifact.Extra["ArtifactUploadHash"] = fileUploadHash
 
-	return err
+	return nil
 }
 
 // extractProjectFileHashFrom extracts the hash from the
diff --git a/internal/pipe/archive/archive.go b/internal/pipe/archive/archive.go
index 7cb08236..cb332e67 100644
--- a/internal/pipe/archive/archive.go
+++ b/internal/pipe/archive/archive.go
@@ -117,6 +117,10 @@ func create(ctx *context.Context, archive config.Archive, binaries []*artifact.A
 	}
 	archivePath := filepath.Join(ctx.Config.Dist, folder+"."+format)
 	lock.Lock()
+	if err := os.MkdirAll(filepath.Dir(archivePath), 0755|os.ModeDir); err != nil {
+		lock.Unlock()
+		return err
+	}
 	if _, err = os.Stat(archivePath); !os.IsNotExist(err) {
 		lock.Unlock()
 		return fmt.Errorf("archive named %s already exists. Check your archive name template", archivePath)
diff --git a/internal/pipe/release/release.go b/internal/pipe/release/release.go
index f1ff1dd8..9f5b7a7d 100644
--- a/internal/pipe/release/release.go
+++ b/internal/pipe/release/release.go
@@ -176,10 +176,10 @@ func upload(ctx *context.Context, client client.Client, releaseID string, artifa
 		defer file.Close() // nolint: errcheck
 		log.WithField("file", file.Name()).WithField("name", artifact.Name).Info("uploading to release")
 		if err := client.Upload(ctx, releaseID, artifact, file); err != nil {
-			log.WithFields(log.Fields{
-				"try":      try,
-				"artifact": artifact.Name,
-			}).Warnf("failed to upload artifact, will retry")
+			log.WithField("try", try).
+				WithField("artifact", artifact.Name).
+				WithError(err).
+				Warnf("failed to upload artifact, will retry")
 			return err
 		}
 		return nil
@@ -187,9 +187,10 @@ func upload(ctx *context.Context, client client.Client, releaseID string, artifa
 	how := []func(uint, error) bool{
 		strategy.Limit(10),
 		strategy.Backoff(backoff.Linear(50 * time.Millisecond)),
+		strategy.CheckError(false),
 	}
 	if err := retry.Try(ctx, what, how...); err != nil {
-		return errors.Wrapf(err, "failed to upload %s after %d retries", artifact.Name, repeats)
+		return errors.Wrapf(err, "failed to upload %s after %d tries", artifact.Name, repeats)
 	}
 	return nil
 }
diff --git a/internal/pipe/scoop/scoop.go b/internal/pipe/scoop/scoop.go
index 7180ec6e..d4dd39eb 100644
--- a/internal/pipe/scoop/scoop.go
+++ b/internal/pipe/scoop/scoop.go
@@ -196,7 +196,7 @@ func binaries(a *artifact.Artifact) []string {
 	// nolint: prealloc
 	var bins []string
 	for _, b := range a.ExtraOr("Builds", []*artifact.Artifact{}).([]*artifact.Artifact) {
-		bins = append(bins, b.ExtraOr("Binary", "").(string)+".exe")
+		bins = append(bins, b.Name+".exe")
 	}
 	return bins
 }


Test patch:
diff --git a/internal/builders/golang/build_test.go b/internal/builders/golang/build_test.go
index 1a689c8c..21376c50 100644
--- a/internal/builders/golang/build_test.go
+++ b/internal/builders/golang/build_test.go
@@ -91,7 +91,7 @@ func TestBuild(t *testing.T) {
 			{
 				ID:     "foo",
 				Env:    []string{"GO111MODULE=off"},
-				Binary: "foo",
+				Binary: "bin/foo",
 				Targets: []string{
 					"linux_amd64",
 					"darwin_amd64",
@@ -129,8 +129,8 @@ func TestBuild(t *testing.T) {
 	}
 	assert.ElementsMatch(t, ctx.Artifacts.List(), []*artifact.Artifact{
 		{
-			Name:   "foo",
-			Path:   filepath.Join(folder, "dist", "linux_amd64", "foo"),
+			Name:   "bin/foo",
+			Path:   filepath.Join(folder, "dist", "linux_amd64", "bin", "foo"),
 			Goos:   "linux",
 			Goarch: "amd64",
 			Type:   artifact.Binary,
@@ -141,8 +141,8 @@ func TestBuild(t *testing.T) {
 			},
 		},
 		{
-			Name:   "foo",
-			Path:   filepath.Join(folder, "dist", "linux_mips_softfloat", "foo"),
+			Name:   "bin/foo",
+			Path:   filepath.Join(folder, "dist", "linux_mips_softfloat", "bin", "foo"),
 			Goos:   "linux",
 			Goarch: "mips",
 			Gomips: "softfloat",
@@ -154,8 +154,8 @@ func TestBuild(t *testing.T) {
 			},
 		},
 		{
-			Name:   "foo",
-			Path:   filepath.Join(folder, "dist", "linux_mips64le_softfloat", "foo"),
+			Name:   "bin/foo",
+			Path:   filepath.Join(folder, "dist", "linux_mips64le_softfloat", "bin", "foo"),
 			Goos:   "linux",
 			Goarch: "mips64le",
 			Gomips: "softfloat",
@@ -167,8 +167,8 @@ func TestBuild(t *testing.T) {
 			},
 		},
 		{
-			Name:   "foo",
-			Path:   filepath.Join(folder, "dist", "darwin_amd64", "foo"),
+			Name:   "bin/foo",
+			Path:   filepath.Join(folder, "dist", "darwin_amd64", "bin", "foo"),
 			Goos:   "darwin",
 			Goarch: "amd64",
 			Type:   artifact.Binary,
@@ -179,8 +179,8 @@ func TestBuild(t *testing.T) {
 			},
 		},
 		{
-			Name:   "foo",
-			Path:   filepath.Join(folder, "dist", "linux_arm_6", "foo"),
+			Name:   "bin/foo",
+			Path:   filepath.Join(folder, "dist", "linux_arm_6", "bin", "foo"),
 			Goos:   "linux",
 			Goarch: "arm",
 			Goarm:  "6",
@@ -192,8 +192,8 @@ func TestBuild(t *testing.T) {
 			},
 		},
 		{
-			Name:   "foo",
-			Path:   filepath.Join(folder, "dist", "windows_amd64", "foo"),
+			Name:   "bin/foo",
+			Path:   filepath.Join(folder, "dist", "windows_amd64", "bin", "foo"),
 			Goos:   "windows",
 			Goarch: "amd64",
 			Type:   artifact.Binary,
@@ -204,8 +204,8 @@ func TestBuild(t *testing.T) {
 			},
 		},
 		{
-			Name:   "foo",
-			Path:   filepath.Join(folder, "dist", "js_wasm", "foo"),
+			Name:   "bin/foo",
+			Path:   filepath.Join(folder, "dist", "js_wasm", "bin", "foo"),
 			Goos:   "js",
 			Goarch: "wasm",
 			Type:   artifact.Binary,
diff --git a/internal/pipe/archive/archive_test.go b/internal/pipe/archive/archive_test.go
index c6906d1a..d23c39b4 100644
--- a/internal/pipe/archive/archive_test.go
+++ b/internal/pipe/archive/archive_test.go
@@ -24,8 +24,9 @@ func TestDescription(t *testing.T) {
 }
 
 func createFakeBinary(t *testing.T, dist, arch, bin string) {
-	require.NoError(t, os.Mkdir(filepath.Join(dist, arch), 0755))
-	_, err := os.Create(filepath.Join(dist, arch, bin))
+	var path = filepath.Join(dist, arch, bin)
+	require.NoError(t, os.MkdirAll(filepath.Dir(path), 0755))
+	_, err := os.Create(path)
 	require.NoError(t, err)
 }
 
@@ -37,9 +38,9 @@ func TestRunPipe(t *testing.T) {
 			var dist = filepath.Join(folder, format+"_dist")
 			require.NoError(t, os.Mkdir(dist, 0755))
 			for _, arch := range []string{"darwinamd64", "linux386", "linuxarm7", "linuxmipssoftfloat"} {
-				createFakeBinary(t, dist, arch, "mybin")
+				createFakeBinary(t, dist, arch, "bin/mybin")
 			}
-			createFakeBinary(t, dist, "windowsamd64", "mybin.exe")
+			createFakeBinary(t, dist, "windowsamd64", "bin/mybin.exe")
 			for _, tt := range []string{"darwin", "linux", "windows"} {
 				_, err := os.Create(filepath.Join(folder, fmt.Sprintf("README.%s.md", tt)))
 				require.NoError(t, err)
@@ -73,22 +74,22 @@ func TestRunPipe(t *testing.T) {
 			var darwinBuild = &artifact.Artifact{
 				Goos:   "darwin",
 				Goarch: "amd64",
-				Name:   "mybin",
-				Path:   filepath.Join(dist, "darwinamd64", "mybin"),
+				Name:   "bin/mybin",
+				Path:   filepath.Join(dist, "darwinamd64", "bin", "mybin"),
 				Type:   artifact.Binary,
 				Extra: map[string]interface{}{
-					"Binary": "mybin",
+					"Binary": "bin/mybin",
 					"ID":     "default",
 				},
 			}
 			var linux386Build = &artifact.Artifact{
 				Goos:   "linux",
 				Goarch: "386",
-				Name:   "mybin",
-				Path:   filepath.Join(dist, "linux386", "mybin"),
+				Name:   "bin/mybin",
+				Path:   filepath.Join(dist, "linux386", "bin", "mybin"),
 				Type:   artifact.Binary,
 				Extra: map[string]interface{}{
-					"Binary": "mybin",
+					"Binary": "bin/mybin",
 					"ID":     "default",
 				},
 			}
@@ -96,11 +97,11 @@ func TestRunPipe(t *testing.T) {
 				Goos:   "linux",
 				Goarch: "arm",
 				Goarm:  "7",
-				Name:   "mybin",
-				Path:   filepath.Join(dist, "linuxarm7", "mybin"),
+				Name:   "bin/mybin",
+				Path:   filepath.Join(dist, "linuxarm7", "bin", "mybin"),
 				Type:   artifact.Binary,
 				Extra: map[string]interface{}{
-					"Binary": "mybin",
+					"Binary": "bin/mybin",
 					"ID":     "default",
 				},
 			}
@@ -108,8 +109,8 @@ func TestRunPipe(t *testing.T) {
 				Goos:   "linux",
 				Goarch: "mips",
 				Gomips: "softfloat",
-				Name:   "mybin",
-				Path:   filepath.Join(dist, "linuxmipssoftfloat", "mybin"),
+				Name:   "bin/mybin",
+				Path:   filepath.Join(dist, "linuxmipssoftfloat", "bin", "mybin"),
 				Type:   artifact.Binary,
 				Extra: map[string]interface{}{
 					"Binary": "mybin",
@@ -119,8 +120,8 @@ func TestRunPipe(t *testing.T) {
 			var windowsBuild = &artifact.Artifact{
 				Goos:   "windows",
 				Goarch: "amd64",
-				Name:   "mybin.exe",
-				Path:   filepath.Join(dist, "windowsamd64", "mybin.exe"),
+				Name:   "bin/mybin.exe",
+				Path:   filepath.Join(dist, "windowsamd64", "bin", "mybin.exe"),
 				Type:   artifact.Binary,
 				Extra: map[string]interface{}{
 					"Binary":    "mybin",
@@ -159,7 +160,7 @@ func TestRunPipe(t *testing.T) {
 							"foo/bar",
 							"foo/bar/foobar",
 							"foo/bar/foobar/blah.txt",
-							"mybin",
+							"bin/mybin",
 						},
 						tarFiles(t, filepath.Join(dist, name)),
 					)
@@ -171,7 +172,7 @@ func TestRunPipe(t *testing.T) {
 					[]string{
 						"README.windows.md",
 						"foo/bar/foobar/blah.txt",
-						"mybin.exe",
+						"bin/mybin.exe",
 					},
 					zipFiles(t, filepath.Join(dist, "foobar_0.0.1_windows_amd64.zip")),
 				)
@@ -276,7 +277,7 @@ func TestRunPipeBinary(t *testing.T) {
 func TestRunPipeDistRemoved(t *testing.T) {
 	var ctx = context.New(
 		config.Project{
-			Dist: "/path/nope",
+			Dist: "/tmp/path/to/nope",
 			Archives: []config.Archive{
 				{
 					NameTemplate: "nope",
@@ -291,7 +292,7 @@ func TestRunPipeDistRemoved(t *testing.T) {
 		Goos:   "windows",
 		Goarch: "amd64",
 		Name:   "mybin.exe",
-		Path:   filepath.Join("/path/to/nope", "windowsamd64", "mybin.exe"),
+		Path:   filepath.Join("/tmp/path/to/nope", "windowsamd64", "mybin.exe"),
 		Type:   artifact.Binary,
 		Extra: map[string]interface{}{
 			"Binary":    "mybin",
@@ -299,7 +300,8 @@ func TestRunPipeDistRemoved(t *testing.T) {
 			"ID":        "default",
 		},
 	})
-	require.EqualError(t, Pipe{}.Run(ctx), `failed to create directory /path/nope/nope.zip: open /path/nope/nope.zip: no such file or directory`)
+	// not checking on error msg because it may change depending on OS/version
+	require.Error(t, Pipe{}.Run(ctx))
 }
 
 func TestRunPipeInvalidGlob(t *testing.T) {
diff --git a/internal/pipe/release/release_test.go b/internal/pipe/release/release_test.go
index 1334c66c..2f8bfaac 100644
--- a/internal/pipe/release/release_test.go
+++ b/internal/pipe/release/release_test.go
@@ -9,6 +9,7 @@ import (
 	"testing"
 
 	"github.com/goreleaser/goreleaser/internal/artifact"
+	"github.com/goreleaser/goreleaser/internal/client"
 	"github.com/goreleaser/goreleaser/internal/testlib"
 	"github.com/goreleaser/goreleaser/pkg/config"
 	"github.com/goreleaser/goreleaser/pkg/context"
@@ -221,7 +222,7 @@ func TestRunPipeUploadFailure(t *testing.T) {
 	client := &DummyClient{
 		FailToUpload: true,
 	}
-	assert.EqualError(t, doPublish(ctx, client), "failed to upload bin.tar.gz after 10 retries: upload failed")
+	assert.EqualError(t, doPublish(ctx, client), "failed to upload bin.tar.gz after 1 tries: upload failed")
 	assert.True(t, client.CreatedRelease)
 	assert.False(t, client.UploadedFile)
 }
@@ -526,38 +527,38 @@ type DummyClient struct {
 	Lock                sync.Mutex
 }
 
-func (client *DummyClient) CreateRelease(ctx *context.Context, body string) (releaseID string, err error) {
-	if client.FailToCreateRelease {
+func (c *DummyClient) CreateRelease(ctx *context.Context, body string) (releaseID string, err error) {
+	if c.FailToCreateRelease {
 		return "", errors.New("release failed")
 	}
-	client.CreatedRelease = true
+	c.CreatedRelease = true
 	return
 }
 
-func (client *DummyClient) CreateFile(ctx *context.Context, commitAuthor config.CommitAuthor, repo config.Repo, content []byte, path, msg string) (err error) {
+func (c *DummyClient) CreateFile(ctx *context.Context, commitAuthor config.CommitAuthor, repo config.Repo, content []byte, path, msg string) (err error) {
 	return
 }
 
-func (client *DummyClient) Upload(ctx *context.Context, releaseID string, artifact *artifact.Artifact, file *os.File) error {
-	client.Lock.Lock()
-	defer client.Lock.Unlock()
-	if client.UploadedFilePaths == nil {
-		client.UploadedFilePaths = map[string]string{}
+func (c *DummyClient) Upload(ctx *context.Context, releaseID string, artifact *artifact.Artifact, file *os.File) error {
+	c.Lock.Lock()
+	defer c.Lock.Unlock()
+	if c.UploadedFilePaths == nil {
+		c.UploadedFilePaths = map[string]string{}
 	}
 	// ensure file is read to better mimic real behavior
 	_, err := ioutil.ReadAll(file)
 	if err != nil {
 		return errors.Wrapf(err, "unexpected error")
 	}
-	if client.FailToUpload {
+	if c.FailToUpload {
 		return errors.New("upload failed")
 	}
-	if client.FailFirstUpload {
-		client.FailFirstUpload = false
-		return errors.New("upload failed, should retry")
+	if c.FailFirstUpload {
+		c.FailFirstUpload = false
+		return client.RetriableError{errors.New("upload failed, should retry")}
 	}
-	client.UploadedFile = true
-	client.UploadedFileNames = append(client.UploadedFileNames, artifact.Name)
-	client.UploadedFilePaths[artifact.Name] = artifact.Path
+	c.UploadedFile = true
+	c.UploadedFileNames = append(c.UploadedFileNames, artifact.Name)
+	c.UploadedFilePaths[artifact.Name] = artifact.Path
 	return nil
 }
diff --git a/internal/pipe/scoop/scoop_test.go b/internal/pipe/scoop/scoop_test.go
index e6e93f9b..96ee9508 100644
--- a/internal/pipe/scoop/scoop_test.go
+++ b/internal/pipe/scoop/scoop_test.go
@@ -825,14 +825,10 @@ func Test_buildManifest(t *testing.T) {
 						"ArtifactUploadHash": "820ead5d9d2266c728dce6d4d55b6460",
 						"Builds": []*artifact.Artifact{
 							{
-								Extra: map[string]interface{}{
-									"Binary": "foo",
-								},
+								Name: "foo",
 							},
 							{
-								Extra: map[string]interface{}{
-									"Binary": "bar",
-								},
+								Name: "bar",
 							},
 						},
 					},
@@ -846,14 +842,10 @@ func Test_buildManifest(t *testing.T) {
 						"ArtifactUploadHash": "820ead5d9d2266c728dce6d4d55b6460",
 						"Builds": []*artifact.Artifact{
 							{
-								Extra: map[string]interface{}{
-									"Binary": "foo",
-								},
+								Name: "foo",
 							},
 							{
-								Extra: map[string]interface{}{
-									"Binary": "bar",
-								},
+								Name: "bar",
 							},
 						},
 					},