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

🌱 Install hack/tools with temporary go module #5741

Merged
merged 1 commit into from
Feb 25, 2022

Conversation

kaitoii11
Copy link
Contributor

What this PR does / why we need it:
Install hack/tools with temporary go modules.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #5569

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 26, 2021
@k8s-ci-robot
Copy link
Contributor

Hi @kaitoii11. 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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 26, 2021
Makefile Outdated Show resolved Hide resolved
@vincepri
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 29, 2021
Makefile Outdated Show resolved Hide resolved
Makefile Show resolved Hide resolved
Makefile Outdated

YQ_VER := v4.13.5
YQ_BIN := yq
YQ := $(abspath $(TOOLS_BIN_DIR)/$(YQ_BIN)-$(YQ_VER))
Copy link
Member

@sbueringer sbueringer Nov 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should now be able to drop hack/tools/tools.go. After make modules hack/tools/go.mod should then only contain dependencies of our own tools in hack/tools

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kaitoii11 I think this comment still applies

@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 29, 2021
Makefile Outdated Show resolved Hide resolved
@kaitoii11
Copy link
Contributor Author

-// Code generated by conversion-gen. DO NOT EDIT.
+// Code generated by conversion-gen-v0.23.0-alpha.4. DO NOT EDIT.

The test is failing because the naming convention changed for the command binary.
Do we want to use the symlink of the command to avoid the test fail or generate a newer version?

Makefile Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 30, 2021
@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Dec 1, 2021
Makefile Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 7, 2021
@sbueringer
Copy link
Member

sbueringer commented Dec 8, 2021

/test pull-cluster-api-e2e-main

EDIT: Okay that's a merge conflict not a test flake

@sbueringer
Copy link
Member

sbueringer commented Feb 15, 2022

@kaitoii11 I found a solution that I would be happy with

CONVERSION_GEN := $(abspath $(TOOLS_BIN_DIR)/$(CONVERSION_GEN_BIN)-$(CONVERSION_GEN_VER))
=>
CONVERSION_GEN := $(abspath $(TOOLS_BIN_DIR)/$(CONVERSION_GEN_BIN))
$(CONVERSION_GEN): # Build conversion-gen from tools
=>
## We are forcing a rebuilt of conversion-gen via PHONY so that we're always using an up-to-date version.
## We can't use a versioned name for the binary, because that would be reflected in generated files.
.PHONY: $(CONVERSION_GEN)
$(CONVERSION_GEN): # Build conversion-gen from tools

This way we are using the symlink generated by the go install script. That is enough because conversion-gen is
using path.Base(os.Args[0]) to replace GENERATOR_NAME in the generated by comment template (// Code generated by GENERATOR_NAME. DO NOT EDIT.) (https://github.com/kubernetes/gengo/blob/master/args/args.go#L121-L129).

This has the downside that on every conversion the binary has to be rebuilt, but it's very fast with the go cache and only takes a few seconds, which is way faster than the conversion generation itself.

/cc @CecileRobertMichon @vincepri WDYT?

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 15, 2022
@CecileRobertMichon
Copy link
Contributor

This has the downside that on every conversion the binary has to be rebuilt, but it's very fast with the go cache and only takes a few seconds, which is way faster than the conversion generation itself.

SGTM

@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 24, 2022
Makefile Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 24, 2022
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 25, 2022
Copy link
Member

@sbueringer sbueringer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much. Last round of nits from my side. Otherwise lgtm!!

Makefile Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
Makefile Show resolved Hide resolved
@sbueringer
Copy link
Member

sbueringer commented Feb 25, 2022

@kaitoii11 Thank you very much!!

I know it has been a lot of work, probably more than expected, but thx for staying on it and getting it done! :)
It's really a great improvement.

/lgtm

/assign @fabriziopandini @CecileRobertMichon @vincepri

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 25, 2022
@CecileRobertMichon
Copy link
Contributor

/lgtm
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: CecileRobertMichon

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 the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 25, 2022
@k8s-ci-robot k8s-ci-robot merged commit 56d99d7 into kubernetes-sigs:main Feb 25, 2022
@k8s-ci-robot k8s-ci-robot added this to the v1.2 milestone Feb 25, 2022
@kaitoii11 kaitoii11 deleted the temp-gomod branch February 26, 2022 04:07
chrischdi added a commit to chrischdi/cluster-api that referenced this pull request Apr 25, 2022
* Fixes regression for make help introduced in kubernetes-sigs#5741

Signed-off-by: Christian Schlotter <schlotterc@vmware.com>
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. 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. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Install external hack/tools with a temporary go module
7 participants