Improve Makefile help and implementation
This allows more granular tasks and composition. Also improved the documentation. Signed-off-by: Marco Franssen <[email protected]>
This commit is contained in:
@@ -2,7 +2,7 @@ TARGET_BRANCH ?= main
|
|||||||
|
|
||||||
.PHONY: help
|
.PHONY: help
|
||||||
help: ## Display this help.
|
help: ## Display this help.
|
||||||
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
|
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-20s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
|
||||||
|
|
||||||
##@ Linting:
|
##@ Linting:
|
||||||
|
|
||||||
@@ -15,10 +15,10 @@ lint-release: ## Lint the charts using chart-testing for release
|
|||||||
@echo Linting charts…
|
@echo Linting charts…
|
||||||
@ct lint --config ct.yaml --target-branch $(TARGET_BRANCH)
|
@ct lint --config ct.yaml --target-branch $(TARGET_BRANCH)
|
||||||
|
|
||||||
##@ Testing:
|
##@ Testing: (ensure to run on dedicated test cluster)
|
||||||
|
|
||||||
.PHONY: clean-lingering-resources
|
.PHONY: clean-test-leftovers
|
||||||
clean-lingering-resources:
|
clean-test-leftovers: ## Cleans up any lingering resources in case tests fail massively
|
||||||
@echo Cleanup potential leftovers…
|
@echo Cleanup potential leftovers…
|
||||||
@-kubectl delete csidrivers.storage.k8s.io csi.spiffe.io \
|
@-kubectl delete csidrivers.storage.k8s.io csi.spiffe.io \
|
||||||
&>/dev/null || true
|
&>/dev/null || true
|
||||||
@@ -30,17 +30,20 @@ clean-lingering-resources:
|
|||||||
&>/dev/null || true
|
&>/dev/null || true
|
||||||
|
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
test: install-test-dependencies ## Run tests using Helm chart-testing (ensure to run on dedicated test cluster)
|
test: install-test-deps test-charts test-examples ## Run all chart tests and example tests
|
||||||
@echo Running tests…
|
|
||||||
@ct install --config ct.yaml
|
|
||||||
|
|
||||||
.PHONY: install-test-dependencies
|
.PHONY: install-test-deps
|
||||||
install-test-dependencies: ## Install test dependency resources
|
install-test-deps: ## Install test dependency resources
|
||||||
@echo Installing test dependencies…
|
@echo Installing test dependencies…
|
||||||
@.github/tests/pre-install.sh
|
@.github/tests/pre-install.sh
|
||||||
|
|
||||||
.PHONY: cleanup-test-dependencies
|
.PHONY: test-charts
|
||||||
cleanup-test-dependencies: ## Cleans up all test dependencies resources
|
test-charts: ## Run tests on charts using Helm chart-testing
|
||||||
|
@echo Running tests…
|
||||||
|
@ct install --config ct.yaml
|
||||||
|
|
||||||
|
.PHONY: cleanup-test-deps
|
||||||
|
cleanup-test-deps: ## Cleans up all test dependencies resources
|
||||||
@echo Uninstalling test dependencies…
|
@echo Uninstalling test dependencies…
|
||||||
@helm uninstall -n cert-manager cert-manager 2>/dev/null || true
|
@helm uninstall -n cert-manager cert-manager 2>/dev/null || true
|
||||||
@kubectl delete ns cert-manager 2>/dev/null || true
|
@kubectl delete ns cert-manager 2>/dev/null || true
|
||||||
@@ -59,4 +62,4 @@ test-example-%:
|
|||||||
@echo
|
@echo
|
||||||
|
|
||||||
.PHONY: test-examples
|
.PHONY: test-examples
|
||||||
test-examples: $(patsubst examples/%/values.yaml,test-example-%,$(wildcard examples/*/values.yaml)) ## Run helm install for and helm test for all the examples
|
test-examples: $(patsubst examples/%/values.yaml,test-example-%,$(wildcard examples/*/values.yaml)) ## Run `helm install` and `helm test` for all the examples containing `run-tests.sh`
|
||||||
|
|||||||
Reference in New Issue
Block a user