Skip to content

Commit d6c03d5

Browse files
Merge pull request #576 from hjoshi123/feat/helm-unittest
adding helm-unittest plugin binary
2 parents f45c08b + f318220 commit d6c03d5

2 files changed

Lines changed: 33 additions & 0 deletions

File tree

modules/helm/helm.mk

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,16 @@ verify-helm-values: | $(NEEDS_HELM-TOOL) $(NEEDS_GOJQ)
115115

116116
shared_verify_targets += verify-helm-values
117117

118+
.PHONY: verify-helm-unittest
119+
## Run Helm chart unit tests using helm-unittest.
120+
## @category [shared] Generate/ Verify
121+
verify-helm-unittest: | $(NEEDS_HELM-UNITTEST) $(NEEDS_YQ)
122+
$(YQ) '.annotations."artifacthub.io/prerelease" = "$(IS_PRERELEASE)"' --inplace $(helm_chart_source_dir)/Chart.yaml
123+
124+
$(HELM-UNITTEST) $(helm_chart_source_dir)
125+
126+
shared_verify_targets += verify-helm-unittest
127+
118128
$(bin_dir)/scratch/kyverno:
119129
@mkdir -p $@
120130

modules/tools/00_mod.mk

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ tools :=
6767
# https://github.com/helm/helm/releases
6868
# renovate: datasource=github-releases packageName=helm/helm
6969
tools += helm=v4.1.3
70+
# https://github.com/helm-unittest/helm-unittest/releases
71+
# renovate: datasource=github-releases packageName=helm-unittest/helm-unittest
72+
tools += helm-unittest=v1.0.3
7073
# https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl
7174
# renovate: datasource=github-releases packageName=kubernetes/kubernetes
7275
tools += kubectl=v1.35.3
@@ -493,6 +496,26 @@ $(DOWNLOAD_DIR)/tools/helm@$(HELM_VERSION)_$(HOST_OS)_$(HOST_ARCH): | $(DOWNLOAD
493496
chmod +x $(outfile); \
494497
rm -f $(outfile).tar.gz
495498

499+
helm-unittest_linux_amd64_SHA256SUM=9761f23d9509c98770c026e019e743b524b57010f4bc29175f78d2582ace0633
500+
helm-unittest_linux_arm64_SHA256SUM=1e645d96b36582cd8b9fbd53240110267f14d80aa01137341251c60438bbe6b0
501+
helm-unittest_darwin_amd64_SHA256SUM=46413a86ded6bfc70cd704ebac16f8d4a0f36712ae399a5d24e32bc44f96985f
502+
helm-unittest_darwin_arm64_SHA256SUM=6a6b67b3f638f015e09c093b67c7609a07101b971a1a6d6a83d1a7f75861a4b2
503+
504+
# helm-unittest uses "macos" instead of "darwin" in release filenames
505+
helm_unittest_os := $(HOST_OS)
506+
ifeq ($(HOST_OS),darwin)
507+
helm_unittest_os := macos
508+
endif
509+
510+
.PRECIOUS: $(DOWNLOAD_DIR)/tools/helm-unittest@$(HELM-UNITTEST_VERSION)_$(HOST_OS)_$(HOST_ARCH)
511+
$(DOWNLOAD_DIR)/tools/helm-unittest@$(HELM-UNITTEST_VERSION)_$(HOST_OS)_$(HOST_ARCH): | $(DOWNLOAD_DIR)/tools
512+
@source $(lock_script) $@; \
513+
$(CURL) https://github.com/helm-unittest/helm-unittest/releases/download/$(HELM-UNITTEST_VERSION)/helm-unittest-$(helm_unittest_os)-$(HOST_ARCH)-$(HELM-UNITTEST_VERSION:v%=%).tgz -o $(outfile).tgz; \
514+
$(checkhash_script) $(outfile).tgz $(helm-unittest_$(HOST_OS)_$(HOST_ARCH)_SHA256SUM); \
515+
tar xfO $(outfile).tgz untt > $(outfile); \
516+
chmod +x $(outfile); \
517+
rm -f $(outfile).tgz
518+
496519
kubectl_linux_amd64_SHA256SUM=fd31c7d7129260e608f6faf92d5984c3267ad0b5ead3bced2fe125686e286ad6
497520
kubectl_linux_arm64_SHA256SUM=6f0cd088a82dde5d5807122056069e2fac4ed447cc518efc055547ae46525f14
498521
kubectl_darwin_amd64_SHA256SUM=2f339b1eae2e1792ec08da281b37afbeee94f70bed6b7398e7efd81ba08f8d37

0 commit comments

Comments
 (0)