Skip to content

Commit

Permalink
Add Helm tests to Github Actions (#1793)
Browse files Browse the repository at this point in the history
This reverts commit 2749280.

Signed-off-by: Trey Dockendorf <tdockendorf@osc.edu>
  • Loading branch information
treydock committed Apr 13, 2021
1 parent 2749280 commit 67973c2
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 1 deletion.
20 changes: 20 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -173,3 +173,23 @@ jobs:
run: |
export PROJECT_PATH=$(pwd)
make test-all
helm-tests:
runs-on: ubuntu-latest
needs: pre-checks
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Unshallow
run: git fetch --prune --unshallow

- uses: actions/setup-python@v2
with:
python-version: 3.7

- name: Set up chart-testing
uses: helm/chart-testing-action@v2.0.1

- name: Run chart-testing (lint)
run: ct lint --target-branch=main --check-version-increment=false
20 changes: 20 additions & 0 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ jobs:
with:
go-version: 1.14

- name: Set up Helm
uses: azure/setup-helm@v1
with:
version: v3.5.0

- name: Set up chart-testing
uses: helm/chart-testing-action@v2.0.1

- name: Cache Go modules
uses: actions/cache@v1
with:
Expand Down Expand Up @@ -76,4 +84,16 @@ jobs:
sleep 20
echo ">>> Run Kyverno e2e test"
make test-e2e
kubectl delete -f ${GITHUB_WORKSPACE}/definitions/install.yaml
- name: Update chart values
run: |
sed -i -e "s|nameOverride:.*|nameOverride: kyverno|g" charts/kyverno/values.yaml
sed -i -e "s|fullnameOverride:.*|fullnameOverride: kyverno|g" charts/kyverno/values.yaml
sed -i -e "s|namespace:.*|namespace: kyverno|g" charts/kyverno/values.yaml
sed -i -e "s|tag:.*|tag: $(git describe --always --tags)|g" charts/kyverno/values.yaml
- name: Run chart-testing (install)
run: |
kubectl create namespace kyverno
ct install --target-branch=main --namespace=kyverno
18 changes: 18 additions & 0 deletions charts/kyverno/templates/tests/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: v1
kind: Pod
metadata:
name: "{{ template "kyverno.fullname" . }}-test"
labels:
{{- include "kyverno.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": test
spec:
containers:
- name: wget
image: busybox
command:
- /bin/sh
- -c
- |
sleep 20 ; wget -O- -S --no-check-certificate https://{{ template "kyverno.serviceName" . }}:{{ .Values.service.port }}/health/liveness
restartPolicy: Never
1 change: 0 additions & 1 deletion charts/kyverno/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,3 @@ service:
# 3) Let Helm generate a self signed cert, by setting createSelfSignedCert true
# If letting Kyverno create its own CA or providing your own, make createSelfSignedCert is false
createSelfSignedCert: false

0 comments on commit 67973c2

Please sign in to comment.