Add Makefile for local testing (#327)
This commit is contained in:
@@ -8,3 +8,8 @@ indent_size = 2
|
||||
tab_width = 2
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[Makefile]
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
tab_width = 4
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
bin/
|
||||
.idea/
|
||||
*.swp
|
||||
charts/**/*.tgz
|
||||
|
||||
@@ -34,6 +34,18 @@ git checkout «your-branch»
|
||||
git rebase main
|
||||
```
|
||||
|
||||
## Testing
|
||||
|
||||
Our CI pipeline takes care of the majority of the testing of this Chart. Other ways for you to test are by running `make test` locally using:
|
||||
|
||||
> **Warning**: Ensure to run the test on a dedicated k8s cluster that does not have Spire installed yet.
|
||||
|
||||
```shell
|
||||
make test
|
||||
```
|
||||
|
||||
Another approach to testing the chart is by installing one of the examples in your own cluster to verify your contributed changes work before issueing your PR.
|
||||
|
||||
## Generating documentation
|
||||
|
||||
Any changes to Chart.yaml or values.yaml require an update of the README.md. This update can easily be generated using [helm-docs][].
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
.PHONY: help
|
||||
help: ## Display this help.
|
||||
@$(MAKE) 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)
|
||||
|
||||
|
||||
##@ Testing:
|
||||
|
||||
.PHONY: clean-lingering-resources
|
||||
clean-lingering-resources:
|
||||
@echo Cleanup potential leftovers…
|
||||
@-kubectl delete csidrivers.storage.k8s.io csi.spiffe.io \
|
||||
&>/dev/null || true
|
||||
@-kubectl delete ns \
|
||||
$$(kubectl get ns -o json | jq -r '.items[] | .metadata.name' | grep spire) \
|
||||
&>/dev/null || true
|
||||
@-kubectl delete validatingwebhookconfigurations.admissionregistration.k8s.io \
|
||||
$$(kubectl get validatingwebhookconfigurations.admissionregistration.k8s.io -o json | jq -r '.items[] | .metadata.name' | grep spire) \
|
||||
&>/dev/null || true
|
||||
|
||||
.PHONY: test
|
||||
test: ## Run tests using Helm chart-testing (ensure to run on dedicated test cluster)
|
||||
@echo Running tests…
|
||||
@ct install --debug \
|
||||
--charts charts/spire
|
||||
Reference in New Issue
Block a user