Skip to content

Commit

Permalink
Merge pull request #11994 from spiffxp/no-acls-for-you
Browse files Browse the repository at this point in the history
hack/upload: avoid ACLs for GCS buckets with UBLA enabled
  • Loading branch information
k8s-ci-robot authored Jul 15, 2021
2 parents 15c2230 + e4ae593 commit 48497b3
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion hack/upload
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,14 @@ if [[ "${DEST:0:5}" == "s3://" ]]; then
fi

if [[ "${DEST:0:5}" == "gs://" ]]; then
gsutil -h "Cache-Control:private,max-age=0" rsync -r ${PUBLIC:+-a public-read} ${SRC} ${DEST}
bucket=$(echo "${DEST}" | cut -d/ -f1-3)
acl_flag="${PUBLIC:+-a public-read}"
# GCS buckets with UBLA enabled error on attempts to set ACLs
# ref: https://cloud.google.com/storage/docs/uniform-bucket-level-access#enabled
if gsutil ubla get "${bucket}" | grep -q "Enabled: True" 2>/dev/null; then
acl_flag=""
fi
gsutil -h "Cache-Control:private,max-age=0" rsync -r ${acl_flag} ${SRC} ${DEST}
exit 0
fi

Expand Down

0 comments on commit 48497b3

Please sign in to comment.