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:
Ondřej Budai 2022-08-15 15:57:43 +02:00 committed by Sanne Raymaekers
parent 54e2c2304c
commit d78f1e6229
5 changed files with 156 additions and 114 deletions

View file

@ -6,6 +6,14 @@ source /usr/libexec/tests/osbuild-composer/shared_lib.sh
OSTREE_REF="test/rhel/8/edge"
function createReqFileEdge() {
local public_block=
# on Fedora, upload the artifact publicly, so we can later check the
# URL created by composer is just public, not presigned
if [[ $ID == "fedora" ]]; then
public_block=',"public": true'
fi
cat > "$REQUEST_FILE" << EOF
{
"distribution": "$DISTRO",
@ -39,7 +47,7 @@ function createReqFileEdge() {
"ref": "${OSTREE_REF}"
},
"upload_options": {
"region": "${AWS_REGION}"
"region": "${AWS_REGION}"${public_block}
}
}
}