Gary Tong | d6f65736 | 2023-08-04 16:33:28 | [diff] [blame] | 1 | # Moving large files to Google Storage |
| 2 | |
| 3 | ## Problem |
| 4 | |
| 5 | There are large binary files checked into our source tree. When we used SVN, |
| 6 | this was suboptimal but bearable because everyone only had the top level |
| 7 | checkout of the files. |
| 8 | |
| 9 | As we switch to git, the problem becomes worse because now every will have every |
| 10 | large binary ever checked in. |
| 11 | |
| 12 | ## Solution |
| 13 | |
Joanna Wang | 9b32ab4c | 2025-01-07 16:39:08 | [diff] [blame] | 14 | Hash the large files, check in the large files into Google Storage, add the GCS |
| 15 | object as a dependency in the DEPS file. Files will be fetched from Google |
| 16 | Storage during `gclient sync`. |
Gary Tong | d6f65736 | 2023-08-04 16:33:28 | [diff] [blame] | 17 | |
| 18 | ## Steps |
| 19 | |
| 20 | ### Step 1. Create a Google Storage bucket |
| 21 | |
| 22 | For Android-related files, it might be appropriate to use the shared |
| 23 | chromium-android-tools bucket. Create a new folder in the bucket, and use |
| 24 | chromium-android-tools/[new folder name] as the bucket name. |
| 25 | |
Riley | a73939f9 | 2025-01-06 14:33:46 | [diff] [blame] | 26 | Otherwise, to create a new bucket you can add an entry into |
| 27 | [bucket.json](http://shortn/_wkOtCQm10E). Entries within `bucket.json` should |
| 28 | aim to answer the below questions. Afterwards, send the CL to a coworker for review. |
Joanna Wang | 9b32ab4c | 2025-01-07 16:39:08 | [diff] [blame] | 29 | After that is approved, someone from chops security will do a final review. |
Gary Tong | d6f65736 | 2023-08-04 16:33:28 | [diff] [blame] | 30 | |
| 31 | * Who can have read access to this bucket? Certain groups at Google? All of |
| 32 | Google? All of Chrome-Team? Everyone? Consider adding googlers@chromium.org to |
| 33 | private buckets for those who use their @chromium.org account for auth with |
| 34 | depot_tools. |
| 35 | * Who can have read/write access to this bucket? Certain groups at Google |
| 36 | (@google.com group)? All of Chrome-team? All of Google? |
| 37 | * Give this bucket a name. "chromium-something" is good for public buckets, |
| 38 | "chrome-something" is good for private buckets. |
| 39 | |
| 40 | ### Step 2. Set up gcloud auth tokens with your @google.com account |
| 41 | (not required if already authenticated) |
| 42 | |
| 43 | *IMPORTANT: Make sure you use your @google.com account.* |
| 44 | |
| 45 | ``` |
| 46 | $ download_from_google_storage --config |
| 47 | This command will create a boto config file at |
| 48 | /usr/local/google/home/magjed/.boto.depot_tools containing your |
| 49 | credentials, based on your responses to the following questions. |
| 50 | Please navigate your browser to the following URL: |
| 51 | https://accounts.google.com/o/oauth2/auth?<...snip...> |
| 52 | Enter the authorization code: <Enter code here> |
| 53 | Please navigate your browser to https://cloud.google.com/console#/project, |
| 54 | then find the project you will use, and copy the Project ID string from the |
| 55 | second column. Older projects do not have Project ID strings. For such |
| 56 | projects, click the project and then copy the Project Number listed under that |
| 57 | project. |
| 58 | What is your project-id? <Enter project ID here> |
| 59 | Boto config file "/usr/local/google/home/magjed/.boto.depot_tools" |
| 60 | created. |
| 61 | ``` |
| 62 | |
| 63 | You will be asked for "project-id", type whatever you want there, "browser" is |
| 64 | typical. |
| 65 | |
| 66 | ### Step 3. Check your files into the bucket |
| 67 | |
Joanna Wang | 9b32ab4c | 2025-01-07 16:39:08 | [diff] [blame] | 68 | Once you have your shiny new bucket, follow the |
| 69 | [instructions](https://chromium.googlesource.com/chromium/src/+/HEAD/docs/gcs_dependencies.md#upload-a-new-object-to-gcs) |
| 70 | for adding GCS objects as a dependency in the DEPS file. |
Gary Tong | d6f65736 | 2023-08-04 16:33:28 | [diff] [blame] | 71 | |
Joanna Wang | 9b32ab4c | 2025-01-07 16:39:08 | [diff] [blame] | 72 | ### Step 4. Add the file names to .gitignore. |
Gary Tong | d6f65736 | 2023-08-04 16:33:28 | [diff] [blame] | 73 | |
| 74 | This is so that the files do not show up in a git status. |