Skip to content

Commit 2d70aa8

Browse files
committed
docs: update default-branch-migration.md
specifically - remove reference to prow retriggering presubmits on PR rename (thanks for the fix GitHub! ❤️) - add links to issues for bootstrap and pod-utils not supporting default branch as a concept - add snippets showing how to auto-detect remote branch - misc rewording or rephrasing
1 parent e04cba9 commit 2d70aa8

File tree

1 file changed

+48
-21
lines changed

1 file changed

+48
-21
lines changed

github-management/default-branch-migration.md

Lines changed: 48 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@ on the [#github-management] channel on slack or open an issue in the [kubernetes
2020

2121
## Prerequisites
2222

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-
2723
- [ ] Create an issue in your repo to track the branch rename.
2824
You can paste this checklist in the issue body.
2925

@@ -42,12 +38,12 @@ covered in this checklist.
4238

4339
### Anytime
4440

45-
These changes are **non-disruptive** and can be made anytime before
46-
renaming the branch.
41+
These changes are **non-disruptive** and can be made anytime before renaming
42+
the branch.
4743

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).
44+
- [ ] If a presubmit or postsubmit prowjob triggers on the `master` branch
45+
(`branches` field of the prowjob), add the `main` branch to the list
46+
(see [kubernetes/test-infra#20665] for an example).
5147

5248
- [ ] If the [`milestone_applier`] prow config references the `master` branch,
5349
add the `main` branch to the config (see [kubernetes/test-infra#20675] for an example).
@@ -57,20 +53,45 @@ add the `main` branch to the config.
5753

5854
### Just before rename
5955

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.
56+
These changes are **disruptive** and should be made just before renaming the
57+
branch.
58+
59+
- [ ] For periodic prowjobs, or any prowjob that mentions the `master` branch
60+
in `base_ref`, update them to the `main` branch. Ensure that these changes
61+
happen in lock-step with the branch rename (jobs triggered in between landing
62+
these changes and renaming the branch will fail).
63+
- For bootstrap-based jobs, ensure the branch is explicitly specified,
64+
e.g. `kubernetes/foo=main`. [kubernetes/test-infra#20667] may eventually
65+
allow for non-disruptive changes.
66+
- For pod-utils based jobs, ensure the branch is explicitly specified,
67+
e.g. `base_ref: main`. [kubernetes/test-infra#20672] may eventually allow
68+
for non-disruptive changes.
69+
70+
- [ ] If a prowjob mentions `master` in its name, rename the job to not include
71+
the branch name, e.g. `pull-repo-verify-master` -> `pull-repo-verify`.
72+
[`status-reconciler`] should automatically migrate PR status contexts to the
73+
new job name, and retrigger accordingly, but we have anecdotally found it
74+
sometimes misses changes.
75+
- NOTE: our infrastructure doesn't understand the concept of job renames, so
76+
from the perspective of e.g. https://testgrid.k8s.io the job will appear to
77+
have lost history and start from scratch.
7178

7279
- [ ] If a prowjob calls scripts or code in your repo that explicitly
73-
reference `master`, update all references to use `main`.
80+
reference `master`, update all references to use `main`, or auto-detect the
81+
remote branch
82+
- e.g. using git to auto-detect
83+
```sh
84+
# for existing clones, update their view of the remote
85+
git fetch origin
86+
git remote set-head origin -a
87+
# for new clones, or those updated as above, this prints "main" post-rename
88+
echo $(git symbolic-ref refs/remotes/origin/HEAD)
89+
```
90+
- e.g. using github's api to auto-detect
91+
```sh
92+
# gh is https://github.com/cli/cli, this will print "main" post-rename
93+
gh api /repos/kubernetes-sigs/slack-infra | jq -r .default_branch
94+
```
7495

7596
- [ ] If the repo has netlify configured for it, ask a member of the GitHub
7697
Management Team to rename the `master` branch to `main` in the netlify site config.
@@ -114,8 +135,13 @@ remove it from the config.
114135
(URLs will be automatically redirected).
115136

116137
- [ ] Ensure that CI and PR tests work fine.
138+
- If there are any outstanding PRs you can /approve to merge, do so to verify
139+
that presubmits and postsubmits work as expected
117140

118141
- [ ] Trial the local development experience with a pre-rename clone.
142+
- ensure [Github instructions to rename your local branch] work
143+
- consider updating your fork's default remote branch name such that if you
144+
have git autocompletion enabled, typing `ma<tab>` will autocomplete to `main`
119145

120146
- [ ] Send a notice about the branch rename to your SIG's mailing list.
121147
Include the link to the [GitHub instructions to rename your local branch].
@@ -126,6 +152,7 @@ Include the link to the [GitHub instructions to rename your local branch].
126152
[kubernetes/test-infra#20665]: https://github.com/kubernetes/test-infra/pull/20665
127153
[kubernetes/test-infra#20667]: https://github.com/kubernetes/test-infra/issues/20667
128154
[kubernetes/test-infra#20669]: https://github.com/kubernetes/test-infra/pull/20669
155+
[kubernetes/test-infra#20672]: https://github.com/kubernetes/test-infra/issues/20672
129156
[kubernetes/test-infra#20675]: https://github.com/kubernetes/test-infra/pull/20675
130157
[`status-reconciler`]: https://github.com/kubernetes/test-infra/tree/master/prow/cmd/status-reconciler
131158
[`branch_protection`]: https://github.com/kubernetes/test-infra/blob/ca6273046b355d38eade4c4bd435bd13fbb55043/config/prow/config.yaml#L131

0 commit comments

Comments
 (0)