Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename default branch for kubernetes/org #2466

Closed
spiffxp opened this issue Jan 28, 2021 · 17 comments
Closed

Rename default branch for kubernetes/org #2466

spiffxp opened this issue Jan 28, 2021 · 17 comments
Assignees
Labels
area/github-management Issues or PRs related to GitHub Management subproject priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. sig/contributor-experience Categorizes an issue or PR as relevant to SIG Contributor Experience. sig/testing Categorizes an issue or PR as relevant to SIG Testing.
Milestone

Comments

@spiffxp
Copy link
Member

spiffxp commented Jan 28, 2021

Part of umbrella issue #2222

Issue to spec out and then run through renaming the default branch for this repository

  • update pre/postsubmits to trigger on old branch name and new branch name
  • determine whether periodics use default branch or have name hardcoded in git commands
    • if hardcoded, does attempting to checkout old name break?
  • determine whether branch name is part of any job names
  • determine if any docs need to be updated
  • send notice
  • rename branch (ref: https://github.com/github/renaming#renaming-existing-branches)
  • if necessary, update periodics to refer to new branch name
  • if necessary, rename jobs
  • update branch protection config
  • update jobs to only trigger on new branch name
  • make sure things still work
    • keep an eye on ci and prs for a bit
    • trial the local development experience with pre-rename clone
  • send notice

/sig contributor-experience
/area github-management
owns the repo
/sig testing
to discover any prow issues
/milestone v1.21
/priority important-soon
/assign @spiffxp
I plan on working through this

@k8s-ci-robot
Copy link
Contributor

@spiffxp: The provided milestone is not valid for this repository. Milestones in this repository: [v1.19, v1.20]

Use /milestone clear to clear the milestone.

In response to this:

Issue to spec out and then run through renaming the default branch for this repository

  • update pre/postsubmits to trigger on old branch name and new branch name
  • determine whether periodics use default branch or have name hardcoded in git commands
  • if hardcoded, does attempting to checkout old name break?
  • determine whether branch name is part of any job names
  • determine if any docs need to be updated
  • send notice
  • rename branch (ref: https://github.com/github/renaming#renaming-existing-branches)
  • if necessary, update periodics to refer to new branch name
  • if necessary, rename jobs
  • update branch protection config
  • update jobs to only trigger on new branch name
  • make sure things still work
  • keep an eye on ci and prs for a bit
  • trial the local development experience with pre-rename clone
  • send notice

/sig contributor-experience
/area github-management
owns the repo
/sig testing
to discover any prow issues
/milestone v1.21
/priority important-soon
/assign @spiffxp
I plan on working through this

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 k8s-ci-robot added sig/contributor-experience Categorizes an issue or PR as relevant to SIG Contributor Experience. area/github-management Issues or PRs related to GitHub Management subproject sig/testing Categorizes an issue or PR as relevant to SIG Testing. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. labels Jan 28, 2021
@spiffxp
Copy link
Member Author

spiffxp commented Jan 29, 2021

/milestone v1.21

@spiffxp
Copy link
Member Author

spiffxp commented Jan 29, 2021

prowjob configs:

  • presubmits: don't explicitly mention master -> do nothing, should work fine post-rename
  • postsubmits: trigger on master -> add main, remove master post-rename
  • periodics: ci-org-peribolos uses pod-utils to explicitly clone master branch -> must merge a PR to switch, either pre or post-rename
  • PR for prep: prep kubernetes/org jobs for default branch rename test-infra#20665

prowjob names:

  • master isn't in their names

prowjob contents:

  • kubernetes/org doesn't contain reference to 'master' in its codebase

prow configs:

  • plugins:
    • slack: repo is mentioned explicitly, but branch name is not (actually no repo mentions it, so probably don't need to check going forward)
    • repo_milestone: repo is mentioned explicitly, but /milestone doesn't depend on branchnn
    • milestone_applier: I'm going to add this to see how it behaves
  • configs:
    • branch_protector: repo is mentioned explicitly, but branch name is not
  • PR for prep: Auto milestone kubernetes/org PRs test-infra#20664

docs:

  • cs.k8s.io shows some links with branch in their uri, but github should handle redirecting these post-rename

@spiffxp
Copy link
Member Author

spiffxp commented Jan 29, 2021

OK I'm going to click the button...
Screen Shot 2021-01-29 at 2 31 22 PM

@justaugustus
Copy link
Member

Do itttttt 🎉 ✨
/pony party

@k8s-ci-robot
Copy link
Contributor

@justaugustus: pony image

In response to this:

Do itttttt 🎉 ✨
/pony party

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.

@spiffxp
Copy link
Member Author

spiffxp commented Jan 29, 2021

Pushed the button.

Slack alerter fired:
Screen Shot 2021-01-29 at 2 40 19 PM

presubmits for open PRs and postsubmits were retriggered:
Screen Shot 2021-01-29 at 2 40 50 PM

visiting the repo via the website now shows a popup
Screen Shot 2021-01-29 at 2 41 46 PM

@spiffxp
Copy link
Member Author

spiffxp commented Jan 29, 2021

Doing a PR via the UI already uses the correct branch name. I happen to use hub pull-request a lot locally, let me see what that experience is like...

trying hub pull-request from a local copy of the repo that hasn't been updated at all:

$ hub pull-request
Error creating pull request: Unprocessable Entity (HTTP 422)
Invalid value for "base"

trying git fetch from a local copy of the repo that hasn't been updated at all

$ git fetch origin master
fatal: couldn't find remote ref master

updated per their instructions

git branch -m master main
git fetch origin
git branch -u origin/main main

hub pull-request still not working...

Fetch origin as I usually do...

$ git fetch --prune origin
From github.com:kubernetes/org
 - [deleted]           (none)     -> origin/master
   (refs/remotes/origin/HEAD has become dangling)

dangling you say?

$ cat .git/refs/remotes/origin/HEAD
ref: refs/remotes/origin/master

let's update that

$ git remote set-head origin -a
origin/HEAD set to main

hub pull-request works now, yay

@spiffxp
Copy link
Member Author

spiffxp commented Jan 29, 2021

Sample PR to confirm things still work (without a post-rename PR yet): #2473

@mrbobbytables
Copy link
Member

The pre/post submits getting re-triggered for smaller repos will probably be fine, but I fear what it'd do for k/k 😬

@spiffxp
Copy link
Member Author

spiffxp commented Jan 29, 2021

Yeah once I wrap this up I'd like to writeup where we got lucky and what we should watch out for to help choose other candidates and identify blockers/mitigations

@spiffxp
Copy link
Member Author

spiffxp commented Jan 29, 2021

Post-rename cleanup PR merged: kubernetes/test-infra#20669

@spiffxp
Copy link
Member Author

spiffxp commented Jan 29, 2021

@spiffxp
Copy link
Member Author

spiffxp commented Jan 29, 2021

Where we got lucky:

  • few open PRs; we didn't have to mitigate a huge spike in CI load
  • infrequent periodics; we didn't have to mitigate periodics breaking pre-rename or post-rename
  • master not in job names; we didn't have to deal with status-context renames or loss of testgrid history
  • jobs didn't explicitly reference master in their code

Lessons learned:

  • the only plugin config that explicitly lists master is milestone_applier - try adding both branches pre-rename
  • the only prow config that explicitly lists master is branch-protection (for kubernetes/website)
  • the branch rename looks like a delete/create via the API
  • as expected, all presubmits/postsubmits get re-triggered
  • I found I needed to use git remote origin set-head -a for my local clone, in addition to the instructions GitHub provided

Some mitigations to consider:

@spiffxp
Copy link
Member Author

spiffxp commented Jan 29, 2021

I'm holding this open until we see the next run of https://testgrid.k8s.io/sig-contribex-org#ci-peribolos to confirm it's using the new branch

@spiffxp
Copy link
Member Author

spiffxp commented Jan 30, 2021

/close
Next run passed, confirmed using main https://prow.k8s.io/view/gcs/kubernetes-jenkins/logs/ci-org-peribolos/1355356401299361792

@k8s-ci-robot
Copy link
Contributor

@spiffxp: Closing this issue.

In response to this:

/close
Next run passed, confirmed using main https://prow.k8s.io/view/gcs/kubernetes-jenkins/logs/ci-org-peribolos/1355356401299361792

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/github-management Issues or PRs related to GitHub Management subproject priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. sig/contributor-experience Categorizes an issue or PR as relevant to SIG Contributor Experience. sig/testing Categorizes an issue or PR as relevant to SIG Testing.
Projects
None yet
Development

No branches or pull requests

4 participants