cloudapi: add option to upload S3 artifacts publicly
A small test is added to cover this new option. Also, a check for AWS region in the URL was removed. The public URL doesn't actually contain it and it's imho useless - S3 buckets are always tied to a certain region. The elaborate grep command parsing a path from a URI was switched to being a small python script. The python script can actually handle an URI without a query (which was always present in the pre-signed URI, but it's not in the ordinary one) Signed-off-by: Ondřej Budai <ondrej@budai.cz>
This commit is contained in:
parent
54e2c2304c
commit
d78f1e6229
5 changed files with 156 additions and 114 deletions
|
|
@ -375,10 +375,16 @@ func (h *apiHandlers) PostCompose(ctx echo.Context) error {
|
|||
return HTTPError(ErrorJSONUnMarshallingError)
|
||||
}
|
||||
|
||||
public := false
|
||||
if awsS3UploadOptions.Public != nil && *awsS3UploadOptions.Public {
|
||||
public = true
|
||||
}
|
||||
|
||||
key := fmt.Sprintf("composer-api-%s", uuid.New().String())
|
||||
t := target.NewAWSS3Target(&target.AWSS3TargetOptions{
|
||||
Region: awsS3UploadOptions.Region,
|
||||
Key: key,
|
||||
Public: public,
|
||||
})
|
||||
t.ImageName = key
|
||||
t.OsbuildArtifact.ExportFilename = imageType.Filename()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue