From 7a310c72231bf3487e668cb5cc2e6a5cdb1adfff Mon Sep 17 00:00:00 2001 From: Gaurav Mehta Date: Mon, 29 Jul 2024 14:16:08 +1000 Subject: [PATCH] leverage generateTemplates capability of harvester/addons --- scripts/build | 5 ++++- scripts/build-bundle | 9 +++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/scripts/build b/scripts/build index 57e628729..f8e51aed3 100755 --- a/scripts/build +++ b/scripts/build @@ -69,7 +69,10 @@ if [ "$(uname)" = "Linux" ]; then fi # render template files -cp ${addons_path}/pkg/templates/*.yaml ./pkg/config/templates +cd ${addons_path} +go run . -generateTemplates -path ${TOP_DIR}/pkg/config/templates + +cd ${TOP_DIR} CGO_ENABLED=0 go build -gcflags "${OTHER_COMPILERFLAGS}" -ldflags "$LINKFLAGS $OTHER_LINKFLAGS" -o bin/harvester-installer . diff --git a/scripts/build-bundle b/scripts/build-bundle index 7ca51ea8e..4dcd4445f 100755 --- a/scripts/build-bundle +++ b/scripts/build-bundle @@ -15,6 +15,11 @@ if [ ! -d ${addons_path} ];then git clone --branch main --single-branch --depth 1 https://github.com/harvester/addons.git ../addons fi +# will generate template file in ${addons_path}, and this is used for subsequent checks +cd ${addons_path} +go run . -generateTemplates +cd ${TOP_DIR} + source ${SCRIPTS_DIR}/version source ${SCRIPTS_DIR}/version-rke2 source ${SCRIPTS_DIR}/version-rancher @@ -140,9 +145,9 @@ check_addon_chart_version_matching() { ls -alht ${CHARTS_DIR} echo "addon template files" - ls -alht ${addons_path}/pkg/templates + ls -alht ${addons_path} - for filename in ${addons_path}/pkg/templates/*.yaml; do + for filename in ${addons_path}/*.yaml; do local tmpfile=/tmp/$(basename ${filename}) grep -v "{{" ${filename} > ${tmpfile} local cnt=$(yq '.resources | length' ${tmpfile})