Skip to content

Commit a441b72

Browse files
authored
Migrate old Google Doc draft (#124)
1 parent 04730f4 commit a441b72

File tree

1 file changed

+235
-16
lines changed

1 file changed

+235
-16
lines changed

rfcs/main_branch.md

Lines changed: 235 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,241 @@ Rename `master` branch to `main` in all repositories in the [web-platform-tests
66

77
## Details
88

9-
These are our existing repos, excluding archived and private ones:
10-
- https://github.com/web-platform-tests/data-migration
11-
- https://github.com/web-platform-tests/editor
12-
- https://github.com/web-platform-tests/rfcs
13-
- https://github.com/web-platform-tests/wpt
14-
- https://github.com/web-platform-tests/wpt-empty
15-
- https://github.com/web-platform-tests/wpt-metadata
16-
- https://github.com/web-platform-tests/wpt-pr-bot
17-
- https://github.com/web-platform-tests/wpt.fyi
18-
- https://github.com/web-platform-tests/wpt.live
19-
20-
TODO: which external repos hardcode the name of the default branch in any WPT repo?
21-
22-
TODO: which repos need to maintain a `master` branch during a transition period?
23-
24-
TODO: impact on open PRs?
9+
### wpt.fyi
10+
11+
[https://github.com/web-platform-tests/wpt.fyi](https://github.com/web-platform-tests/wpt.fyi)
12+
13+
#### Run labelling
14+
15+
**Example**: [https://wpt.fyi/api/runs?label=master](https://wpt.fyi/api/runs?label=master)
16+
17+
Today we use the term 'master' to label runs that come from either pushes to the master branch in
18+
WPT (for Chrome Dev and Firefox Nightly) or from the various epoch/\* branches for other browsers
19+
and channels. These runs should be complete runs of the full test suite (as opposed to partial runs
20+
done for pull-requests), so are considered the most useful for displaying on wpt.fyi.
21+
22+
There are two considerations to how this label is used:
23+
24+
1. Internally to the service (the variable/method names 'shared.MasterLabel' or 'IsMasterBranch',
25+
values stored in the datastore, etc) - these could be renamed without too much difficulty.
26+
27+
- For example, one could consider renaming the concept to 'complete' runs, such that we had
28+
'shared.CompleteRunLabel'.
29+
30+
- Method names like IsMasterBranch are harder to change until WPT changes its branch naming
31+
convention.
32+
33+
2. Externally accessible information, e.g. as used in the APIs. We allow querying runs based on
34+
their label, and both the [wpt.fyi](http://wpt.fyi) frontend and other callers may
35+
rely on \`label=master\` today.
36+
37+
- This would be a slow process of introducing an alternative label (again say 'complete'),
38+
labelling runs as both in the datastore (data fixups can be done with [existing
39+
utilities](https://github.com/web-platform-tests/data-migration)), and then slowly
40+
switching over consumers to the new label name.
41+
42+
There are approximately 200 references to the string 'master' in the wpt.fyi codebase:
43+
44+
- 106 in api/
45+
46+
- 60 in webapp/
47+
48+
- 28 in shared/
49+
50+
- 4 in util/
51+
52+
- 4 in webdriver/
53+
54+
#### Primary branch name
55+
56+
~~Today wpt.fyi has 'master' as its primary branch name in GitHub. Changing this to e.g. 'main'
57+
would require at least:~~
58+
59+
- ~~Creating the new branch ('git branch -m master main; git push -u origin main'),~~
60+
61+
- ~~Changing the primary branch in GitHub,~~
62+
63+
- ~~Editing all open pull requests (currently only 5) to have 'main' as their target,~~
64+
65+
- ~~Switching the branch protection rules to apply to 'main', and~~
66+
67+
- ~~Updating the CI workflows (e.g. \`.github/workflows/ci.yml\`) to run on the new branch.~~
68+
69+
- ~~Deleting the master branch~~
70+
71+
~~There is also a reference to 'master' in the gcloud deployment steps in the Makefile.~~
72+
73+
~~I am not aware of any downstream consumers of the branch name for wpt.fyi, so we could likely do
74+
the introduction of 'main' as a mostly-atomic move with no prerequisites.~~
75+
76+
### WPT
77+
78+
[https://github.com/web-platform-tests/wpt](https://github.com/web-platform-tests/wpt)
79+
80+
#### Primary branch name
81+
82+
Today wpt.fyi has 'master' as its primary branch name in GitHub. Changing this to e.g. 'main' would
83+
have similar steps [as for wpt.fyi](#wpt.fyi) (e.g. changing the primary GitHub
84+
branch, branch protection, etc), but with more complexity due to having more continuous integration
85+
(CI) systems and many downstream consumers.
86+
87+
##### Outstanding Pull Requests
88+
89+
WPT currently has 754 open pull requests, almost all targeting the 'master' branch. These would all
90+
need to be updated to target the 'main' branch instead.
91+
92+
This can be done manually by maintainers (by editing the pull request via the GitHub API), but it
93+
appears that we could also use the [GitHub REST
94+
API](https://developer.github.com/v3/pulls/#update-a-pull-request) to do this via PATCH
95+
requests to open pull requests (changing the 'base' branch to e.g. 'main').
96+
97+
#### Continuous Integration systems
98+
99+
##### Taskcluster
100+
101+
One of our two CI systems for running the test suite on browsers. Taskcluster has a few
102+
dependencies on the name 'master', but all could be done ahead of a switchover.
103+
104+
- .taskcluster.yml would need 'main' added as a trigger branch
105+
106+
- tools/ci/tc/tasks/test.yml would need 'main' added as a trigger branch
107+
108+
- tools/ci/tc/download.py uses 'master' as the default branch for its '--ref' argument.
109+
110+
- This is the tc-download wpt command, but it is unclear if it is used in any automated setting -
111+
perhaps this could be changed after the fact.
112+
113+
- tools/docker/start.sh uses 'master' as a default ref, but it appears that the only caller
114+
(tools/ci/tc/decision.py) passes an explicit ref anyway.
115+
116+
- This could possibly just be removed.
117+
118+
##### Azure Pipelines
119+
120+
Our other CI system for running the test suite on browsers. Azure Pipelines does not run on
121+
'master' today, so I believe it requires no changes in the case of a branch name switch.
122+
123+
##### Pull-request previews (wptpr.live integration)
124+
125+
This is a pair of GitHub Actions that support previewing pull requests on wptpr.live. For the
126+
actions themselves (see [Downstream Consumers of WPT branch
127+
names](#downstream-consumers-of-wpt-branch-names) for the wptpr.live side), there are two
128+
places that reference 'master':
129+
130+
- .github/workflows/detect_pull_request_preview.yml deliberately checks out the 'master' branch
131+
specifically.
132+
133+
- This would have to change to 'main', and would have to happen as part of the 'atomic'
134+
switchover.
135+
136+
- tools/ci/tests/test_pr_preview.py uses it in the testing logic as part of a set; this can be
137+
changed at any point (the test creates a temporary git repository via git-init, so that would
138+
have to change to not create a 'master' branch).
139+
140+
##### Manifest generation
141+
142+
This is a GitHub Action that publishes WPT MANIFEST.json files as [GitHub
143+
releases](https://github.com/web-platform-tests/wpt/releases). There are two places that
144+
reference 'master':
145+
146+
- .github/workflows/manifest.yml triggers on pushes to master; this could be changed ahead of time
147+
to also trigger on pushes to e.g. 'main'
148+
149+
- tools/ci/manifest_build.py checks for 'master' to determine if this is a dry-run or not; another
150+
branch name could be added to this check ahead of time.
151+
152+
##### Epochs
153+
154+
No obvious dependency. (Uses the default branch when checking out the code.)
155+
156+
#### Documentation
157+
158+
WPT has a sizeable amount of documentation (in docs/), which is generated by a GitHub action.
159+
Changes to both the generation process and the documentation itself would be necessary:
160+
161+
**docs/ generation**:
162+
163+
- .github/workflows/documentation.yml triggers on push to master; this could be changed ahead of
164+
time to also trigger on pushes to e.g. 'main'
165+
166+
- tools/ci/website_build.sh checks for 'master' to only publish when run via the GitHub Action;
167+
this could be changed ahead of time to also publish for e.g. 'main'.
168+
169+
**docs/ documentation**:
170+
171+
- Three files have substantial content that mention 'master':
172+
173+
- docs/reviewing-tests/git.md
174+
175+
- docs/reviewing-tests/reverting.md
176+
177+
- docs/writing-tests/github-intro.md
178+
179+
- Plus some minor links/etc in other documents.
180+
181+
**README.md**
182+
183+
- There are a few minor notes about 'master' here.
184+
185+
#### WPT tools/ codebase
186+
187+
There are a few places in the WPT infrastructure code that interact with 'master'.
188+
189+
##### wpt branch-point
190+
191+
- tools/wpt/testfiles.py checks for 'master' in 'branch_point()', would need changed as part of the
192+
migration to use e.g. 'main'.
193+
194+
- **Note**: it is unclear to me who uses this tool?
195+
196+
##### wptrunner
197+
198+
- tools/wptrunner/wptrunner.default.ini references 'master', but I'm unsure of the purpose of this
199+
file.
200+
201+
#### Uses of 'master' in test suites
202+
203+
Some minor documentation changes (e.g. in css/README.md) would be required, but would be
204+
non-blocking.
205+
206+
#### Downstream Consumers of WPT branch names
207+
208+
This is one of the trickiest areas of changing the default branch name in WPT; there are multiple
209+
consumers of WPT that rely on the branch name today.
210+
211+
The ones I am aware of are:
212+
213+
- wpt.fyi:
214+
215+
- Would need to be updated to accept either 'master' or (e.g.) 'main' ahead of a switch of branch
216+
name. See [wpt.fyi](#wpt.fyi) above.
217+
218+
- wpt.live:
219+
220+
- src/supervisord.conf pulls from the 'master' branch specifically, this would need updated.
221+
222+
- Similarly, 'master' is passed to fetch-wpt.py as the branch to fetch from.
223+
224+
- These would be difficult to update ahead of time; they could possibly be removed entirely and
225+
rely on the default branch.
226+
227+
- w3c-test.org:
228+
229+
- This may also pull directly from master like wpt.live, unknown.
230+
231+
- There is also the web-test runner, not sure if that has any dependencies on WPT branch names.
232+
233+
- Various sync bots (might have “master” hard coded)
234+
235+
- autofoolip
236+
237+
- wpt-pr-bot
238+
239+
- Downstream mirrors
240+
241+
- Chromium mirror:
242+
[https://chromium.googlesource.com/external/github.com/web-platform-tests/wpt/](https://chromium.googlesource.com/external/github.com/web-platform-tests/wpt/)
243+
(used by wpt-importer to avoid GitHub network issues)
25244

26245
## Risk
27246

0 commit comments

Comments
 (0)