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

prep kubernetes/org jobs for default branch rename #20665

Merged

Conversation

spiffxp
Copy link
Member

@spiffxp spiffxp commented Jan 29, 2021

specificalky

  • add main to any pre/postsubmit triggers that reference master
  • try removing explicit master base_ref, see if that gets us default branch

Part of kubernetes/org#2466

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jan 29, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: spiffxp

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added area/jobs approved Indicates a PR has been approved by an approver from all required OWNERS files. sig/testing Categorizes an issue or PR as relevant to SIG Testing. labels Jan 29, 2021
@spiffxp
Copy link
Member Author

spiffxp commented Jan 29, 2021

My read of the clone part of pod-utils is that they assume base_ref is present.

if !refs.SkipFetchHead {
fetchArgs := []string{g.repositoryURI, "--tags", "--prune"}
fetchArgs = append(fetchArgs, depthArgs...)
commands = append(commands, g.gitFetch(fetchArgs...))
}
{
fetchArgs := append([]string{}, depthArgs...)
fetchArgs = append(fetchArgs, g.repositoryURI, refs.BaseRef)
commands = append(commands, g.gitFetch(fetchArgs...))
}
var target string
if refs.BaseSHA != "" {
target = refs.BaseSHA
} else {
target = "FETCH_HEAD"
}
// we need to be "on" the target branch after the sync
// so we need to set the branch to point to the base ref,
// but we cannot update a branch we are on, so in case we
// are on the branch we are syncing, we check out the SHA
// first and reset the branch second, then check out the
// branch we just reset to be in the correct final state
commands = append(commands, g.gitCommand("checkout", target))
commands = append(commands, g.gitCommand("branch", "--force", refs.BaseRef, target))
commands = append(commands, g.gitCommand("checkout", refs.BaseRef))

It's not clear to me whether something further up the stack does something to default base_ref if not set.

Locally

  • git fetch origin '' is equivalent to fetching all branches, and git checkout FETCH_HEAD puts me on whichever branch was alphabetically first
  • git branch --force "" FETCH_HEAD errors with fatal: '' is not a valid branch name.

Tests are happy though!

@spiffxp
Copy link
Member Author

spiffxp commented Jan 29, 2021

For purposes of migrating kubernetes/org today, I'm going to defer further experiments on making periodics resilient to remote branch renames to a job that runs more frequently than 24h. EDIT: opened #20667 for further exploration

Putting the base_ref back...

specifically
- add main to any pre/postsubmit triggers that reference master
- do nothing for periodics: they'll break until updated post-rename
@spiffxp spiffxp force-pushed the prep-org-jobs-for-branch-rename branch from ea935f7 to c79278e Compare January 29, 2021 18:13
@spiffxp
Copy link
Member Author

spiffxp commented Jan 29, 2021

/cc @mrbobbytables

@mrbobbytables
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 29, 2021
@k8s-ci-robot k8s-ci-robot merged commit 271e841 into kubernetes:master Jan 29, 2021
@k8s-ci-robot k8s-ci-robot added this to the v1.21 milestone Jan 29, 2021
@k8s-ci-robot
Copy link
Contributor

@spiffxp: Updated the job-config configmap in namespace default at cluster test-infra-trusted using the following files:

  • key test-infra-trusted.yaml using file config/jobs/kubernetes/test-infra/test-infra-trusted.yaml

In response to this:

specificalky

  • add main to any pre/postsubmit triggers that reference master
  • try removing explicit master base_ref, see if that gets us default branch

Part of kubernetes/org#2466

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
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/config Issues or PRs related to code in /config area/jobs cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants