File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,9 @@ helm_chart_sources := $(shell find $(helm_chart_source_dir) -maxdepth 1 -type f)
4444helm_chart_archive := $(bin_dir ) /scratch/helm/$(helm_chart_name ) -$(helm_chart_version ) .tgz
4545helm_digest_path := $(bin_dir ) /scratch/helm/$(helm_chart_name ) -$(helm_chart_version ) .digests
4646helm_digest = $(shell head -1 $(helm_digest_path ) 2> /dev/null)
47+ HELM_IGNORE_FIELDS ?= 'app.kubernetes.io/version\|helm.sh/chart\|chart:\|appVersion:\|managed-by:\|meta.helm.sh/release-namespace'
48+ helm_chart_old_version ?=
49+ helm_chart_oci_name ?= cert-manager
4750
4851$(bin_dir ) /scratch/helm :
4952 @mkdir -p $@
@@ -187,3 +190,19 @@ verify-helm-kubeconform: $(helm_chart_archive) | $(NEEDS_KUBECONFORM)
187190 -strict
188191
189192shared_verify_targets_dirty += verify-helm-kubeconform
193+
194+ .PHONY : helm-diff
195+ helm-diff : $(helm_chart_archive ) | $(NEEDS_HELM )
196+ @if [ -z " $( helm_chart_old_version) " ] then ; \
197+ echo " Usage: make helm-diff helm_chart_old_version=<version>" ; \
198+ exit 1; \
199+ fi
200+
201+ @TMP_OLD=$$(mktemp -d);
202+ @TMP_NEW=$$(mktemp -d);
203+ @OUTPUT_DIR=$$(mktemp -d);
204+
205+ $(HELM) template $(helm_chart_oci_name) --repo "oci://$(helm_chart_image_registry)" --version "$(helm_chart_old_version)" > $${TMP_OLD}/old.yaml;
206+ $(HELM) template $(helm_chart_archive) > $${TMP_NEW}/new.yaml;
207+
208+ diff -u <(grep -vE $(HELM_IGNORE_FIELDS) $${TMP_OLD}/old.yaml) <(grep -vE $(HELM_IGNORE_FIELDS) $${TMP_NEW}/new.yaml) | tee "$(OUTPUT_DIR)/diff.txt" || true;
You can’t perform that action at this time.
0 commit comments