Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure GCS release bucket has public-read defacl #206

Merged
merged 1 commit into from
Nov 15, 2016

Conversation

ixdy
Copy link
Member

@ixdy ixdy commented Nov 15, 2016

We do this rather than copying artifacts with the public-read ACL,
since doing so will remove any owner ACLs.

x-ref #195.

I haven't checked all of the Jenkins GCS buckets yet, so this may likely break some builds until those buckets are fixed.

cc @zmerlynn @rmmh @david-mcmahon @saad-ali

@@ -378,6 +379,19 @@ release::gcs::ensure_release_bucket() {
if ! $GSUTIL ls "gs://$bucket" >/dev/null 2>&1 ; then
logecho -n "Creating Google Cloud Storage bucket $bucket: "
logrun -s $GSUTIL mb -p "$GCLOUD_PROJECT" "gs://$bucket" || return 1
logecho -n "Adding public-read default ACL on bucket $bucket: "
local current_defacl=$(gsutil defacl get "gs://$bucket") || return 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer local definitions up top. Less clutter in the logic.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/definitions/declarations

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

echo "$current_defacl" | jq '. + [{"entity": "allUsers", "role": "READER"}]' \
> "$new_acl_file" || return 1
logrun -s $GSUTIL defacl set "$new_acl_file" "gs://$bucket" || return 1
rm -f "$new_acl_file"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be logrun'd (no -s) to capture in the log.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

We do this rather than copying artifacts with the public-read ACL,
since doing so will remove any owner ACLs.
@david-mcmahon david-mcmahon added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 15, 2016
@ixdy
Copy link
Member Author

ixdy commented Nov 15, 2016

$ gsutil defacl get gs://kubernetes-release | jq -r '.[] | select(.entity == "allUsers") | .role'
READER
$ gsutil defacl get gs://kubernetes-release-dev | jq -r '.[] | select(.entity == "allUsers") | .role'
READER
$ gsutil defacl get gs://kubernetes-release-pull | jq -r '.[] | select(.entity == "allUsers") | .role'
READER
$ gsutil defacl get gs://kubernetes-federation-release | jq -r '.[] | select(.entity == "allUsers") | .role'
AccessDeniedException: 403 Forbidden
$ gsutil defacl get gs://kubernetes-federation-release-1-4 | jq -r '.[] | select(.entity == "allUsers") | .role'
AccessDeniedException: 403 Forbidden
$ gsutil defacl get gs://kubernetes-federation-release-1-5 | jq -r '.[] | select(.entity == "allUsers") | .role'
AccessDeniedException: 403 Forbidden

@madhusudancs can you check the federation buckets as above to see if the defacls are OK?

@david-mcmahon @saad-ali @jessfraz anago mock mode may fail once this is merged, since the gs://kubernetes-release-$USER bucket created previously might be missing the allUsers: READER defacl.
To fix, you can either delete the existing gs://kubernetes-release-$USER bucket (if there's nothing of value in it), or you can update the defacl:

gsutil defacl ch -u AllUsers:R "gs://kubernetes-release-$USER"

EDIT 2016-11-15 18:17: shorter command

@ixdy
Copy link
Member Author

ixdy commented Nov 15, 2016

@madhusudancs never mind, I was auth'd to the wrong account.

$ gsutil defacl get gs://kubernetes-federation-release | jq -r '.[] | select(.entity == "allUsers") | .role'
$ gsutil defacl get gs://kubernetes-federation-release-1-4 | jq -r '.[] | select(.entity == "allUsers") | .role'
$ gsutil defacl get gs://kubernetes-federation-release-1-5 | jq -r '.[] | select(.entity == "allUsers") | .role'

I will fix.

Interestingly, this probably explains why kubernetes/test-infra#990 only affected the federation release: the other release buckets have a public-read defacl set, so the gsutil acl ch wasn't really necessary for them, and so if some artifacts were missed due to eventual consistency, they were already publicly readable anyway. This wasn't true for the federation buckets.

@ixdy
Copy link
Member Author

ixdy commented Nov 15, 2016

All fixed. Merging.

@ixdy ixdy merged commit 1eefed4 into kubernetes:master Nov 15, 2016
@ixdy
Copy link
Member Author

ixdy commented Nov 15, 2016

I hate Jenkins.

/var/lib/jenkins/workspace/kubernetes-build/_tmp/release.git/lib/releaselib.sh: line 394: jq: command not found

FYI @apelisse

@madhusudancs
Copy link
Contributor

@ixdy interesting. This PR makes the ACLs for federation buckets consistent with everything else right?

@ixdy
Copy link
Member Author

ixdy commented Nov 16, 2016

@madhusudancs I think the owner settings on the federation buckets is still different.

@madhusudancs
Copy link
Contributor

@ixdy Oh! I looked at the owner settings of kubernetes-jenkins. I will leave federation buckets' settings as it is for now because I don't fully understand the settings of kubernetes-jenkins and I don't want to blindly copy paste them.

marpaia pushed a commit to marpaia/release that referenced this pull request Feb 21, 2019
Daily checkpoint for almost-final 1.11 release notes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm "Looks good to me", indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants