diff --git a/Makefile b/Makefile index 931fe973d..f8530c8a6 100644 --- a/Makefile +++ b/Makefile @@ -55,6 +55,10 @@ LDFLAGS += -X helm.sh/helm/v3/internal/version.gitCommit=${GIT_COMMIT} LDFLAGS += -X helm.sh/helm/v3/internal/version.gitTreeState=${GIT_DIRTY} LDFLAGS += $(EXT_LDFLAGS) +# Define constants for the client-go version +LDFLAGS += -X helm.sh/helm/v3/pkg/lint/rules.k8sVersionMajor=$(shell awk '/client-go/{s=$$2;sub("^v","",s);split(s,v,".");print v[1]+1}' go.mod) +LDFLAGS += -X helm.sh/helm/v3/pkg/lint/rules.k8sVersionMinor=$(shell awk '/client-go/{s=$$2;sub("^v","",s);split(s,v,".");print v[2]}' go.mod) + .PHONY: all all: build diff --git a/pkg/lint/rules/deprecations.go b/pkg/lint/rules/deprecations.go index e84d2e797..c6ece659e 100644 --- a/pkg/lint/rules/deprecations.go +++ b/pkg/lint/rules/deprecations.go @@ -26,7 +26,8 @@ import ( ) const ( - // This should be set based on the version of client-go being imported + // This should be set in the Makefile based on the version of client-go being imported. + // These constants will be overwritten with LDFLAGS k8sVersionMajor = 1 k8sVersionMinor = 19 )