mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-02-15 13:53:25 +02:00
fix: upload gcs blobs to bucket root (#2409)
* fix: upload gcs blobs to bucket root * test: blob upload to bucket root Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> Co-authored-by: Adam Bouqdib <adam@abemedia.co.uk>
This commit is contained in:
parent
43b91b6baf
commit
3966921c86
@ -127,6 +127,43 @@ func TestMinioUploadCustomBucketID(t *testing.T) {
|
|||||||
require.NoError(t, Pipe{}.Publish(ctx))
|
require.NoError(t, Pipe{}.Publish(ctx))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestMinioUploadRootFolder(t *testing.T) {
|
||||||
|
listen := randomListen(t)
|
||||||
|
folder := t.TempDir()
|
||||||
|
tgzpath := filepath.Join(folder, "bin.tar.gz")
|
||||||
|
debpath := filepath.Join(folder, "bin.deb")
|
||||||
|
require.NoError(t, os.WriteFile(tgzpath, []byte("fake\ntargz"), 0o744))
|
||||||
|
require.NoError(t, os.WriteFile(debpath, []byte("fake\ndeb"), 0o744))
|
||||||
|
ctx := context.New(config.Project{
|
||||||
|
Dist: folder,
|
||||||
|
ProjectName: "testupload",
|
||||||
|
Blobs: []config.Blob{
|
||||||
|
{
|
||||||
|
Provider: "s3",
|
||||||
|
Bucket: "test",
|
||||||
|
Folder: "/",
|
||||||
|
Endpoint: "http://" + listen,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
ctx.Git = context.GitInfo{CurrentTag: "v1.0.0"}
|
||||||
|
ctx.Artifacts.Add(&artifact.Artifact{
|
||||||
|
Type: artifact.UploadableArchive,
|
||||||
|
Name: "bin.tar.gz",
|
||||||
|
Path: tgzpath,
|
||||||
|
})
|
||||||
|
ctx.Artifacts.Add(&artifact.Artifact{
|
||||||
|
Type: artifact.LinuxPackage,
|
||||||
|
Name: "bin.deb",
|
||||||
|
Path: debpath,
|
||||||
|
})
|
||||||
|
name := "root_folder"
|
||||||
|
start(t, name, listen)
|
||||||
|
prepareEnv()
|
||||||
|
require.NoError(t, Pipe{}.Default(ctx))
|
||||||
|
require.NoError(t, Pipe{}.Publish(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
func TestMinioUploadInvalidCustomBucketID(t *testing.T) {
|
func TestMinioUploadInvalidCustomBucketID(t *testing.T) {
|
||||||
listen := randomListen(t)
|
listen := randomListen(t)
|
||||||
folder := t.TempDir()
|
folder := t.TempDir()
|
||||||
|
@ -6,6 +6,7 @@ import (
|
|||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/apex/log"
|
"github.com/apex/log"
|
||||||
"github.com/goreleaser/goreleaser/internal/artifact"
|
"github.com/goreleaser/goreleaser/internal/artifact"
|
||||||
@ -67,6 +68,7 @@ func doUpload(ctx *context.Context, conf config.Blob) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
folder = strings.TrimPrefix(folder, "/")
|
||||||
|
|
||||||
bucketURL, err := urlFor(ctx, conf)
|
bucketURL, err := urlFor(ctx, conf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user