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

Makefile: ignore kubectl errors when checking the version #112

Merged
merged 1 commit into from
Jan 23, 2024

Conversation

fedepaol
Copy link
Member

If there is no connectivity to the cluster, kubectl version fails and so the version check does not even get to check the version.

Here we redirect stderror so we can check the version and avoid downloading every time.

Makefile Outdated
@@ -200,7 +200,7 @@ $(CONTROLLER_GEN): $(LOCALBIN)
.PHONY: kubectl
kubectl: $(KUBECTL) ## Download kubectl locally if necessary. If wrong version is installed, it will be overwritten.
$(KUBECTL): $(LOCALBIN)
test -s $(LOCALBIN)/kubectl && $(LOCALBIN)/kubectl version | grep -q $(KUBECTL_VERSION) || \
test -s $(LOCALBIN)/kubectl && $(LOCALBIN)/kubectl version 2> /dev/null | grep -q $(KUBECTL_VERSION) || \
Copy link
Member

Choose a reason for hiding this comment

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

can we use kubectl version --client instead?

    --client=false:
	If true, shows client version only (no server required).

@fedepaol fedepaol force-pushed the dontredownloadkubectl branch 3 times, most recently from be857b6 to 4bb9490 Compare January 23, 2024 15:45

Partially verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
We cannot verify signatures from co-authors, and some of the co-authors attributed to this commit require their commits to be signed.
If there is no connectivity to the cluster, kubectl version fails and so
the version check does not even get to check the version.

Here we redirect stderror so we can check the version and avoid
downloading every time.

Signed-off-by: Federico Paolinelli <fedepaol@gmail.com>
@fedepaol fedepaol force-pushed the dontredownloadkubectl branch from 4bb9490 to dfe899e Compare January 23, 2024 15:46
@fedepaol fedepaol enabled auto-merge January 23, 2024 15:46
@fedepaol fedepaol disabled auto-merge January 23, 2024 16:27
@fedepaol fedepaol merged commit 4ec526c into metallb:main Jan 23, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants