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
2 changes: 1 addition & 1 deletion .ci/scripts/local-ct-lint.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

docker run --rm -it -w /repo -v $(pwd):/repo quay.io/helmpack/chart-testing ct lint --all --config .ci/ct-config.yaml
docker run --rm -it -w /repo -v $(pwd):/repo quay.io/helmpack/chart-testing:v3.15.0 ct lint --all --config .ci/ct-config.yaml
51 changes: 34 additions & 17 deletions .github/workflows/on-push-lint-charts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,21 @@ on:
paths:
- 'charts/**'
- '.github/**'
- '.ci/**'
pull_request:
paths:
- 'charts/**'
- '.github/**'
- '.ci/**'
workflow_dispatch:

# Pin every tool so that results don't change underneath us. In particular, test
# snapshots depend on the exact Helm and helm-unittest versions, so regenerate them
# with these versions (see TESTING.md).
env:
KUBE_SCORE_VERSION: 1.17.0
HELM_VERSION: v3.19.0
HELM_VERSION: v4.3.1
HELM_UNITTEST_VERSION: v1.2.1
KUBE_SCORE_VERSION: 1.20.0

concurrency:
group: ${{ github.ref }}
Expand All @@ -24,12 +30,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v7
with:
fetch-depth: 0

- name: Set up Helm
uses: azure/setup-helm@v4.3.0
uses: azure/setup-helm@v5.0.1
with:
version: ${{ env.HELM_VERSION }}

Expand All @@ -48,13 +54,18 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v7
with:
fetch-depth: 0

- name: install helm unittest
run: |
helm plugin install https://github.com/helm-unittest/helm-unittest.git
- name: Set up Helm
uses: azure/setup-helm@v5.0.1
with:
version: ${{ env.HELM_VERSION }}

# Helm 4 verifies plugin signatures by default, which plugins installed from git don't have
- name: Install helm-unittest
run: helm plugin install https://github.com/helm-unittest/helm-unittest.git --version ${{ env.HELM_UNITTEST_VERSION }} --verify=false

