File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
124136shared_verify_targets += verify-helm-unittest
125137
You can’t perform that action at this time.
0 commit comments