Skip to content

Commit

Permalink
make deps and make bump
Browse files Browse the repository at this point in the history
  • Loading branch information
ronenh committed Aug 29, 2024
1 parent 7c8759e commit 8fdc106
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.ext/
/charts/*/build/*-*.*.*.tgz
/charts/*/charts/*-*.*.*.tgz
60 changes: 52 additions & 8 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,33 @@ WARN_COLOR := \033[36;01m
ATTN_COLOR := \033[33;01m

CHART_REPO := "oci://ghcr.io/aserto-dev/helm"
CHARTS_DIR := charts
CHARTS := ${shell ls ${CHARTS_DIR}}
BUMP_PART ?= patch

CHARTS_DIR := charts
CHARTS := ${shell ls ${CHARTS_DIR}}
BUMP_PART ?= patch
CT_VERSION := 3.11.0

BIN_DIR := ./bin
EXT_DIR := ./.ext
EXT_BIN_DIR := ${EXT_DIR}/bin
EXT_TMP_DIR := ${EXT_DIR}/tmp

CT_LINT_CMD := ${EXT_BIN_DIR}/ct lint --config ct.yaml \
--chart-yaml-schema ${EXT_BIN_DIR}/etc/chart_schema.yaml \
--lint-conf ${EXT_BIN_DIR}/etc/lintconf.yaml \
--helm-repo-extra-args "aserto-helm=-u gh -p ${GITHUB_TOKEN}"


.PHONY: deps
deps: install-ct install-bumpversion;

.PHONY: clean
clean: ${addprefix clean-,${CHARTS}}

.PHONY: lint
lint:
@echo -e "${ATTN_COLOR}==> $@ ${NO_COLOR}"
@ct lint --config ct.yaml --helm-repo-extra-args "aserto-helm=-u gh -p ${GITHUB_TOKEN}"
@${CT_LINT_CMD}

.PHONY: update
update: ${addprefix update-,${CHARTS}}
Expand All @@ -32,12 +47,12 @@ package: ${addprefix package-,${CHARTS}}
.PHONY: push
push: ${addprefix push-,${CHARTS}}

.PHONY: release
release: build package push

.PHONY: bump
bump: ${addprefix bump-,${CHARTS}}

.PHONY: release
release: build package push

.PHONY: clean-%
clean-%:
@echo -e "${ATTN_COLOR}==> clean $* ${NO_COLOR}"
Expand All @@ -46,7 +61,7 @@ clean-%:
.PHONY: lint-%
lint-%:
@echo -e "${ATTN_COLOR}==> lint $* ${NO_COLOR}"
@ct lint --charts ${CHARTS_DIR}/$* --config ct.yaml --helm-repo-extra-args "aserto-helm=-u gh -p ${GITHUB_TOKEN}"
@${CT_LINT_CMD} --charts ${CHARTS_DIR}/$*

.PHONY: update-%
update-%:
Expand Down Expand Up @@ -77,10 +92,39 @@ push-%:
# https://www.gnu.org/software/make/manual/html_node/Pattern_002dspecific.html
bump-%: CHART_VERSION = ${shell cat ${CHARTS_DIR}/$*/Chart.yaml | yq '.version'}

.PHONY: release-%
release-%: update-% build-% package-% push-%;

.PHONY: bump-%
bump-%:
@echo -e "${ATTN_COLOR}==> bump ${BUMP_PART} $* (${CHART_VERSION}) ${NO_COLOR}"
@bumpversion --no-tag --no-commit --allow-dirty --current-version ${CHART_VERSION} \
${BUMP_PART} ${CHARTS_DIR}/$*/Chart.yaml
@echo -e "New version: $$(cat ${CHARTS_DIR}/$*/Chart.yaml | yq '.version')"

.PHONY: install-ct
install-ct: ${EXT_TMP_DIR} ${EXT_BIN_DIR}
@echo -e "$(ATTN_COLOR)==> $@ $(NO_COLOR)"
@gh release download v${CT_VERSION} --repo https://github.com/helm/chart-testing \
--pattern "chart-testing_${CT_VERSION}_$$(uname -s | tr '[:upper:]' '[:lower:]')_$$(uname -m).tar.gz" \
--output "${EXT_TMP_DIR}/chart-testing.tar.gz" --clobber
@tar -xvf ${EXT_TMP_DIR}/chart-testing.tar.gz --directory ${EXT_BIN_DIR} ct etc/ &> /dev/null
@chmod +x ${EXT_BIN_DIR}/ct
@${EXT_BIN_DIR}/ct version

.PHONY: install-bumpversion
install-bumpversion: ${EXT_TMP_DIR} ${EXT_BIN_DIR}
@echo -e "$(ATTN_COLOR)==> $@ $(NO_COLOR)"
@pip install bump2version

${BIN_DIR}:
@echo -e "$(ATTN_COLOR)==> $@ $(NO_COLOR)"
@mkdir -p ${BIN_DIR}

${EXT_BIN_DIR}:
@echo -e "$(ATTN_COLOR)==> $@ $(NO_COLOR)"
@mkdir -p ${EXT_BIN_DIR}

${EXT_TMP_DIR}:
@echo -e "$(ATTN_COLOR)==> $@ $(NO_COLOR)"
@mkdir -p ${EXT_TMP_DIR}

0 comments on commit 8fdc106

Please sign in to comment.