Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: (CCIE-3088) helm chart testing status #94

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
29 changes: 12 additions & 17 deletions .github/workflows/chart-testing.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
name: Lint and Test Charts
name: Lint and validate charts

on: pull_request

jobs:

lint-test:
runs-on: ubuntu-latest
steps:
Expand All @@ -28,6 +27,14 @@ jobs:
with:
node_image: kindest/node:v1.30.2

- uses: actions/setup-python@v4
with:
python-version: '3.12'
check-latest: true

- name: Set up chart-testing
uses: helm/[email protected]

- name: Validate chart template with default values
run: |
helm repo add argo-helm-charts https://chanzuckerberg.github.io/argo-helm-charts/
Expand All @@ -49,21 +56,13 @@ jobs:
run: |
helm template ./stack --values ./test-fixtures/values2.yaml | kubectl apply -f - --dry-run=client 2>&1

- name: Install helm on cluster
- name: Install stack chart on cluster
if: steps.list-changed.outputs.changed == 'true'
run: |
helm repo add argo-helm-charts https://chanzuckerberg.github.io/argo-helm-charts/
helm dep update ./stack
helm dependency build ./stack
helm install test ./stack --wait --values ./test-fixtures/gha-cluster-values.yaml --debug

- uses: actions/setup-python@v4
with:
python-version: '3.12'
check-latest: true

- name: Set up chart-testing
uses: helm/[email protected]

- name: Run chart-testing (list-changed)
id: list-changed
Expand All @@ -73,10 +72,6 @@ jobs:
echo "changed=true" >> "$GITHUB_OUTPUT"
fi

- name: Run chart-testing (lint)
if: steps.list-changed.outputs.changed == 'true'
run: ct lint --target-branch ${{ github.event.repository.default_branch }}

- name: Run chart-testing (install)
- name: Run chart-testing (lint and install)
if: steps.list-changed.outputs.changed == 'true'
run: ct install --target-branch ${{ github.event.repository.default_branch }}
run: ct lint-and-install --target-branch ${{ github.event.repository.default_branch }}
2 changes: 1 addition & 1 deletion .github/workflows/unittest.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Unit testing
name: Unit testing for charts

on: pull_request

Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
[![Lint and Test Charts](https://github.com/chanzuckerberg/argo-helm-charts/actions/workflows/chart-testing.yaml/badge.svg)](https://github.com/chanzuckerberg/argo-helm-charts/actions/workflows/chart-testing.yaml)
![chart-testing workflow](https://github.com/chanzuckerberg/argo-helm-charts/actions/workflows/chart-testing.yaml/badge.svg)
![chart-testing branch parameter gha-cluster-test](https://github.com/chanzuckerberg/argo-helm-charts/actions/workflows/chart-testing.yaml/badge.svg?branch=gha-cluster-test)
![chart-testing event parameter](https://github.com/chanzuckerberg/argo-helm-charts/actions/workflows/chart-testing.yaml/badge.svg?event=push)
![unittest workflow](https://github.com/chanzuckerberg/argo-helm-charts/actions/workflows/unittest.yaml/badge.svg)
![unittest branch parameter gha-cluster-test](https://github.com/chanzuckerberg/argo-helm-charts/actions/workflows/unittest.yaml/badge.svg?branch=gha-cluster-test)
![unittest event parameter](https://github.com/chanzuckerberg/argo-helm-charts/actions/workflows/unittest.yaml/badge.svg?event=push)
### Run tests locally
1. `helm plugin install https://github.com/helm-unittest/helm-unittest.git`
2. from the root: run `helm unittest stack`
2 changes: 1 addition & 1 deletion stack/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -149,4 +149,4 @@ spec:
{{- end }}
---
{{- end }}
{{- end }}
{{- end }}
8 changes: 7 additions & 1 deletion test-fixtures/values.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
<<<<<<< HEAD
services:
service1:
replicaCount: 1
=======
# Service defaults
global:
replicaCount: 1
Expand Down Expand Up @@ -181,4 +186,5 @@ services: {}
# - name: sidecar3
# image: sidecar3:latest
# - name: sidecar4
# image: sidecar4:latest
# image: sidecar4:latest
>>>>>>> 205e427911d35d6288b97d11abb1095f1dc04ce0
Loading