Skip to content

Commit

Permalink
leverage generateTemplates capability of harvester/addons
Browse files Browse the repository at this point in the history
  • Loading branch information
ibrokethecloud committed Jul 30, 2024
1 parent 8d366c5 commit 677447c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
5 changes: 4 additions & 1 deletion scripts/build
Original file line number Diff line number Diff line change
Expand Up @@ -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 .

Expand Down
9 changes: 7 additions & 2 deletions scripts/build-bundle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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})
Expand Down

0 comments on commit 677447c

Please sign in to comment.