Skip to content

Instantly share code, notes, and snippets.

@JamieMagee
Last active September 8, 2020 07:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JamieMagee/8d35ee8114383217c44ab79959b0a7c5 to your computer and use it in GitHub Desktop.
Save JamieMagee/8d35ee8114383217c44ab79959b0a7c5 to your computer and use it in GitHub Desktop.
GitHub Pages Helm repository
helm-extra-args: --timeout 600
check-version-increment: true
debug: true
#!/bin/bash
set -euo pipefail
HELM_DOCS_VERSION="0.11.0"
# install helm-docs
curl --silent --show-error --fail --location --output /tmp/helm-docs.tar.gz https://github.com/norwoodj/helm-docs/releases/download/v"${HELM_DOCS_VERSION}"/helm-docs_"${HELM_DOCS_VERSION}"_Linux_x86_64.tar.gz
tar -xf /tmp/helm-docs.tar.gz helm-docs
# validate docs
./helm-docs
git diff --exit-code
install-chart:
name: install-chart
runs-on: ubuntu-latest
needs:
- lint-chart
- lint-docs
- kubeval-chart
strategy:
matrix:
k8s:
- v1.12.10
- v1.13.12
- v1.14.10
- v1.15.7
- v1.16.4
- v1.17.2
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Create kind ${{ matrix.k8s }} cluster
uses: helm/kind-action@master
with:
node_image: kindest/node:${{ matrix.k8s }}
- name: Run chart-testing (install)
uses: helm/chart-testing-action@master
with:
command: install
config: .github/ct.yaml
kubeval-chart:
runs-on: ubuntu-latest
needs:
- lint-chart
- lint-docs
strategy:
matrix:
k8s:
- v1.12.10
- v1.13.12
- v1.14.10
- v1.15.11
- v1.16.8
- v1.17.4
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Run kubeval
env:
KUBERNETES_VERSION: ${{ matrix.k8s }}
run: .github/kubeval.sh
#!/bin/bash
set -euo pipefail
CHART_DIRS="$(git diff --find-renames --name-only "$(git rev-parse --abbrev-ref HEAD)" remotes/origin/master -- charts | grep '[cC]hart.yaml' | sed -e 's#/[Cc]hart.yaml##g')"
KUBEVAL_VERSION="0.14.0"
SCHEMA_LOCATION="https://raw.githubusercontent.com/instrumenta/kubernetes-json-schema/master/"
# install kubeval
curl --silent --show-error --fail --location --output /tmp/kubeval.tar.gz https://github.com/instrumenta/kubeval/releases/download/"${KUBEVAL_VERSION}"/kubeval-linux-amd64.tar.gz
tar -xf /tmp/kubeval.tar.gz kubeval
# validate charts
for CHART_DIR in ${CHART_DIRS}; do
helm template "${CHART_DIR}" | ./kubeval --strict --ignore-missing-schemas --kubernetes-version "${KUBERNETES_VERSION#v}" --schema-location "${SCHEMA_LOCATION}"
done
lint-chart:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Run chart-testing (lint)
uses: helm/chart-testing-action@master
with:
command: lint
config: .github/ct.yaml
lint-docs:
runs-on: ubuntu-latest
needs: lint-chart
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Run helm-docs
run: .github/helm-docs.sh
name: Release Charts
on:
push:
branches:
- master
paths:
- 'charts/**'
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Run chart-releaser
uses: helm/chart-releaser-action@master
env:
CR_TOKEN: '${{ secrets.CR_TOKEN }}'
name: Lint and Test Charts
on:
pull_request:
paths:
- 'charts/**'
jobs:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment