Skip to content

Commit

Permalink
feat: add acl option for s3 (#732)
Browse files Browse the repository at this point in the history
  • Loading branch information
mgrachev authored and caarlos0 committed Jul 21, 2018
1 parent abd30cc commit e77f666
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions config/config.go
Expand Up @@ -281,6 +281,7 @@ type S3 struct {
Folder string
Profile string
Endpoint string // used for minio for example
ACL string
}

// Put HTTP upload configuration
Expand Down
4 changes: 4 additions & 0 deletions pipeline/s3/s3.go
Expand Up @@ -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
}
Expand Down Expand Up @@ -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
})
Expand Down
1 change: 1 addition & 0 deletions pipeline/s3/s3_test.go
Expand Up @@ -49,6 +49,7 @@ func TestDefaults(t *testing.T) {
Bucket: "foo",
Region: "us-east-1",
Folder: "{{ .ProjectName }}/{{ .Tag }}",
ACL: "private",
}}, ctx.Config.S3)
}

Expand Down
4 changes: 4 additions & 0 deletions www/content/s3.md
Expand Up @@ -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

Expand Down

0 comments on commit e77f666

Please sign in to comment.