Skip to content

Commit 198374d

Browse files
committed
github-management: add docs for master to main migration
This document is meant to be used by repos without too much traffic, if they wish to migrate the default branch from master to main.
1 parent f56a2db commit 198374d

File tree

1 file changed

+134
-0
lines changed

1 file changed

+134
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
---
2+
title: Default Branch Migration
3+
linkTitle: Default Branch Migration
4+
description: |
5+
Instructions on how to migrate the default branch from master to main.
6+
weight: 99
7+
type: docs
8+
aliases: [ "/rename" ]
9+
---
10+
11+
# Default Branch Migration
12+
13+
This document outlines steps needed to migrate the default branch
14+
of your repo from `master` to `main`.
15+
16+
Note: This document is currently a work in progress.
17+
18+
If you have questions about the process, reach out to the GitHub Management Team
19+
on the [#github-management] channel on slack or open an issue in the [kubernetes/org] repo.
20+
21+
## Prerequisites
22+
23+
- [ ] Ensure that your repo has low PR volume (<20 open PRs) and
24+
less number of periodic jobs. The branch rename will re-trigger
25+
prow on _all_ open PRs, which will cause a huge spike in the CI load.
26+
27+
- [ ] Create an issue in your repo to track the branch rename.
28+
You can paste this checklist in the issue body.
29+
30+
- [ ] If you are not a root approver for the repo, assign a root
31+
approver for approval.
32+
33+
- [ ] Once the issue has been approved, send a notice to your SIG's
34+
mailing list about the potential branch rename.
35+
36+
## Changes pre-rename
37+
38+
Make the following changes _before_ renaming the branch the `master` branch.
39+
40+
Note: There might be additional changes required that have not been
41+
covered in this checklist.
42+
43+
### Anytime
44+
45+
These changes are **non-disruptive** and can be made anytime before
46+
renaming the branch.
47+
48+
- [ ] If a prowjob triggers on the `master` branch (`branches` field
49+
of the prowjob), add the `main` branch to the list
50+
(see [kubernetes/test-infra#20665] for an example).
51+
52+
- [ ] If the [`milestone_applier`] prow config references the `master` branch,
53+
add the `main` branch to the config (see [kubernetes/test-infra#20675] for an example).
54+
55+
- [ ] If the [`branch_protection`] prow config references the `master` branch,
56+
add the `main` branch to the config.
57+
58+
### Just before rename
59+
60+
These changes are **disruptive** and should be made just before
61+
renaming the branch.
62+
63+
- [ ] If a prowjob mentions the `master` branch in `base_ref`,
64+
update it to the `main` branch. For a periodic job, ensure that
65+
the branch is renamed between periodic job runs.
66+
67+
- [ ] If a prowjob mentions `master` in its name, rename the job to
68+
to not include the branch name. [`status-reconciler`] should automatically
69+
migrate the PR status contexts to the new job name but this has not been tested yet.
70+
The job with the new name will also appear as a differt job in Testgrid.
71+
72+
- [ ] If a prowjob calls scripts or code in your repo that explicitly
73+
reference `master`, update all references to use `main`.
74+
75+
- [ ] If the repo has netlify configured for it, ask a member of the GitHub
76+
Management Team to rename the `master` branch to `main` in the netlify site config.
77+
It can't be controlled through the netlify config in the repo.
78+
79+
### Approval
80+
81+
- [ ] Once all non-disruptive tasks have been completed and disruptive tasks
82+
have been identified, assign the GitHub Management team ([@kubernetes/owners])
83+
for approval.
84+
85+
## Rename the default branch
86+
87+
- [ ] Rename the default branch from `master` to `main` using the GitHub UI
88+
by following the [official instructions].
89+
90+
## Changes post-rename
91+
92+
After the default branch has been renamed to `main`, make the following
93+
changes.
94+
95+
Note: There might be additional changes required that have not been
96+
covered in this checklist.
97+
98+
### Prowjobs
99+
100+
- [ ] If a prowjob still references the `master` branch in the `branches` field,
101+
remove the `master` branch (see [kubernetes/test-infra#20669] for an example).
102+
103+
### Prow config
104+
105+
- [ ] If the [`milestone_applier`] prow config references the `master` branch,
106+
remove it from the config.
107+
108+
- [ ] If the [`branch_protection`] prow config references the `master` branch,
109+
remove it from the config.
110+
111+
### Other
112+
113+
- [ ] If any docs reference the `master` branch, update to `main`
114+
(URLs will be automatically redirected).
115+
116+
- [ ] Ensure that CI and PR tests work fine.
117+
118+
- [ ] Trial the local development experience with a pre-rename clone.
119+
120+
- [ ] Send a notice about the branch rename to your SIG's mailing list.
121+
Include the link to the [GitHub instructions to rename your local branch].
122+
123+
[kubernetes/org]: https://github.com/kubernetes/org/issues
124+
[@kubernetes/owners]: https://github.com/orgs/kubernetes/teams/owners
125+
[#github-management]: https://kubernetes.slack.com/messages/github-management
126+
[kubernetes/test-infra#20665]: https://github.com/kubernetes/test-infra/pull/20665
127+
[kubernetes/test-infra#20667]: https://github.com/kubernetes/test-infra/issues/20667
128+
[kubernetes/test-infra#20669]: https://github.com/kubernetes/test-infra/pull/20669
129+
[kubernetes/test-infra#20675]: https://github.com/kubernetes/test-infra/pull/20675
130+
[`status-reconciler`]: https://github.com/kubernetes/test-infra/tree/master/prow/cmd/status-reconciler
131+
[`branch_protection]: https://github.com/kubernetes/test-infra/blob/ca6273046b355d38eade4c4bd435bd13fbb55043/config/prow/config.yaml#L131
132+
[`milestone_applier`]: https://github.com/kubernetes/test-infra/blob/ca6273046b355d38eade4c4bd435bd13fbb55043/config/prow/plugins.yaml#L324
133+
[official instructions]: https://github.com/github/renaming#renaming-existing-branches
134+
[GitHub instructions to rename your local branch]: https://docs.github.com/en/github/administering-a-repository/renaming-a-branch#updating-a-local-clone-after-a-branch-name-changes

0 commit comments

Comments
 (0)