kubernetes / org

Meta configuration for Kubernetes Github Org
Apache License 2.0
240 stars 669 forks source link

Changing default branch names to `main` #2222

Open justaugustus opened 3 years ago

justaugustus commented 3 years ago

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

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 commented 3 years ago

/wg naming

spiffxp commented 3 years ago

/sig testing

celestehorgan commented 3 years ago

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

justaugustus commented 3 years ago

/assign cc: @liggitt

justaugustus commented 3 years ago

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

liggitt commented 3 years ago

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.

nikhita commented 3 years ago

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 commented 3 years ago

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

mrbobbytables commented 3 years ago

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.

liggitt commented 3 years ago

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?

nikhita commented 3 years ago

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

mrbobbytables commented 3 years ago

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.

fejta-bot commented 3 years ago

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

nikhita commented 3 years ago

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

spiffxp commented 3 years ago

/priority important-longterm /lifecycle frozen

spiffxp commented 3 years ago

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 commented 3 years ago

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:

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

spiffxp commented 3 years ago

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

k8s-ci-robot commented 3 years ago

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

In response to [this](https://github.com/kubernetes/org/issues/2222#issuecomment-769196617): >/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](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.
spiffxp commented 3 years ago

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

spiffxp commented 3 years ago

@BenTheElder is interested in doing this for:

spiffxp commented 3 years ago

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

Based on lessons learned:

dims commented 3 years ago

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"

nikhita commented 3 years ago

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

BenTheElder commented 3 years ago

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.

spiffxp commented 3 years ago

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

BenTheElder commented 3 years ago

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

nikhita commented 3 years ago

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

BenTheElder commented 3 years ago

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.

celestehorgan commented 3 years ago

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

spiffxp commented 3 years ago

kubernetes/klog ref: https://github.com/kubernetes/klog/issues/244

spiffxp commented 3 years ago

Pulling down from the description edit I just made:

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.

rikatz commented 2 years ago

ingress-nginx is already using main and dev-v1 as the branches.

justaugustus commented 2 years ago

Placeholder enhancement tracking issue for kubernetes/kubernetes repo: https://github.com/kubernetes/enhancements/issues/2853

spiffxp commented 2 years ago

/milestone v1.23

spiffxp commented 2 years ago

FYI: we finally wrapped https://github.com/kubernetes/k8s.io/issues/1597 for kubernetes/k8s.io. There were lots of links to the old branch name littered throughout project repos

fabriziopandini commented 2 years ago

quick update from the cluster-api land

elmiko commented 2 years ago

hey @fabriziopandini , here is the issue where we tracked the change for kubemark, we did not have a pull request though.

https://github.com/kubernetes-sigs/cluster-api-provider-kubemark/issues/6

BenTheElder commented 2 years ago

This should probably have a different milestone, if any.

This issue seems out of sync / out of date with work tracked elsewhere. For anyone else interested, see e.g. https://k8s.dev/rename in particular / https://github.com/kubernetes/community/issues/5636

mrueg commented 1 year ago

Quick update here: Kubernetes/kube-state-metrics is done as per https://github.com/kubernetes/kube-state-metrics/issues/1554