From e77f666cd9ca7c59a597dabe769e1e6e7f5f33f5 Mon Sep 17 00:00:00 2001 From: Grachev Mikhail Date: Sun, 22 Jul 2018 01:07:20 +0300 Subject: [PATCH] feat: add acl option for s3 (#732) --- config/config.go | 1 + pipeline/s3/s3.go | 4 ++++ pipeline/s3/s3_test.go | 1 + www/content/s3.md | 4 ++++ 4 files changed, 10 insertions(+) diff --git a/config/config.go b/config/config.go index 30c107a07..675500864 100644 --- a/config/config.go +++ b/config/config.go @@ -281,6 +281,7 @@ type S3 struct { Folder string Profile string Endpoint string // used for minio for example + ACL string } // Put HTTP upload configuration diff --git a/pipeline/s3/s3.go b/pipeline/s3/s3.go index fbadfb671..26e08b7bd 100644 --- a/pipeline/s3/s3.go +++ b/pipeline/s3/s3.go @@ -38,6 +38,9 @@ func (Pipe) Default(ctx *context.Context) error { if s3.Region == "" { s3.Region = "us-east-1" } + if s3.ACL == "" { + s3.ACL = "private" + } } return nil } @@ -99,6 +102,7 @@ func upload(ctx *context.Context, conf config.S3) error { Bucket: aws.String(conf.Bucket), Key: aws.String(filepath.Join(folder, artifact.Name)), Body: f, + ACL: aws.String(conf.ACL), }) return err }) diff --git a/pipeline/s3/s3_test.go b/pipeline/s3/s3_test.go index 19fc78968..6ed3f8a24 100644 --- a/pipeline/s3/s3_test.go +++ b/pipeline/s3/s3_test.go @@ -49,6 +49,7 @@ func TestDefaults(t *testing.T) { Bucket: "foo", Region: "us-east-1", Folder: "{{ .ProjectName }}/{{ .Tag }}", + ACL: "private", }}, ctx.Config.S3) } diff --git a/www/content/s3.md b/www/content/s3.md index 5b45174e7..cddb9545e 100644 --- a/www/content/s3.md +++ b/www/content/s3.md @@ -39,9 +39,13 @@ s3: # want to push your artifacts to a minio server for example. # Default is AWS S3 URL. endpoint: "http://minio.foo.com" + # Sets the ACL of the object using the specified canned ACL. + # Default is private. + acl: public-read ``` > Learn more about the [name template engine](/templates). +> Learn more about the [acl](https://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectPUTacl.html). ## Authentication