-
Notifications
You must be signed in to change notification settings - Fork 502
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
move references from TOOL_BRANCH to be TOOL_REF #1906
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we still need to add a bit of plumbing here to checkout a specific commit if we want to use a specific ref instead of a branch, let me know what you think:
gcb/release/cloudbuild.yaml
Outdated
@@ -21,7 +21,7 @@ steps: | |||
dir: "go/src/k8s.io" | |||
args: | |||
- "clone" | |||
- "--branch=${_TOOL_BRANCH}" | |||
- "--branch=${_TOOL_REF}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As it stands we will successfully get the value from the substitution here. But I think that this still leaves us only with the possibility to use a specific branch (or a tag). We still need to check out a commit if we want to use an arbitrary ref.
@@ -21,7 +21,7 @@ steps: | |||
dir: "go/src/k8s.io" | |||
args: | |||
- "clone" | |||
- "--branch=${_TOOL_BRANCH}" | |||
- "--branch=${_TOOL_REF}" | |||
- "https://github.com/${_TOOL_ORG}/${_TOOL_REPO}" | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One possibility to checkout a ref would be to insert a new GCB stage here that simply does git checkout SHA
when TOOL_REF is a string that looks like a sha or sha+branch slug. It should be fairly quick as the git container is already cached and is one of the official GCB builders anyway.
The other option would be to change the clone stage, modify the entry point to sh/bash, and call git twice from the shell (clone and then checkout).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the feedback, I was unsure about that, I will ping you in slack to discuss if you can offcourse
10330de
to
edd198e
Compare
fa13b34
to
1e62209
Compare
when have some free cycles can you take a look at this change? thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, it looks good to me. Renaming git.RevParse()
touches a lot of things but I'm confident you got them all covered. From my perspective it should work, I would vote to merge it after 1.21 beta.0 and give it a few test runs.
func (r *Repo) RevParse(rev string) (string, error) { | ||
// Try to resolve the rev | ||
ref, err := r.inner.ResolveRevision(plumbing.Revision(rev)) | ||
if err != nil { | ||
return "", err | ||
} | ||
|
||
return ref.String(), nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm amazed at how much work you put in to rename the old git.RevParse()
. I think I would have added the functionality to the same function ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code LGTM beside the single nit. @cpanato can you give it some manual test runs?
@cpanato: The following tests failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. 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. I understand the commands that are listed here. |
using: from here: cpanato@91a1579 and in the logs can see the custom change
|
using: from here: https://github.com/cpanato/release/tree/testing-ref and in the logs can see the custom change
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cpanato, saschagrunert 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 |
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
move references from TOOL_BRANCH to be TOOL_REF
to be honest I'm not 100% sure if this is enough, opening the PR for feedback
/assign @saschagrunert @hasheddan @puerco
Which issue(s) this PR fixes:
Fixes #1028
Special notes for your reviewer:
Does this PR introduce a user-facing change?