Skip to content

Commit

Permalink
Use chart-testing to lint the Helm Chart
Browse files Browse the repository at this point in the history
Problem: We want to validate all the files related to the helm chart and not just run helm lint

Solution: Use helm/chart-testing
  • Loading branch information
lucacome committed May 29, 2024
1 parent f908851 commit 4d58415
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 5 deletions.
4 changes: 4 additions & 0 deletions .ct.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
remote: origin
target-branch: main

check-version-increment: false
16 changes: 14 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,20 @@ jobs:
steps:
- name: Checkout Repository
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- name: Lint chart
run: make lint-helm
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: "3.x"
check-latest: true

- name: Set up chart-testing
uses: helm/chart-testing-action@e6669bcd63d7cb57cb4380c33043eebe5d111992 # v2.6.1

- name: Run chart-testing
run: ct lint --print-config --config .ct.yaml

yaml-lint:
name: Yaml Lint
Expand Down
2 changes: 1 addition & 1 deletion .yamllint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ yaml-files:
- "*.yml"

ignore:
- charts/nginx-gateway-fabric/templates
- charts/nginx-gateway-fabric/
- config/crd/bases/
- deploy/crds.yaml

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ njs-unit-test: ## Run unit tests for the njs httpmatches module

.PHONY: lint-helm
lint-helm: ## Run the helm chart linter
helm lint $(CHART_DIR)
docker run --pull always --rm -v $(CURDIR):/nginx-gateway-fabric -w /nginx-gateway-fabric quay.io/helmpack/chart-testing:latest ct lint --config .ct.yaml

.PHONY: load-images
load-images: ## Load NGF and NGINX images on configured kind cluster.
Expand Down
2 changes: 1 addition & 1 deletion charts/nginx-gateway-fabric/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ keywords:
- gateway
- nginx
maintainers:
- name: nginxinc
- name: nginxinc/nginx-gateway-fabric
email: [email protected]

0 comments on commit 4d58415

Please sign in to comment.