- name: Run helm unittest
run: helm unittest charts/*
Expand All @@ -63,40 +74,46 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
# Choose from https://hub.docker.com/r/kindest/node/tags
KubeVersion: [ 1.32.8, 1.33.4, 1.34.0]
# Node images for the kind version used by helm/kind-action, see
# https://github.com/kubernetes-sigs/kind/releases
KubeVersion: [ 1.35.8, 1.36.4, 1.37.0 ]

steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v7
with:
fetch-depth: 0

- name: Set up Helm
uses: azure/setup-helm@v5.0.1
with:
version: ${{ env.HELM_VERSION }}

# python is a requirement for the chart-testing action below (supports yamllint among other tests)
- uses: actions/setup-python@v5
- uses: actions/setup-python@v7
with:
python-version: 3.11
python-version: '3.13'

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

- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed --config .ci/ct-config.yaml)
if [[ -n "$changed" ]]; then
echo "::set-output name=changed::true"
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
- name: Run chart-testing (lint)
run: ct lint --config .ci/ct-config.yaml

- name: Create ${{matrix.KubeVersion}} kind cluster
uses: helm/kind-action@v1.5.0
uses: helm/kind-action@v1.15.1
with:
node_image: kindest/node:v${{matrix.KubeVersion}}
cluster_name: kubernetes-${{matrix.KubeVersion}}
if: steps.list-changed.outputs.changed == 'true'

- name: Run chart-testing (install) against ${{matrix.KubeVersion}}
run: ct install --config .ci/ct-config.yaml
run: ct install --config .ci/ct-config.yaml
6 changes: 5 additions & 1 deletion .github/workflows/on-push-master-publish-chart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v7
with:
fetch-depth: 0

Expand All @@ -28,6 +28,10 @@ jobs:

- name: Run chart-releaser
uses: helm/chart-releaser-action@v1.7.0
with:
# Changes that don't bump the chart version (docs, tests) would otherwise
# fail trying to re-release an existing version
skip_existing: true
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

26 changes: 21 additions & 5 deletions TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,36 @@

# Automated tests

Every pull request to the master branch trigger the following tests:
Every pull request to the master branch triggers the following tests:

* kube-score
* helm unittest
* ct lint
* ct install
* ct install, against several Kubernetes versions using kind

[![Lint and Test Charts](https://github.com/docker-mailserver/docker-mailserver-helm/actions/workflows/on-push-lint-charts.yml/badge.svg)](.github/workflows/on-push-lint-charts.yml)

[![Linting](https://github.com/funkypenguin/helm-docker-mailserver/workflows/Linting/badge.svg)](.github/workflows/on-pr-lint-charts.yml)
[![Testing](https://github.com/funkypenguin/helm-docker-mailserver/workflows/Testing/badge.svg)](.github/workflows/on-pr-test-charts.yml)
The versions of Helm, helm-unittest and the other tools are pinned at the top of [the workflow](.github/workflows/on-push-lint-charts.yml).


# Local testing

If you're submitting a PR, and you want to ensure your changes will pass automated testing (above), here are your options:

## Unit tests

Unit tests use [helm-unittest](https://github.com/helm-unittest/helm-unittest). Most of them compare the rendered manifests against snapshots in `charts/docker-mailserver/tests/__snapshot__`. If you change the templates or default values, regenerate the snapshots and check the diff.

Snapshot output depends on the helm-unittest version, so install the same version as CI (`HELM_UNITTEST_VERSION` in the workflow):

```console
helm plugin install https://github.com/helm-unittest/helm-unittest.git --version v1.2.1 --verify=false
helm unittest charts/docker-mailserver # run the tests
helm unittest -u charts/docker-mailserver # update the snapshots
```

Leave out `--verify=false` on Helm 3.

## Linting

We use helm's [chart-testing](https://github.com/helm/chart-testing) tool to lint our charts. The tool can be installed locally, or it can be run in a Docker container.
Expand Down Expand Up @@ -55,4 +71,4 @@ kubectl cluster-info --context kind-kind
Have a nice day! 👋
```

Trigger a `ct install` test against the KinD cluster, by running `t install --config=.ci/ct-config.yaml`. **ct** will target your current context (be careful if you've got multiple contexts configured!), create a temporary namespace, and deploy the chart into that namespace, until `helm --wait` indicates success. After this, the helm release will be removed, the namespace deleted, and you can retire your KinD cluster by running `kind delete cluster`.
Trigger a `ct install` test against the KinD cluster, by running `ct install --config=.ci/ct-config.yaml`. **ct** will target your current context (be careful if you've got multiple contexts configured!), create a temporary namespace, and deploy the chart into that namespace, until `helm --wait` indicates success. After this, the helm release will be removed, the namespace deleted, and you can retire your KinD cluster by running `kind delete cluster`.
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,30 @@ manifest should match snapshot:
spec:
containers:
- env:
- name: ACCOUNT_PROVISIONER
value: null
- name: AMAVIS_LOGLEVEL
value: "0"
- name: CLAMAV_MESSAGE_SIZE_LIMIT
value: null
- name: DEFAULT_RELAY_HOST
value: null
- name: DMS_VMAIL_GID
value: null
- name: DMS_VMAIL_UID
value: null
- name: DOVECOT_AUTH_BIND
value: null
- name: DOVECOT_INET_PROTOCOLS
value: all
- name: DOVECOT_MAILBOX_FORMAT
value: maildir
- name: DOVECOT_PASS_FILTER
value: null
- name: DOVECOT_TLS
value: null
- name: DOVECOT_USER_FILTER
value: null
- name: ENABLE_AMAVIS
value: "0"
- name: ENABLE_CLAMAV
Expand All @@ -45,12 +63,16 @@ manifest should match snapshot:
value: "0"
- name: ENABLE_IMAP
value: "1"
- name: ENABLE_MANAGESIEVE
value: null
- name: ENABLE_OPENDKIM
value: "0"
- name: ENABLE_OPENDMARC
value: "0"
- name: ENABLE_POLICYD_SPF
value: "0"
- name: ENABLE_POP3
value: null
- name: ENABLE_POSTGREY
value: "0"
- name: ENABLE_QUOTAS
Expand All @@ -77,22 +99,56 @@ manifest should match snapshot:
value: "300"
- name: GETMAIL_POLL
value: "5"
- name: LDAP_QUERY_FILTER_ALIAS
value: null
- name: LDAP_QUERY_FILTER_DOMAIN
value: null
- name: LDAP_QUERY_FILTER_GROUP
value: null
- name: LDAP_QUERY_FILTER_USER
value: null
- name: LDAP_SEARCH_BASE
value: null
- name: LDAP_SERVER_HOST
value: null
- name: LDAP_START_TLS
value: null
- name: LOGROTATE_COUNT
value: "4"
- name: LOGROTATE_INTERVAL
value: weekly
- name: LOGWATCH_INTERVAL
value: null
- name: LOGWATCH_RECIPIENT
value: null
- name: LOGWATCH_SENDER
value: null
- name: LOG_LEVEL
value: info
- name: MARK_SPAM_AS_READ
value: "0"
- name: MOVE_SPAM_TO_JUNK
value: "1"
- name: NETWORK_INTERFACE
value: null
- name: OVERRIDE_HOSTNAME
value: mail.example.com
- name: PERMIT_DOCKER
value: none
- name: PFLOGSUMM_RECIPIENT
value: null
- name: PFLOGSUMM_SENDER
value: null
- name: PFLOGSUMM_TRIGGER
value: null
- name: POSTFIX_DAGENT
value: null
- name: POSTFIX_INET_PROTOCOLS
value: all
- name: POSTFIX_MAILBOX_SIZE_LIMIT
value: null
- name: POSTFIX_MESSAGE_SIZE_LIMIT
value: null
- name: POSTFIX_REJECT_UNKNOWN_CLIENT_HOSTNAME
value: "0"
- name: POSTGREY_AUTO_WHITELIST_CLIENTS
Expand All @@ -103,10 +159,20 @@ manifest should match snapshot:
value: "35"
- name: POSTGREY_TEXT
value: Delayed by Postgrey
- name: POSTMASTER_ADDRESS
value: null
- name: POSTSCREEN_ACTION
value: enforce
- name: RELAY_HOST
value: null
- name: RELAY_PORT
value: "25"
- name: RELAY_USER
value: null
- name: REPORT_RECIPIENT
value: null
- name: REPORT_SENDER
value: null
- name: RSPAMD_CHECK_AUTHENTICATED
value: "0"
- name: RSPAMD_GREYLISTING
Expand All @@ -119,20 +185,64 @@ manifest should match snapshot:
value: "0"
- name: RSPAMD_NEURAL
value: "0"
- name: SASLAUTHD_LDAP_AUTH_METHOD
value: null
- name: SASLAUTHD_LDAP_FILTER
value: null
- name: SASLAUTHD_LDAP_MECH
value: null
- name: SASLAUTHD_LDAP_PASSWORD_ATTR
value: null
- name: SASLAUTHD_LDAP_SEARCH_BASE
value: null
- name: SASLAUTHD_LDAP_SERVER
value: null
- name: SASLAUTHD_LDAP_START_TLS
value: null
- name: SASLAUTHD_LDAP_TLS_CACERT_DIR
value: null
- name: SASLAUTHD_LDAP_TLS_CACERT_FILE
value: null
- name: SASLAUTHD_LDAP_TLS_CHECK_PEER
value: null
- name: SASLAUTHD_MECHANISMS
value: null
- name: SASLAUTHD_MECH_OPTIONS
value: null
- name: SA_KILL
value: "10"
- name: SA_TAG
value: "2"
- name: SA_TAG2
value: "6.31"
- name: SMTP_ONLY
value: null
- name: SPAMASSASSIN_SPAM_TO_INBOX
value: "1"
- name: SPAM_SUBJECT
value: '***SPAM*** '
- name: SPOOF_PROTECTION
value: null
- name: SRS_EXCLUDE_DOMAINS
value: null
- name: SRS_SECRET
value: null
- name: SRS_SENDER_CLASSES
value: envelope_sender
- name: SSL_ALT_CERT_PATH
value: null
- name: SSL_ALT_KEY_PATH
value: null
- name: SUPERVISOR_LOGLEVEL
value: null
- name: TLS_LEVEL
value: null
- name: TZ
value: null
- name: UPDATE_CHECK_INTERVAL
value: 1d
- name: VIRUSMAILS_DELETE_DELAY
value: null
image: mailserver/docker-mailserver:0.1.0
imagePullPolicy: IfNotPresent
livenessProbe:
Expand Down
Loading
Loading