-
Notifications
You must be signed in to change notification settings - Fork 1.6k
🐛 make ENVTEST_K8S_VERSION respect go.mod replace directives #5096
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
base: master
Are you sure you want to change the base?
Conversation
Hi @Shubhamag12. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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-sigs/prow repository. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Shubhamag12 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
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 PR!
I was wondering how this would behave in a developer workflow that involves a local fork?
For example, if someone is testing against a local clone of k8s.io/api
with a go.mod
directive like replace k8s.io/api v1.28.0 => ../my-api-fork
(suppose the developer needs to test changes against an unreleased version of Kubernetes or debug an issue in an upstream dependency)
What would the awk '{print $NF}'
command resolve to in that case? I'm not sure it would be a version string.
Perhaps @dmvolod can chime in?
@vitorfloriano That's a good catch, local path replacements would break this approach. I will verify this case and will try to come up with more robust approach. Thanks! |
Yes, @vitorfloriano this is good point. |
I tested the local path replacement case and my current fix breaks: With
I can update the fix to handle these cases: This checks if the replacement starts with "v" + digit. If yes, use replacement; otherwise, fall back to original version. one question here: Should we fall back to the original version in this case? as |
Honestly, I don't know. It seems to me that a more reliable approach would be to warn the user about not being able to resolve the version and ask them to set the version as env var, but that would require a separate program. 🤔 |
I think that if the last field when getting the version is not the version, you should throw an error if possible and tell the user that this variable should be defined manually, like
|
@dmvolod Thanks for your suggestion Here is output with this change:
Let me know if this looks good! |
d614587
to
2cacaf4
Compare
2cacaf4
to
71426c2
Compare
fixes: #5088
this fix ensures ENVTEST uses the replaced k8s.io/api version when replace directives are present in go.mod