Org: Changing default branch names to `main`

Created on 24 Sep 2020  ·  31Comments  ·  Source: kubernetes/org

Organization or repository

All

Users affected

Global

Describe the issue

This is a long-term tracking issue for renaming the default branch on repositories from master to main. Consider this community tracking for the discussion in https://github.com/github/renaming.

As of today (9/24):

  • Starting on October 1, 2020: newly-created repositories will default to main: https://github.com/github/renaming#on-october-1-2020-newly-created-repositories-will-default-to-main
  • If you are a maintainer of an existing repo, do NOT rename your existing default branch

cc: @kubernetes/owners @kubernetes/wg-naming
/area github-admin
/sig contributor-experience
/wg namin

aregithub-management lifecyclfrozen prioritimportant-longterm sicontributor-experience sirelease sitesting wnaming

Most helpful comment

slightly related ... houndd uses the following to look for master/main ( added in https://github.com/hound-search/hound/pull/345 )

git remote show origin | grep "HEAD branch"

All 31 comments

/wg naming

/sig testing

@justaugustus – Do you think this merits a communication to k/dev?

/assign
cc: @liggitt

@justaugustus – Do you think this merits a communication to k/dev?

@nikhita's initial note to k-dev should suffice at this stage: https://groups.google.com/g/kubernetes-dev/c/jvRPIscaDek/m/1KWEUYXDBQAJ.

The only impact I can think of for new repos would be that the git.k8s.io redirector (http://git.k8s.io/$repo/$path going to https://github.com/kubernetes/$repo/tree/master/$path, e.g. http://git.k8s.io/community/sig-apps) would not work properly.

Starting on October 1, 2020: newly-created repositories will default to main: https://github.com/github/renaming#on-october-1-2020-newly-created-repositories-will-default-to-main

Just to ensure we are on the same page - when we create a new repo in a Kubernetes org after Oct 1, we will set the default branch to master for now, correct? IIUC we'll move _all_ our repos to the main default branch once GitHub solves the issues listed here - https://github.com/github/renaming#later-this-year-seamless-move-for-existing-repositories-

xref https://github.com/kubernetes/website/issues/21749 - k/website issue about changing their default branch to live

The only impact I can think of for _new_ repos would be that the git.k8s.io redirector (http://git.k8s.io/$repo/$path going to https://github.com/kubernetes/$repo/tree/master/$path, e.g. http://git.k8s.io/community/sig-apps) would not work properly.

I think this has been handled by their default redirect: https://github.blog/changelog/2020-07-17-links-to-deleted-branches-now-redirect-to-the-default-branch/

It does mean things would be redirected twice, but that's probably the best scenario for the interim till everything has been switched over.

I think this has been handled by their default redirect: https://github.blog/changelog/2020-07-17-links-to-deleted-branches-now-redirect-to-the-default-branch/

I'm not sure... that seems to only apply to deleted branches. A new repo that only had a main branch would not have a deleted master branch that would trigger that, right?

The only impact I can think of for new repos would be that the git.k8s.io redirector (http://git.k8s.io/$repo/$path going to https://github.com/kubernetes/$repo/tree/master/$path, e.g. http://git.k8s.io/community/sig-apps) would not work properly.

I think we should flip the default branch for _all_ repos at once. We'll also need to update our automation (prow, etc). For git.k8s.io specifically, we'll need to update:

https://github.com/kubernetes/k8s.io/blob/08581c1cd0937d893f0d1ffdfec8ceb8d7aa8356/k8s.io/configmap-nginx.yaml#L215-L223

I'm not sure... that seems to only apply to deleted branches. A new repo that only had a main branch would not have a deleted master branch that would trigger that, right?

You're right. GitHub has confirmed it as well 👍

As just about all our repos are generated off the kubernetes-template-project, they will have a default branch name of master unless we change it there.

I think we should flip the default branch for _all_ repos at once. We'll also need to update our automation (prow, etc). For git.k8s.io specifically, we'll need to update:

Before flipping I do think we should test. It will mean the redirector won't work for the ones we do decide to test, but I think thats an acceptable trade-off for now.

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

/remove-lifecycle stale

On Tue, Dec 29, 2020 at 8:39 PM fejta-bot notifications@github.com wrote:

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually
close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta
https://github.com/fejta.
/lifecycle stale


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/kubernetes/org/issues/2222#issuecomment-752113489,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AD24BUHFIWCHZIRQAX6ITVLSXHWJ3ANCNFSM4RYQRYHQ
.

/priority important-longterm
/lifecycle frozen

Pulling out of slack

Heads up a word from GitHub on the branch rename, it can cause your CI checks to run again during the migration

their current best practice is to turn off CI till things are migrated and then turn it back on

Implied: this is a non-starter for us. For example, if we were to migrate kubernetes/kubernetes right now, the 980 currently open PR's would all re-trigger at once, which is well beyond our CI's capacity.

We're going to need to consider prow changes and how to coordinate them for this. Hopefully it is a matter of config-only changes + a few weeks of babysitting.

Off the top of my head, some things to consider:

  • post-rename, branch_protector may try to recreate master protection, delete main protection
  • presubmits/postsubmits should be updated to listen to both master/main branches
  • job authors need to ensure they're not explicitly checking out 'master'
  • renaming presubmits that have 'master' in their name will rely on status-reconciler to rename PR status contexts, this higher level of usage may expose some bugs (I've seen it fail to rename once recently, ref: https://github.com/kubernetes/test-infra/pull/20498#issuecomment-763087039)

To assess risk / scope of impact, I'm willing to trial the following repos (I'm an active owner / contributor, and they have presubmits/postsubmits/periodics all driven off of master):

Other possible repos (I'm less of an active contributor, but they are less community-blocking):

  • kubernetes-sigs/boskos
  • kubernetes-sigs/kubetest2

/sig release
/area release-eng
Tagging for SIG Release as well, to consider the implications / planning necessary for kubernetes/kubernetes

@spiffxp: The label(s) area/release-eng cannot be applied, because the repository doesn't have them

In response to this:

/sig release
/area release-eng
Tagging for SIG Release as well, to consider the implications / planning necessary for kubernetes/kubernetes

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@justaugustus mentioned on slack that he's looking at trialing:

  • kubernetes/sig-release
  • kubernetes/enhancements

@BenTheElder is interested in doing this for:

  • kubernetes-sigs/kind

Work needed to support moves of larger repos / repos with lots of jobs

Based on lessons learned:

slightly related ... houndd uses the following to look for master/main ( added in https://github.com/hound-search/hound/pull/345 )

git remote show origin | grep "HEAD branch"

Created https://github.com/kubernetes/community/pull/5609 to add docs for repos (without too much traffic) that wish to migrate the default branch from master to main

I intend to give this a shot in KIND the next week or two (want to catch up on some old PRs that have already had a rough time and get those closed out first), will keep an eye on https://github.com/kubernetes/community/pull/5609 first.

/milestone v1.21
we are not aiming to complete this by v1.21, but are actively working on this

https://k8s.dev/rename has since gone live

Created https://github.com/kubernetes/community/issues/5636 to track feedback about the doc for switching default branch from master to main

We are tracking in https://github.com/kubernetes-sigs/kind/issues/2120, feedback so far is captured in https://github.com/kubernetes/community/issues/5636 (thanks @nikhita!), pending GitHub administration team's help with netlify to roll it out there.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Pensu picture Pensu  ·  3Comments

cblecker picture cblecker  ·  3Comments

szuecs picture szuecs  ·  3Comments

codenrhoden picture codenrhoden  ·  3Comments

dholbach picture dholbach  ·  3Comments