Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: udpate Makefile on buiding embeding charts #450

Merged
merged 1 commit into from
Sep 27, 2024
Merged
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
31 changes: 24 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -202,13 +202,30 @@ build-single-kbcli-embed-chart.%: chart=$(word 2,$(subst ., ,$@))
build-single-kbcli-embed-chart.%:
$(HELM) dependency update addons/addons-cluster/$(chart) --skip-refresh
$(HELM) package addons/addons-cluster/$(chart)
- bash -c "diff <($(HELM) template $(chart)-*.tgz) <($(HELM) template pkg/cluster/charts/$(chart).tgz)" > chart.diff
@if [ -s chart.diff ]; then \
mv $(chart)-*.tgz pkg/cluster/charts/$(chart).tgz; \
else \
rm $(chart)-*.tgz; \
fi
rm chart.diff
@if [ ! -f "pkg/cluster/charts/$(chart).tgz" ]; then \
echo "Moving new chart to the charts directory..."; \
mv $(chart)-*.tgz pkg/cluster/charts/$(chart).tgz; \
exit 0; \
fi; \
rm -rf $(chart)-new $(chart)-old; \
echo "Existing chart found, comparing..."; \
echo "Extracting new chart..."; \
mkdir $(chart)-new && tar -xzf $(chart)-*.tgz -C $(chart)-new; \
echo "Extracting old chart..."; \
mkdir $(chart)-old && tar -xzf pkg/cluster/charts/$(chart).tgz -C $(chart)-old; \
echo "Comparing charts..."; \
diff -r $(chart)-new $(chart)-old > chart.diff; \
if [ -s chart.diff ]; then \
echo "Differences found, updating chart..."; \
mv $(chart)-*.tgz pkg/cluster/charts/$(chart).tgz; \
else \
echo "No differences found, cleaning up..."; \
rm $(chart)-*.tgz; \
fi; \
echo "Cleaning up..."; \
rm -rf chart.diff; \
rm -rf $(chart)-new $(chart)-old; \


.PHONY: build-kbcli-embed-chart
build-kbcli-embed-chart: helmtool fetch-addons create-kbcli-embed-charts-dir \
Expand Down
Loading