Skip to content

Commit

Permalink
Merge pull request #15368 from justinsb/s3_with_no_acls
Browse files Browse the repository at this point in the history
upload helper: support upload to S3 buckets that block ACLs
  • Loading branch information
k8s-ci-robot committed May 8, 2023
2 parents b17421a + 3425d9d commit 543915f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion hack/upload
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,13 @@ if [[ -z "${DEST}" ]]; then
fi

if [[ "${DEST:0:5}" == "s3://" ]]; then
aws s3 sync ${PUBLIC:+--acl public-read} ${SRC} ${DEST}
acl_flag="${PUBLIC:+--acl public-read}"
bucket=$(echo "${DEST}" | cut -d/ -f3)
# S3 buckets with BucketOwnerEnforced error on attempts to set ACLs
if aws s3api get-bucket-ownership-controls --bucket "${bucket}" | grep -q "BucketOwnerEnforced" 2>/dev/null; then
acl_flag=""
fi
aws s3 sync ${acl_flag} ${SRC} ${DEST}
exit 0
fi

Expand Down

0 comments on commit 543915f

Please sign in to comment.