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

✨ (go/v4) : Ensure versioning of tools and binaries installed via Makefile #3718

Merged

Conversation

lukas016
Copy link
Contributor

@lukas016 lukas016 commented Jan 2, 2024

Fixes #3715

PR solves primary issue with synchronization of tools version between developers where older copies of repo can use older versions of binaries and it isn't updated by makefile.

PR unified way how tools are installed and adding better support for versioning of binary based on binary names.
It add new function into makefile and modified installation targets for tools.
It contains more specific version of tool setup-envtest, which was set to release-0.16 branch because this tools doesn't support proper versioning. It isn't ideally solution but still better as latest.

output:

ls bin 
controller-gen-v0.13.0     golangci-lint-v1.54.2      kustomize-v5.2.1           setup-envtest-release-0.16

make generate manifests undeploy test lint
.../example/bin/controller-gen-v0.13.0 object:headerFile="hack/boilerplate.go.txt" paths="./..."
.../example/bin/controller-gen-v0.13.0 rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases
.../example/bin/kustomize-v5.2.1 build config/default | kubectl delete --ignore-not-found=false -f -
...
KUBEBUILDER_ASSETS=".../example/bin/k8s/1.28.3-darwin-arm64" go test $(go list ./... | grep -v /e2e) -coverprofile cover.out
...
.../example/bin/golangci-lint-v1.54.2 run

@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 2, 2024
Copy link

linux-foundation-easycla bot commented Jan 2, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: lukas016 / name: Lukas Koszegy (cce61e1)

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Jan 2, 2024
@k8s-ci-robot
Copy link
Contributor

Welcome @lukas016!

It looks like this is your first PR to kubernetes-sigs/kubebuilder 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/kubebuilder has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jan 2, 2024
@k8s-ci-robot
Copy link
Contributor

Hi @lukas016. 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 cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Jan 2, 2024
@lukas016 lukas016 marked this pull request as ready for review January 2, 2024 09:44
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 2, 2024
@lukas016 lukas016 changed the title (:sparkles:) unify installation of tools ✨ unify installation of tools Jan 2, 2024
Copy link
Contributor

@mateusoliveira43 mateusoliveira43 left a comment

Choose a reason for hiding this comment

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

LGTM ✅

@lukas016
Copy link
Contributor Author

lukas016 commented Jan 6, 2024

/assign @camilamacedo86

Copy link
Member

@camilamacedo86 camilamacedo86 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 for your contribution 🥇

Could you please:
a) Run make generate then the changes made will result in the samples under testdata and docs
b) Squash the commits. we can only merge when we have 1 commit in the PR

/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 Jan 10, 2024
@camilamacedo86
Copy link
Member

Hi @varshaprasad96

Could you please give a help here?
Are you OK with this one as well?
WDYT

@camilamacedo86 camilamacedo86 changed the title ✨ unify installation of tools ✨ (go/v4) : Ensure versioning of tools and binaries installed via Makefile Jan 16, 2024
Copy link
Member

@varshaprasad96 varshaprasad96 left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution! The changes look good to me. One thing to add is that the underlying KB binaries which are installed by setup-envtest would still remain until they are cleaned up. This is something we need not handle here, but just mentioning because a full cleanup would still not occur as mentioned in the issue.
Thinking about it, an alternative to handle it is to do a setup-envtest cleanup if we identify a mismatched version from use command. But we can handle that in follow up.

@lukas016 we still need to run make generate to update the testdata.

@lukas016
Copy link
Contributor Author

Thanks for the contribution! The changes look good to me. One thing to add is that the underlying KB binaries which are installed by setup-envtest would still remain until they are cleaned up. This is something we need not handle here, but just mentioning because a full cleanup would still not occur as mentioned in the issue. Thinking about it, an alternative to handle it is to do a setup-envtest cleanup if we identify a mismatched version from use command. But we can handle that in follow up.

@lukas016 we still need to run make generate to update the testdata.

I will implement suggestions today and i will call make generate too.

@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 17, 2024
@lukas016
Copy link
Contributor Author

i fixed all conversions, called make generate and squashed commits.

Copy link
Member

@camilamacedo86 camilamacedo86 left a comment

Choose a reason for hiding this comment

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

Could you please rebase with master?

It has changes that are merged already.

Thank you

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jan 17, 2024
Copy link
Member

@camilamacedo86 camilamacedo86 left a comment

Choose a reason for hiding this comment

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

I did not test manually but for me shows fine

/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 19, 2024
rm -rf $(LOCALBIN)/kustomize; \
fi
test -s $(LOCALBIN)/kustomize || GOBIN=$(LOCALBIN) GO111MODULE=on go install sigs.k8s.io/kustomize/kustomize/v5@$(KUSTOMIZE_VERSION)
$(call go-install-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/v5,$(KUSTOMIZE_VERSION))
Copy link
Member

Choose a reason for hiding this comment

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

@varshaprasad96 @everettraven It seems to make a lot of sense for Kubebuilder since we do not support any other language. However, I just want to come to your attention because when the bump of a new release is done in Operator SDK for Helm/Ansible plugins, it will be required. Just take this line and replace it to use the script instead since going installed locally is not a pre-requisite.

Copy link
Member

@camilamacedo86 camilamacedo86 left a comment

Choose a reason for hiding this comment

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

Based in the comment #3718 (review) either

it seems ready to go, so I am approving this one.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: camilamacedo86, lukas016, mateusoliveira43

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 Jan 22, 2024
@k8s-ci-robot k8s-ci-robot merged commit 951caf0 into kubernetes-sigs:master Jan 22, 2024
19 checks passed
@@ -54,9 +58,30 @@ func (f *Makefile) SetTemplateDefaults() error {
f.Image = "controller:latest"
}

if f.ControllerRuntimeReleaseBranchName == "" {
Copy link
Member

Choose a reason for hiding this comment

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

@mateusoliveira43 @varshaprasad96

This part we will need to came back to use latest
we cannot relay on the branch.
We need to relay on the tag

Downloading sigs.k8s.io/controller-runtime/tools/setup-envtest@release-0.17
go: sigs.k8s.io/controller-runtime/tools/setup-envtest@release-0.17: sigs.k8s.io/controller-runtime/tools/setup-envtest@release-0.17: invalid version: unknown revision release-0.17

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah, checked and the last release is 0.17, but there is no branch to it. Probably need some change in controller-runtime to allow use of non-latest with setup-envtest

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/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Standardize installation of golang tools with better version support
5 participants