Skip to content
This repository has been archived by the owner on Mar 22, 2024. It is now read-only.

Commit

Permalink
Add Makefile for local testing (#327)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcofranssen committed May 30, 2023
1 parent 9fa1ec2 commit d333154
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
bin/
.idea/
*.swp
charts/**/*.tgz
12 changes: 12 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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][].
Expand Down
25 changes: 25 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit d333154

Please sign in to comment.