From 3aa2fe829aeabf7119e8fbe358e4909e278e419d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Valais?= Date: Fri, 27 Sep 2024 13:27:17 +0200 Subject: [PATCH] make: fix go_preflight_ldflags and helm_values_mutation_function --- make/00_mod.mk | 19 ++++++++++--------- make/02_mod.mk | 2 ++ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/make/00_mod.mk b/make/00_mod.mk index 8ec9c1d2..f7f88970 100644 --- a/make/00_mod.mk +++ b/make/00_mod.mk @@ -13,10 +13,10 @@ go_preflight_mod_dir := . go_preflight_ldflags := \ -X $(repo_name)/pkg/version.PreflightVersion=$(VERSION) \ -X $(repo_name)/pkg/version.Commit=$(GITCOMMIT) \ - -X $(repo_name)/pkg/version.BuildDate="$$(date -uR)" \ - -X $(repo_name)/pkg/client.ClientID="k3TrDbfLhCgnpAbOiiT2kIE1AbovKzjo" \ - -X $(repo_name)/pkg/client.ClientSecret="f39w_3KT9Vp0VhzcPzvh-uVbudzqCFmHER3Huj0dvHgJwVrjxsoOQPIw_1SDiCfa" \ - -X $(repo_name)/pkg/client.AuthServerDomain="auth.jetstack.io" + -X $(repo_name)/pkg/version.BuildDate=$(shell date "+%F-%T-%Z") \ + -X $(repo_name)/pkg/client.ClientID=k3TrDbfLhCgnpAbOiiT2kIE1AbovKzjo \ + -X $(repo_name)/pkg/client.ClientSecret=f39w_3KT9Vp0VhzcPzvh-uVbudzqCFmHER3Huj0dvHgJwVrjxsoOQPIw_1SDiCfa \ + -X $(repo_name)/pkg/client.AuthServerDomain=auth.jetstack.io oci_preflight_base_image_flavor := static oci_preflight_image_name := quay.io/jetstack/venafi-agent @@ -26,6 +26,7 @@ oci_preflight_image_name_development := jetstack.local/venafi-agent deploy_name := venafi-kubernetes-agent deploy_namespace := venafi +helm_chart_repo_base := oci://registry.venafi.cloud/charts helm_chart_source_dir := deploy/charts/venafi-kubernetes-agent helm_chart_name := venafi-kubernetes-agent helm_chart_version := $(VERSION:v%=%) @@ -34,13 +35,13 @@ helm_docs_use_helm_tool := 1 helm_generate_schema := 1 helm_verify_values := 1 -golangci_lint_config := .golangci.yaml - -define helm_values_mutation_function -$(YQ) \ +# Allows us to replace the Helm values.yaml's image.repository and image.tag +# with the right values. We use "=" and not ":=" because $(YQ) isn't defined yet +# in 00_mod.mk, so we need this var to be lazy. +helm_values_mutation_function = $(YQ) \ '( .image.repository = "$(oci_preflight_image_name)" ) | \ ( .image.tag = "$(oci_preflight_image_tag)" )' \ $1 --inplace -endef +golangci_lint_config := .golangci.yaml go_header_file := /dev/null diff --git a/make/02_mod.mk b/make/02_mod.mk index e2bd9539..2d13cb3b 100644 --- a/make/02_mod.mk +++ b/make/02_mod.mk @@ -6,6 +6,7 @@ GITHUB_OUTPUT ?= /dev/stderr ## @category [shared] Release release: $(helm_chart_archive) $(MAKE) oci-push-preflight + $(HELM) push "$(helm_chart_archive)" "$(helm_chart_repo_base)" @echo "RELEASE_OCI_preflight_IMAGE=$(oci_preflight_image_name)" >> "$(GITHUB_OUTPUT)" @echo "RELEASE_OCI_preflight_TAG=$(oci_preflight_image_tag)" >> "$(GITHUB_OUTPUT)" @@ -41,3 +42,4 @@ $(helm_chart_source_dir)/templates/venafi-connection-crd.yaml: $(helm_chart_sour # Replace the generate-crds target with generate-crds-venconn. shared_generate_targets := $(filter-out generate-crds,$(shared_generate_targets)) shared_generate_targets += generate-crds-venconn +