Skip to content

Commit

Permalink
A few updates to permissions.sh (knative#771)
Browse files Browse the repository at this point in the history
Nits, nits, nits. :)
  • Loading branch information
adrcunha authored and knative-prow-robot committed May 14, 2019
1 parent b3ba92e commit ddaab49
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 19 deletions.
2 changes: 2 additions & 0 deletions ci/prow/boskos/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@

This directory contains the config for our [Boskos](https://github.com/kubernetes/test-infra/tree/master/boskos) instance.

* `config_start.yaml` Initial Boskos configuration.
* `config.yaml` Boskos configuration.
* `permissions.sh` Script to set up permissions for a new Boskos project.
* `resources.yaml` Pool of projects used by Boskos.
40 changes: 24 additions & 16 deletions ci/prow/boskos/permissions.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,36 @@
# See the License for the specific language governing permissions and
# limitations under the License.

project=$1
owners=("[email protected]")
groups=("[email protected]")
sas=("[email protected]" "[email protected]" "[email protected]" "[email protected]")
apis=("compute.googleapis.com" "container.googleapis.com")
set -e

# Add an owner to the project
for owner in ${owners[@]}; do
gcloud projects add-iam-policy-binding $project --member group:$owner --role roles/OWNER
readonly PROJECT=${1:?"First argument must be the new boskos project name."}
readonly OWNERS=("[email protected]")
readonly GROUPS=("[email protected]")
readonly SAS=(
"[email protected]" \
"[email protected]" \
"[email protected]" \
"[email protected]")
readonly APIS=(
"compute.googleapis.com" \
"container.googleapis.com")

# Add an owner to the PROJECT
for owner in ${OWNERS[@]}; do
gcloud projects add-iam-policy-binding ${PROJECT} --member group:${owner} --role roles/OWNER
done

# Add all groups as editors
for group in ${groups[@]}; do
gcloud projects add-iam-policy-binding $project --member group:$group --role roles/EDITOR
# Add all GROUPS as editors
for group in ${GROUPS[@]}; do
gcloud projects add-iam-policy-binding ${PROJECT} --member group:${group} --role roles/EDITOR
done

# Add all service accounts as editors
for sa in ${sas[@]}; do
gcloud projects add-iam-policy-binding $project --member serviceAccount:$sa --role roles/EDITOR
for sa in ${SAS[@]}; do
gcloud projects add-iam-policy-binding ${PROJECT} --member serviceAccount:${sa} --role roles/EDITOR
done

# Enable apis
for api in ${apis[@]}; do
gcloud services enable $api --project=$1
# Enable APIS
for api in ${APIS[@]}; do
gcloud services enable ${api} --project=${PROJECT}
done
6 changes: 3 additions & 3 deletions ci/prow_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@

## Expanding Boskos pool

1. Create a new GCP project and add it to [resources.yaml](./prow/boskos/resources.yaml).
1. Create a new GCP project and add it to [resources.yaml](./prow/boskos/resources.yaml). Please follow the current naming scheme.

1. Run `./ci/prow/boskos/permissions.sh <project_name>` to setup IAM permissions and APIs needed
1. Run `./ci/prow/boskos/permissions.sh <project_name>` to setup the IAM permissions and APIs needed.

1. Run `make update-boskos-config` to update the boskos config.
1. Run `make update-boskos-config` to update the Boskos config.

## Setting up Prow for a new repo (reviewers assignment and auto merge)

Expand Down

0 comments on commit ddaab49

Please sign in to comment.