-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
🌱 Add kubernetesVendorVersion for binary builds with LD_FLAGS #4612
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,8 +45,11 @@ help: ## Display this help | |
|
||
##@ Build | ||
|
||
K8S_VERSION ?= $(shell go list -m -modfile=./testdata/project-v4/go.mod -f "{{ .Version }}" k8s.io/api | awk -F'[v.]' '{printf "1.%d.%d", $$3, $$4}') | ||
|
||
LD_FLAGS=-ldflags " \ | ||
-X sigs.k8s.io/kubebuilder/v4/cmd.kubeBuilderVersion=$(shell git describe --tags --dirty --broken) \ | ||
-X sigs.k8s.io/kubebuilder/v4/cmd.kubernetesVendorVersion=$(K8S_VERSION) \ | ||
-X sigs.k8s.io/kubebuilder/v4/cmd.goos=$(shell go env GOOS) \ | ||
-X sigs.k8s.io/kubebuilder/v4/cmd.goarch=$(shell go env GOARCH) \ | ||
-X sigs.k8s.io/kubebuilder/v4/cmd.gitCommit=$(shell git rev-parse HEAD) \ | ||
|
@@ -201,7 +204,6 @@ install-helm: ## Install the latest version of Helm locally | |
helm-lint: install-helm ## Lint the Helm chart in testdata | ||
helm lint testdata/project-v4-with-plugins/dist/chart | ||
|
||
K8S_VERSION ?= $(shell go list -m -modfile=./testdata/project-v4/go.mod -f "{{ .Version }}" k8s.io/api | awk -F'[v.]' '{printf "1.%d.%d", $$3, $$4}') | ||
.PHONY: update-k8s-version | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @camilamacedo86 I reverted the changes to the |
||
update-k8s-version: ## Update Kubernetes API version in version.go and .goreleaser.yml | ||
@if [ -z "$(K8S_VERSION)" ]; then echo "Error: K8S_VERSION is empty"; exit 1; fi | ||
|
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.
Hi @vitorfloriano,
Our goal is to ensure that the binary always uses the Kubernetes version defined in the go.mod file of the projects built with it (e.g., project-v4), so that we don't need to pass any additional values manually.
Given that, the change you made above makes sense for me, But this one will be called when we run
make install
right? So, we need to run make install and check the bin version after the 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.
Test for this one:
The flags are called here:
kubebuilder/Makefile
Lines 56 to 58 in 4c0b8d6