-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from funkypenguin/add-deployment-annotations
Add deployment annotation
- Loading branch information
Showing
9 changed files
with
113 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: Linting | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- 'charts/**' | ||
- '.github/**' | ||
|
||
jobs: | ||
ct-lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v1 | ||
|
||
- name: Run chart-testing (lint) | ||
id: lint | ||
uses: helm/[email protected] | ||
with: | ||
config: .ci/ct-config.yaml | ||
command: lint |
12 changes: 6 additions & 6 deletions
12
.github/workflows/on-push-lint-charts.yml → .github/workflows/on-pr-test-charts.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,34 @@ | ||
name: Lint and Test Charts | ||
name: Testing | ||
|
||
on: | ||
push: | ||
pull_request: | ||
paths: | ||
- 'charts/**' | ||
- '.github/**' | ||
|
||
jobs: | ||
lint-test: | ||
ct-test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v1 | ||
|
||
- name: Run chart-testing (lint) | ||
id: lint | ||
uses: helm/[email protected].1 | ||
uses: helm/[email protected].2 | ||
with: | ||
config: .ci/ct-config.yaml | ||
command: lint | ||
|
||
- name: Create kind cluster | ||
uses: helm/[email protected]alpha.3 | ||
uses: helm/[email protected]rc.1 | ||
with: | ||
install_local_path_provisioner: true | ||
# Only build a kind cluster if there are chart changes to test. | ||
if: steps.lint.outputs.changed == 'true' | ||
|
||
- name: Run chart-testing (install) | ||
uses: helm/[email protected].1 | ||
uses: helm/[email protected].2 | ||
with: | ||
command: install | ||
config: .ci/ct-config.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,19 +15,6 @@ jobs: | |
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
# - uses: azure/setup-helm@v1 | ||
# id: installhelm3 | ||
# with: | ||
# version: 'v3.0.3' | ||
# - name: Publish helm charts | ||
# uses: funkypenguin/[email protected] | ||
# with: | ||
# # A personal access token needed to push your site after it has been built. | ||
# access-token: ${{ secrets.CR_TOKEN }} | ||
# # The branch expected by GitHub to have the static files needed for your site. | ||
# deploy-branch: chart | ||
# # The folder in which the helm charts are located | ||
# charts-folder: charts | ||
|
||
- name: Fetch history | ||
run: git fetch --prune --unshallow | ||
|
@@ -49,18 +36,10 @@ jobs: | |
env: | ||
CR_TOKEN: "${{ secrets.CR_TOKEN }}" | ||
|
||
# - name: Discord notification | ||
# env: | ||
# DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | ||
# uses: Ilshidur/action-discord@master | ||
# with: | ||
# args: | | ||
# Greetings, geeks! 🤓 | ||
|
||
# A new/updated helm ⎈ chart is fresh out of the oven! | ||
|
||
# Here's what's changed: | ||
# > ${{github.event.commits[0].message}} | ||
|
||
# Get more details at: | ||
# {{ EVENT_PAYLOAD.compare }} | ||
- name: Emit repository_dispatch | ||
uses: mvasigh/dispatch-action@master | ||
with: | ||
token: ${{ secrets.CR_TOKEN }} | ||
repo: charts | ||
owner: geek-cookbook | ||
event_type: chart_update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# How this chart is tested | ||
|
||
# Automated tests | ||
|
||
Every pull request to the master branch trigger the following tests: | ||
|
||
* ct lint | ||
* ct install | ||
|
||
|
||
[![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) | ||
|
||
|
||
# Local testing | ||
|
||
If you're submitting a PR, and you want to ensure your changes will pass automated testing (above), here are your options: | ||
|
||
## 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. | ||
|
||
To run in Docker: | ||
|
||
1. Have Docker installed | ||
2. Run `./ci/scripts/local-lint` | ||
|
||
To run locally: | ||
|
||
1. Have ct installed (Get a binary package from https://github.com/helm/chart-testing/releases) | ||
2. Run `ct lint --config=.ci/ct-config.yaml` | ||
|
||
## Deployment testing | ||
|
||
*ct* can also test a chart by deploying it to a temporary namespace in a Kubernetes cluster, and waiting for indications that the deployment has been successful. This is a good way to test how the deployment behaves "for real". | ||
|
||
|
||
|
||
|
||
ct lint --config=.ci/ct-config.yaml | ||
|
||
Create a KinD cluster, by running `kind create cluster`: | ||
|
||
``` | ||
❯ kind create cluster | ||
Creating cluster "kind" ... | ||
✓ Ensuring node image (kindest/node:v1.17.0) 🖼 | ||
✓ Preparing nodes 📦 | ||
✓ Writing configuration 📜 | ||
✓ Starting control-plane 🕹️ | ||
✓ Installing CNI 🔌 | ||
✓ Installing StorageClass 💾 | ||
Set kubectl context to "kind-kind" | ||
You can now use your cluster with: | ||
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`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters