about summary refs log tree commit diff
path: root/pkgs/applications/networking
diff options
context:
space:
mode:
authorMaciej Krüger <mkg20001@gmail.com>2024-01-20 15:18:23 +0100
committerGitHub <noreply@github.com>2024-01-20 15:18:23 +0100
commit9b587bc7e9080f19b45b92beef719cf93704d5eb (patch)
tree31dfe0313e17fa2ff14cc99c02b5522fa7d77c6b /pkgs/applications/networking
parentdc992c386aabb73990966b7e59dec369042c521d (diff)
parent3b7b07ee3fa610c93a1e48489db245c70a6bb48e (diff)
Merge pull request #282092 from nevivurn/feat/helm-k8sversion
kubernetes-helm: set k8sVersion to match upstream
Diffstat (limited to 'pkgs/applications/networking')
-rw-r--r--pkgs/applications/networking/cluster/helm/default.nix15
1 files changed, 15 insertions, 0 deletions
diff --git a/pkgs/applications/networking/cluster/helm/default.nix b/pkgs/applications/networking/cluster/helm/default.nix
index cb6ddb0015202..8ad5ed0ee2577 100644
--- a/pkgs/applications/networking/cluster/helm/default.nix
+++ b/pkgs/applications/networking/cluster/helm/default.nix
@@ -20,9 +20,24 @@ buildGoModule rec {
     "-X helm.sh/helm/v3/internal/version.gitCommit=${src.rev}"
   ];
 
+  preBuild = ''
+    # set k8s version to client-go version, to match upstream
+    K8S_MODULES_VER="$(go list -f '{{.Version}}' -m k8s.io/client-go)"
+    K8S_MODULES_MAJOR_VER="$(($(cut -d. -f1 <<<"$K8S_MODULES_VER") + 1))"
+    K8S_MODULES_MINOR_VER="$(cut -d. -f2 <<<"$K8S_MODULES_VER")"
+    old_ldflags="''${ldflags}"
+    ldflags="''${ldflags} -X helm.sh/helm/v3/pkg/lint/rules.k8sVersionMajor=''${K8S_MODULES_MAJOR_VER}"
+    ldflags="''${ldflags} -X helm.sh/helm/v3/pkg/lint/rules.k8sVersionMinor=''${K8S_MODULES_MINOR_VER}"
+    ldflags="''${ldflags} -X helm.sh/helm/v3/pkg/chartutil.k8sVersionMajor=''${K8S_MODULES_MAJOR_VER}"
+    ldflags="''${ldflags} -X helm.sh/helm/v3/pkg/chartutil.k8sVersionMinor=''${K8S_MODULES_MINOR_VER}"
+  '';
+
   __darwinAllowLocalNetworking = true;
 
   preCheck = ''
+    # restore ldflags for tests
+    ldflags="''${old_ldflags}"
+
     # skipping version tests because they require dot git directory
     substituteInPlace cmd/helm/version_test.go \
       --replace "TestVersion" "SkipVersion"