blob: 4d5b7bdf1648a4310869242b63549133ae25f803 [file] [log] [blame] [view]
Gary Tongd6f657362023-08-04 16:33:281# Moving large files to Google Storage
2
3## Problem
4
5There are large binary files checked into our source tree. When we used SVN,
6this was suboptimal but bearable because everyone only had the top level
7checkout of the files.
8
9As we switch to git, the problem becomes worse because now every will have every
10large binary ever checked in.
11
12## Solution
13
Joanna Wang9b32ab4c2025-01-07 16:39:0814Hash the large files, check in the large files into Google Storage, add the GCS
15object as a dependency in the DEPS file. Files will be fetched from Google
16Storage during `gclient sync`.
Gary Tongd6f657362023-08-04 16:33:2817
18## Steps
19
20### Step 1. Create a Google Storage bucket
21
22For Android-related files, it might be appropriate to use the shared
23chromium-android-tools bucket. Create a new folder in the bucket, and use
24chromium-android-tools/[new folder name] as the bucket name.
25
Rileya73939f92025-01-06 14:33:4626Otherwise, to create a new bucket you can add an entry into
27[bucket.json](http://shortn/_wkOtCQm10E). Entries within `bucket.json` should
28aim to answer the below questions. Afterwards, send the CL to a coworker for review.
Joanna Wang9b32ab4c2025-01-07 16:39:0829After that is approved, someone from chops security will do a final review.
Gary Tongd6f657362023-08-04 16:33:2830
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
47This command will create a boto config file at
48/usr/local/google/home/magjed/.boto.depot_tools containing your
49credentials, based on your responses to the following questions.
50Please navigate your browser to the following URL:
51https://accounts.google.com/o/oauth2/auth?<...snip...>
52Enter the authorization code: <Enter code here>
53Please navigate your browser to https://cloud.google.com/console#/project,
54then find the project you will use, and copy the Project ID string from the
55second column. Older projects do not have Project ID strings. For such
56projects, click the project and then copy the Project Number listed under that
57project.
58What is your project-id? <Enter project ID here>
59Boto config file "/usr/local/google/home/magjed/.boto.depot_tools"
60created.
61```
62
63You will be asked for "project-id", type whatever you want there, "browser" is
64typical.
65
66### Step 3. Check your files into the bucket
67
Joanna Wang9b32ab4c2025-01-07 16:39:0868Once 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)
70for adding GCS objects as a dependency in the DEPS file.
Gary Tongd6f657362023-08-04 16:33:2871
Joanna Wang9b32ab4c2025-01-07 16:39:0872### Step 4. Add the file names to .gitignore.
Gary Tongd6f657362023-08-04 16:33:2873
74This is so that the files do not show up in a git status.