Skip to content

Commit

Permalink
chore: udpate Makefile on buiding embeding charts (#450)
Browse files Browse the repository at this point in the history
  • Loading branch information
shanshanying authored Sep 27, 2024
1 parent ef8ac80 commit e984a02
Showing 1 changed file with 24 additions and 7 deletions.
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

0 comments on commit e984a02

Please sign in to comment.