Skip to content

Commit 25f9708

Browse files
authored
Merge pull request #25 from androidx/gcpinstructions
Add instructions on how to set up GCP
2 parents bab179d + 294171b commit 25f9708

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,28 @@ buildCache {
5353
}
5454
}
5555
```
56+
57+
## Setting up Google Cloud Platform project
58+
59+
1. [Install `gcloud` CLI on your machine](https://cloud.google.com/sdk/docs/install)
60+
2. Create a GCP project `YOUR-GCP-PROJECT` and [set up billing](https://cloud.google.com/billing/docs/how-to/manage-billing-account#create_a_new_billing_account).
61+
3. Create a Google Cloud Storage bucket
62+
```bash
63+
gsutil mb –p YOUR-GCP-PROJECT gs://YOUR-BUCKET-NAME
64+
```
65+
4. Create IAM roles for read and read/write
66+
```bash
67+
gcloud iam roles create CacheReadWrite --project=YOUR-GCP-PROJECT --title=CacheReadWrite --description="Have access to read and write to remote Gradle cache" --permissions=storage.buckets.get,storage.objects.create,storage.objects.delete,storage.objects.get,storage.objects.getIamPolicy,storage.objects.list
68+
gcloud iam roles create CacheRead --project=YOUR-GCP-PROJECT --title=CacheRead --description="Have access to read from remote Gradle cache" --permissions=storage.buckets.get,storage.objects.get,storage.objects.getIamPolicy,storage.objects.list
69+
```
70+
5. Create IAM Service Accounts
71+
```bash
72+
gcloud iam service-accounts create cache-read-write --project=YOUR-GCP-PROJECT
73+
gcloud iam service-accounts create cache-read --project=YOUR-GCP-PROJECT
74+
```
75+
6. Grant the service account roles that we just created
76+
```bash
77+
gcloud projects add-iam-policy-binding YOUR-GCP-PROJECT --member=serviceAccount:[email protected] --role=projects/YOUR-GCP-PROJECT/roles/CacheRead
78+
gcloud projects add-iam-policy-binding YOUR-GCP-PROJECT --member=serviceAccount:[email protected] --role=projects/YOUR-GCP-PROJECT/roles/CacheReadWrite
79+
```
80+
7. Use `YOUR-GCP-PROJECT` and `YOUR-BUCKET-NAME` in the plugin configuration with exported service account credentials.

0 commit comments

Comments
 (0)