Skip to content

Commit

Permalink
Get ct to run helm unittest
Browse files Browse the repository at this point in the history
  • Loading branch information
sl1pm4t committed Nov 26, 2024
1 parent 0b5d9fc commit 37be025
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 20 deletions.
22 changes: 2 additions & 20 deletions .github/workflows/chart-testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,31 +16,13 @@ jobs:
with:
fetch-depth: 0

- name: Fetch chart dependencies
run: |
for chart in $(cat charts-to-test); do
helm dependency update "$chart" >/dev/null
done
shell: bash

- name: Run Helm Chart Testing
run: |
ct lint 2>&1 | tee chart-testing-output-ct-lint.txt
- name: Install dependencies
run: |
helm plugin install https://github.com/helm-unittest/helm-unittest.git
- name: Assemble list of chart directories to test
run: |
tr ' ' '\n' <<< "${{ inputs.charts }}" | grep -v '^$' > charts-to-test || true
find . -type f -name 'Chart.yaml' -exec dirname {} \; > all-charts
[ -z "${{ inputs.charts }}" ] && mv all-charts charts-to-test || true
shell: bash

- name: Run Helm Unit Test
- name: Run Helm Chart Testing
run: |
helm unittest $(cat charts-to-test) 2>&1 | tee chart-testing-output-helm-unittest.txt
ct lint 2>&1 | tee chart-testing-output-ct-lint.txt
- uses: mshick/add-pr-comment@v2
with:
Expand Down
10 changes: 10 additions & 0 deletions ct.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
remote: origin
target-branch: main
exclude-deprecated: true
chart-dirs:
- charts

helm-extra-args: --timeout 600s
validate-maintainers: false
additional-commands:
- "helm unittest -f \"tests/*.yaml\" {{ .Path }}"

0 comments on commit 37be025

Please sign in to comment.