Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions modules/helm/helm.mk
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ helm_chart_image_registry := $(dir $(helm_chart_image_name))
helm_chart_image_tag := $(helm_chart_version)
helm_chart_sources := $(shell find $(helm_chart_source_dir) -maxdepth 1 -type f) $(shell find $(helm_chart_source_dir)/templates -type f)
helm_chart_archive := $(bin_dir)/scratch/helm/$(helm_chart_name)-$(helm_chart_version).tgz
helm_chart_archive_baked := $(bin_dir)/scratch/helm/$(helm_chart_name)-$(helm_chart_version).baked.tgz
helm_digest_path := $(bin_dir)/scratch/helm/$(helm_chart_name)-$(helm_chart_version).digests
helm_digest = $(shell head -1 $(helm_digest_path) 2> /dev/null)

Expand Down Expand Up @@ -74,12 +75,15 @@ $(helm_chart_archive): $(helm_chart_sources) | $(NEEDS_HELM) $(NEEDS_YQ) $(bin_d
--version $(helm_chart_version) \
--destination $(dir $@)

$(helm_chart_archive_baked): $(helm_chart_archive) | $(NEEDS_HELM-TOOL)
$(HELM-TOOL) images bake $(helm_chart_archive) $(helm_chart_archive_baked) -p $(helm_chart_source_dir)/image_paths.json

.PHONY: helm-chart-oci-push
## Create and push Helm chart to OCI registry.
## Will also create a non-v-prefixed tag for the OCI image.
## @category [shared] Publish
helm-chart-oci-push: $(helm_chart_archive) | $(NEEDS_HELM) $(NEEDS_CRANE)
$(HELM) push "$(helm_chart_archive)" "oci://$(helm_chart_image_registry)" 2>&1 \
helm-chart-oci-push: $(helm_chart_archive_baked) | $(NEEDS_HELM) $(NEEDS_CRANE)
$(HELM) push "$(helm_chart_archive_baked)" "oci://$(helm_chart_image_registry)" 2>&1 \
| tee >(grep -o "sha256:.\+" | tee $(helm_digest_path))

@# $(helm_chart_image_tag:v%=%) removes the v prefix from the value stored in helm_chart_image_tag.
Expand Down Expand Up @@ -111,6 +115,14 @@ generate-helm-schema: | $(NEEDS_HELM-TOOL) $(NEEDS_GOJQ)

shared_generate_targets += generate-helm-schema

.PHONY: generate-helm-image-paths
## Generate Helm chart image paths.
## @category [shared] Generate/ Verify
generate-helm-image-paths: | $(NEEDS_HELM-TOOL) $(NEEDS_GOJQ)
$(HELM-TOOL) images extract $(helm_chart_source_dir)/values.yaml | $(GOJQ) > $(helm_chart_source_dir)/image_paths.json

shared_generate_targets += generate-helm-image-paths

.PHONY: verify-helm-values
## Verify Helm chart values using helm-tool.
## @category [shared] Generate/ Verify
Expand Down
2 changes: 1 addition & 1 deletion modules/tools/00_mod.mk
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ tools += goreleaser=v1.26.2
# https://pkg.go.dev/github.com/anchore/syft/cmd/syft?tab=versions
tools += syft=v1.22.0
# https://github.com/cert-manager/helm-tool/releases
tools += helm-tool=v0.5.3
tools += helm-tool=1e5e33bbe040440558170bb41fc00eb02a15d1a1
# https://github.com/cert-manager/image-tool/releases
tools += image-tool=v0.0.2
# https://github.com/cert-manager/cmctl/releases
Expand Down
Loading