Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions .github/workflows/pull_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ jobs:
with:
version: "v0.18.0"
# Set Up Helm
# v3.17.1: the helm-unittest plugin needs a Helm newer than the 3.7.0 this workflow
# used to pin; lint, dry-run install and package all still pass under it.
- name: Set up Helm
uses: azure/setup-helm@v1
with:
version: v3.7.0
version: v3.17.1
# Check K8s deprecations
- name: Setup Pluto
uses: FairwindsOps/pluto/github-action@master
Expand All @@ -37,17 +39,25 @@ jobs:
- name: Helm Lint
run: |
helm lint ${CHART_PATH}
# Every ci/*-values.yaml fixture must render, pass Pluto and validate against the
# Kubernetes + CRD schemas. The stock values.yaml disables most templates, so the
# fixtures are what actually exercise them.
# Pinned to v1.0.3: newer helm-unittest releases moved plugin.yaml to the
# platformHooks schema, which needs Helm 3.18.10+.
- name: Setup helm-unittest
run: |
helm plugin list | grep -q unittest || helm plugin install https://github.com/helm-unittest/helm-unittest --version v1.0.3
- name: Run helm unittest
run: |
helm unittest ${CHART_PATH}
# Every tests/fixtures/*-values.yaml fixture must render, pass Pluto and validate
# against the Kubernetes + CRD schemas. The stock values.yaml disables most
# templates, so the fixtures are what actually exercise them.
- name: Setup kubeconform
run: |
curl -sSL https://github.com/yannh/kubeconform/releases/download/v0.6.7/kubeconform-linux-amd64.tar.gz \
| tar -xz -C /usr/local/bin kubeconform
- name: Render and validate fixtures
run: |
set -euo pipefail
for f in ${CHART_PATH}/ci/*-values.yaml; do
for f in ${CHART_PATH}/tests/fixtures/*-values.yaml; do
echo "== $(basename "$f")"
helm template fixture ${CHART_PATH} -n fixture -f "$f" > /tmp/rendered.yaml
pluto detect /tmp/rendered.yaml
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ To uninstall the chart:

helm delete <name-of-the-chart> -n namespace

## Unit Tests

Suites live under `charts/application/tests/`, one file per template area, and run with
the [helm-unittest](https://github.com/helm-unittest/helm-unittest) plugin. Fixtures
shared with the PR render/Pluto/kubeconform loop live under
`charts/application/tests/fixtures/`.

helm plugin list | grep -q unittest || helm plugin install https://github.com/helm-unittest/helm-unittest --version v1.0.3
helm unittest charts/application

## Testing - Configuring Env/Secrets File

vi ~/.env
Expand Down
8 changes: 8 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
# Changelog
All notable changes to this project will be documented here

### Unreleased
- Added a helm-unittest suite under `charts/application/tests/` covering the templates
added in v1.1.0; `ci/*-values.yaml` fixtures moved to `charts/application/tests/fixtures/`
and are now also used as suite-level `values:` overrides
- Fixed: `deployment.terminationGracePeriodSeconds` and `deployment.automountServiceAccountToken`
rendered as explicit `null` by default instead of being omitted, because the template
checked `hasKey` instead of the value itself

### v1.1.0
- CronJob moves to `batch/v1`, renders multiple jobs correctly and gains `suspend`, `timeZone`,
`startingDeadlineSeconds`, `backoffLimit`, `activeDeadlineSeconds`, `ttlSecondsAfterFinished`,
Expand Down
10 changes: 10 additions & 0 deletions charts/application/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ To uninstall the chart:

helm delete <name-of-the-chart> -n namespace

## Unit Tests

Suites live under `charts/application/tests/`, one file per template area, and run with
the [helm-unittest](https://github.com/helm-unittest/helm-unittest) plugin. Fixtures
shared with the PR render/Pluto/kubeconform loop live under
`charts/application/tests/fixtures/`.

helm plugin list | grep -q unittest || helm plugin install https://github.com/helm-unittest/helm-unittest --version v1.0.3
helm unittest charts/application

## Testing - Configuring Env/Secrets File

vi ~/.env
Expand Down
4 changes: 2 additions & 2 deletions charts/application/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -259,10 +259,10 @@ Usage:
{{- with $w.priorityClassName }}
priorityClassName: {{ . }}
{{- end }}
{{- if hasKey $w "terminationGracePeriodSeconds" }}
{{- if not (kindIs "invalid" $w.terminationGracePeriodSeconds) }}
terminationGracePeriodSeconds: {{ $w.terminationGracePeriodSeconds }}
{{- end }}
{{- if hasKey $w "automountServiceAccountToken" }}
{{- if not (kindIs "invalid" $w.automountServiceAccountToken) }}
automountServiceAccountToken: {{ $w.automountServiceAccountToken }}
{{- end }}
{{- with $w.nodeSelector }}
Expand Down
Loading
Loading