@@ -24,25 +24,22 @@ ifndef helm_chart_source_dir
2424$(error helm_chart_source_dir is not set)
2525endif
2626
27- ifndef helm_chart_name
28- $(error helm_chart_name is not set)
27+ ifndef helm_chart_image_name
28+ $(error helm_chart_image_name is not set)
2929endif
3030
3131ifndef helm_chart_version
3232$(error helm_chart_version is not set)
3333endif
3434
35- ifndef helm_chart_app_version
36- # Default to the same as the chart version
37- helm_chart_app_version = $(helm_chart_version )
38- endif
39-
4035ifndef helm_values_mutation_function
4136$(error helm_values_mutation_function is not set)
4237endif
4338
4439# #########################################
4540
41+ helm_chart_name := $(notdir $(helm_chart_image_name ) )
42+ helm_chart_registry := $(dir $(helm_chart_image_name ) )
4643helm_chart_sources := $(shell find $(helm_chart_source_dir ) -maxdepth 1 -type f) $(shell find $(helm_chart_source_dir ) /templates -type f)
4744helm_chart_archive := $(bin_dir ) /scratch/image/$(helm_chart_name ) -$(helm_chart_version ) .tgz
4845
@@ -64,17 +61,23 @@ $(helm_chart_archive): $(helm_chart_sources) | $(NEEDS_HELM) $(NEEDS_YQ) $(bin_d
6461
6562 mkdir -p $(dir $@)
6663 $(HELM) package $(helm_chart_source_dir_versioned) \
67- --app-version $(helm_chart_app_version ) \
64+ --app-version $(helm_chart_version ) \
6865 --version $(helm_chart_version) \
6966 --destination $(dir $@)
7067
68+ .PHONY : helm-chart-oci-push
69+ # # Create and push Helm chart to OCI registry.
70+ # # Will also create a non-v-prefixed tag for the OCI image.
71+ # # @category [shared] Publish
72+ helm-chart-oci-push : $(helm_chart_archive ) | $(NEEDS_HELM ) $(NEEDS_CRANE )
73+ $(HELM ) push " $( helm_chart_archive) " " oci://$( helm_chart_registry) "
74+ $(CRANE ) copy " $( helm_chart_image_name) :$( helm_chart_version) " " $( helm_chart_image_name) :$( helm_chart_version:v%=%) "
75+
7176.PHONY : helm-chart
7277# # Create a helm chart
7378# # @category [shared] Helm Chart
7479helm-chart : $(helm_chart_archive )
7580
76- ifdef helm_docs_use_helm_tool
77-
7881helm_tool_header_search ?= ^<!-- AUTO-GENERATED -->
7982helm_tool_footer_search ?= ^<!-- /AUTO-GENERATED -->
8083
@@ -83,35 +86,24 @@ helm_tool_footer_search ?= ^<!-- /AUTO-GENERATED -->
8386# # @category [shared] Generate/ Verify
8487generate-helm-docs : | $(NEEDS_HELM-TOOL )
8588 $(HELM-TOOL ) inject -i $(helm_chart_source_dir ) /values.yaml -o $(helm_chart_source_dir ) /README.md --header-search " $( helm_tool_header_search) " --footer-search " $( helm_tool_footer_search) "
86- else
87- .PHONY : generate-helm-docs
88- # # Generate Helm chart documentation.
89- # # @category [shared] Generate/ Verify
90- generate-helm-docs : | $(NEEDS_HELM-DOCS )
91- $(HELM-DOCS ) $(helm_chart_source_dir ) /
92- endif
9389
9490shared_generate_targets += generate-helm-docs
9591
96- ifdef helm_generate_schema
9792.PHONY : generate-helm-schema
9893# # Generate Helm chart schema.
9994# # @category [shared] Generate/ Verify
10095generate-helm-schema : | $(NEEDS_HELM-TOOL ) $(NEEDS_GOJQ )
10196 $(HELM-TOOL ) schema -i $(helm_chart_source_dir ) /values.yaml | $(GOJQ ) > $(helm_chart_source_dir ) /values.schema.json
10297
10398shared_generate_targets += generate-helm-schema
104- endif
10599
106- ifdef helm_verify_values
107100.PHONY : verify-helm-values
108101# # Verify Helm chart values using helm-tool.
109102# # @category [shared] Generate/ Verify
110103verify-helm-values : | $(NEEDS_HELM-TOOL ) $(NEEDS_GOJQ )
111104 $(HELM-TOOL ) lint -i $(helm_chart_source_dir ) /values.yaml -d $(helm_chart_source_dir ) /templates -e $(helm_chart_source_dir ) /values.linter.exceptions
112105
113106shared_verify_targets += verify-helm-values
114- endif
115107
116108.PHONY : verify-pod-security-standards
117109# # Verify that the Helm chart complies with the pod security standards.
0 commit comments