Skip to content

Commit 4cb14ed

Browse files
committed
copying chart.template to a temp dir
Signed-off-by: hjoshi123 <mail@hjoshi.me>
1 parent b213c22 commit 4cb14ed

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

modules/helm/helm.mk

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,20 @@ shared_verify_targets += verify-helm-values
118118
.PHONY: verify-helm-unittest
119119
## Run Helm chart unit tests using helm-unittest.
120120
## @category [shared] Generate/ Verify
121-
verify-helm-unittest: | $(NEEDS_HELM-UNITTEST)
122-
$(HELM-UNITTEST) $(helm_chart_source_dir)
121+
verify-helm-unittest: | $(NEEDS_HELM-UNITTEST) $(NEEDS_YQ) $(bin_dir)/scratch/helm
122+
$(eval helm_unittest_dir := $(bin_dir)/scratch/helm/unittest-chart)
123+
rm -rf $(helm_unittest_dir)
124+
cp -a $(helm_chart_source_dir) $(helm_unittest_dir)
125+
126+
@# If Chart.yaml doesn't exist but Chart.template.yaml does (e.g. cert-manager),
127+
@# use the template as the base Chart.yaml.
128+
@if [ -f "$(helm_unittest_dir)/Chart.template.yaml" ] && [ ! -f "$(helm_unittest_dir)/Chart.yaml" ]; then \
129+
cp $(helm_unittest_dir)/Chart.template.yaml $(helm_unittest_dir)/Chart.yaml; \
130+
fi
131+
132+
$(YQ) '.annotations."artifacthub.io/prerelease" = "$(IS_PRERELEASE)"' --inplace $(helm_unittest_dir)/Chart.yaml
133+
134+
$(HELM-UNITTEST) $(helm_unittest_dir)
123135

124136
shared_verify_targets += verify-helm-unittest
125137

0 commit comments

Comments
 (0)