From e800061e8620b4ae6bf3d024ef0e30b7b6d447e8 Mon Sep 17 00:00:00 2001 From: Carlos Alexandro Becker Date: Sun, 7 Jan 2024 14:34:48 -0300 Subject: [PATCH] feat(blob): allow to customize whether to force path style Signed-off-by: Carlos Alexandro Becker Co-authored-by: warjiang <1096409085@qq.com> --- internal/pipe/blob/upload.go | 6 +++++- pkg/config/config.go | 2 +- www/docs/customization/blob.md | 9 ++++++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/internal/pipe/blob/upload.go b/internal/pipe/blob/upload.go index b347d32c884..692327ea4a9 100644 --- a/internal/pipe/blob/upload.go +++ b/internal/pipe/blob/upload.go @@ -53,7 +53,11 @@ func urlFor(ctx *context.Context, conf config.Blob) (string, error) { } if endpoint != "" { query.Add("endpoint", endpoint) - query.Add("s3ForcePathStyle", "true") + if conf.S3ForcePathStyle == nil { + query.Add("s3ForcePathStyle", "true") + } else { + query.Add("s3ForcePathStyle", fmt.Sprintf("%t", *conf.S3ForcePathStyle)) + } } region, err := tmpl.New(ctx).Apply(conf.Region) diff --git a/pkg/config/config.go b/pkg/config/config.go index da1b2a6b680..eefdb89610f 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -1103,7 +1103,7 @@ type Blob struct { Endpoint string `yaml:"endpoint,omitempty" json:"endpoint,omitempty"` // used for minio for example ExtraFiles []ExtraFile `yaml:"extra_files,omitempty" json:"extra_files,omitempty"` Disable string `yaml:"disable,omitempty" json:"disable,omitempty" jsonschema:"oneof_type=string;boolean"` - ForceS3StylePath bool `yaml:"force_s3_style_path,omitempty" json:"force_s3_style_path,omitempty"` + S3ForcePathStyle *bool `yaml:"s3_force_path_style,omitempty" json:"s3_force_path_style,omitempty"` // Deprecated: use disable_ssl instead OldDisableSSL bool `yaml:"disableSSL,omitempty" json:"disableSSL,omitempty" jsonschema:"deprecated=true,description=use disable_ssl instead"` // nolint:tagliatelle diff --git a/www/docs/customization/blob.md b/www/docs/customization/blob.md index f22232e5f09..95279869c7a 100644 --- a/www/docs/customization/blob.md +++ b/www/docs/customization/blob.md @@ -33,7 +33,7 @@ blobs: # Disables SSL # Requires provider to be `s3` - disableSSL: true + disable_ssl: true # Bucket name. # @@ -80,6 +80,12 @@ blobs: - src: LICENSE.tpl dst: LICENSE.txt + # Disable forcing of path style access on S3. + # + # Default: true. + # Since: v1.24 + s3_force_path_style: false + - provider: gs bucket: goreleaser-bucket folder: "foo/bar/{{.Version}}" @@ -117,6 +123,7 @@ blobs: Storage account is set over URL param `storage_account` in `bucket` or in environment variable `AZURE_STORAGE_ACCOUNT` It supports authentication with + - [environment variables](https://docs.microsoft.com/en-us/azure/storage/common/storage-azure-cli#set-default-azure-storage-account-environment-variables): - `AZURE_STORAGE_KEY` or `AZURE_STORAGE_SAS_TOKEN` - [default Azure credential](https://learn.microsoft.com/en-us/azure/developer/go/azure-sdk-authentication-service-principal)