org icon indicating copy to clipboard operation
org copied to clipboard

Changing default branch names to `main`

Open justaugustus opened this issue 5 years ago • 40 comments

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
    • We're waiting for later in the year when the change will be less disruptive for consumers: https://github.com/github/renaming#later-this-year-seamless-move-for-existing-repositories-

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


EDIT(@spiffxp 2021-06-30): Here's an attempt at surveying the state of things today. There are currently 17/243 repos (~7%) that have had their branches renamed.

We need to regroup on the easiest way to track and delegate this. Manually updating a GitHub issue description isn't it, but I thought it would help to see the info here.

#!/usr/bin/env bash
readonly orgs=(
    kubernetes
    kubernetes-sigs
    kubernetes-client
    kubernetes-csi
)

readonly gh_api_cmd=(
    gh api
    --field=per_page=100
    --paginate
    --method=GET
)

for org in "${orgs[@]}"; do
    echo "* ${org}"
    "${gh_api_cmd[@]}" "/orgs/${org}/repos" \
        --field=sort=full_name \
        --template \
        '{{range .}}  * [{{if eq .default_branch "master"}} {{else}}X{{end}}] [{{.full_name}}]({{.html_url}}) {{"\n"}}{{end}}'
done

justaugustus avatar Sep 24 '20 16:09 justaugustus

/wg naming

justaugustus avatar Sep 24 '20 16:09 justaugustus

/sig testing

spiffxp avatar Sep 24 '20 19:09 spiffxp

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

celestehorgan avatar Sep 25 '20 18:09 celestehorgan

/assign cc: @liggitt

justaugustus avatar Sep 29 '20 16:09 justaugustus

@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.

justaugustus avatar Sep 29 '20 16:09 justaugustus

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.

liggitt avatar Sep 30 '20 02:09 liggitt

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-

nikhita avatar Sep 30 '20 08:09 nikhita

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

nikhita avatar Sep 30 '20 08:09 nikhita

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.

mrbobbytables avatar Sep 30 '20 12:09 mrbobbytables

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?

liggitt avatar Sep 30 '20 12:09 liggitt

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

nikhita avatar Sep 30 '20 13:09 nikhita

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.

mrbobbytables avatar Sep 30 '20 14:09 mrbobbytables

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

fejta-bot avatar Dec 29 '20 15:12 fejta-bot

/remove-lifecycle stale

On Tue, Dec 29, 2020 at 8:39 PM fejta-bot [email protected] 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 .

nikhita avatar Dec 30 '20 12:12 nikhita

/priority important-longterm /lifecycle frozen

spiffxp avatar Jan 28 '21 15:01 spiffxp

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.

spiffxp avatar Jan 28 '21 15:01 spiffxp

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):

  • kubernetes/k8s.io: https://github.com/kubernetes/k8s.io/issues/1597
  • kubernetes/org: https://github.com/kubernetes/org/issues/2466

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

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

spiffxp avatar Jan 28 '21 16:01 spiffxp

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

spiffxp avatar Jan 28 '21 16:01 spiffxp

@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.

k8s-ci-robot avatar Jan 28 '21 16:01 k8s-ci-robot

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

  • kubernetes/sig-release
  • kubernetes/enhancements

spiffxp avatar Jan 28 '21 18:01 spiffxp

@BenTheElder is interested in doing this for:

  • kubernetes-sigs/kind

spiffxp avatar Feb 11 '21 00:02 spiffxp

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

  • https://github.com/kubernetes/test-infra/issues/20667 - prowjobs: allow pod-utils to use default remote branch instead of explicitly specifying
  • https://github.com/kubernetes/test-infra/issues/20672 - prowjobs: allow bootstrap-based jobs to use default remote branch instead of defaulting to master
  • https://github.com/kubernetes/test-infra/issues/20829 - prow: avoid retriggering presubmits on default remote branch rename

Based on lessons learned:

  • from moving kubernetes/org: https://github.com/kubernetes/org/issues/2466#issuecomment-770078738
  • from moving kubernets/k8s.io: TBD

spiffxp avatar Feb 24 '21 15:02 spiffxp

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"

dims avatar Feb 24 '21 16:02 dims

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

nikhita avatar Mar 07 '21 12:03 nikhita

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.

BenTheElder avatar Mar 07 '21 20:03 BenTheElder

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

spiffxp avatar Mar 10 '21 17:03 spiffxp

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

BenTheElder avatar Mar 11 '21 06:03 BenTheElder

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

nikhita avatar Mar 16 '21 07:03 nikhita

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.

BenTheElder avatar Mar 16 '21 21:03 BenTheElder

ref/link: https://github.com/kubernetes/website/issues/21749

celestehorgan avatar Apr 19 '21 17:04 celestehorgan