Skip to content

Commit

Permalink
Add Helm Chart for Fider
Browse files Browse the repository at this point in the history
  • Loading branch information
Footur committed Jul 10, 2023
1 parent 798ee43 commit cb075c5
Show file tree
Hide file tree
Showing 24 changed files with 1,711 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/ct.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
helm-extra-args: --timeout 300s
check-version-increment: false
debug: true
target-branch: main
chart-dirs:
- charts
17 changes: 17 additions & 0 deletions .github/helm-docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

mkdir ./.bin
export PATH="./.bin:$PATH"

set -euxo pipefail

# renovate: datasource=github-releases depName=helm-docs packageName=norwoodj/helm-docs
HELM_DOCS_VERSION=1.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 -C .bin/ -xf /tmp/helm-docs.tar.gz helm-docs

# validate docs
helm-docs
git diff --exit-code
27 changes: 27 additions & 0 deletions .github/kubeconform.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

mkdir -p ./.bin
export PATH="./.bin:$PATH"

set -euxo pipefail

# renovate: datasource=github-releases depName=kubeconform packageName=yannh/kubeconform
KUBECONFORM_VERSION=v0.6.2

CHART_DIR="./charts/fider"

SCHEMA_LOCATION="https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/"

# install kubeconform
curl --silent --show-error --fail --location --output /tmp/kubeconform.tar.gz https://github.com/yannh/kubeconform/releases/download/"${KUBECONFORM_VERSION}"/kubeconform-linux-amd64.tar.gz
tar -C .bin/ -xf /tmp/kubeconform.tar.gz kubeconform

# validate chart
(cd "${CHART_DIR}"; helm dependency build)
helm template \
--values "${CHART_DIR}/values.yaml" \
"${CHART_DIR}" | kubeconform \
--strict \
--ignore-missing-schemas \
--kubernetes-version "${KUBERNETES_VERSION#v}" \
--schema-location "${SCHEMA_LOCATION}"
83 changes: 83 additions & 0 deletions .github/workflows/ci-helm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Lint and Test Charts

on:
pull_request:
paths:
- "charts/**"

concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
cancel-in-progress: true

jobs:
lint-chart:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
fetch-depth: 0

- name: Install Helm
uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3.5
with:
version: v3.12.1 # renovate: datasource=github-releases depName=helm packageName=helm/helm

- uses: actions/setup-python@bd6b4b6205c4dbad673328db7b31b7fab9e241c0 # v4.6.1
with:
python-version: 3.7

- name: Install chart-testing
uses: helm/chart-testing-action@e8788873172cb653a90ca2e819d79d65a66d4e76 # v2.4.0
with:
version: v3.8.0 # renovate: datasource=github-releases depName=chart-testing packageName=helm/chart-testing

- name: Run lint
run: ct lint --config .github/ct.yaml

lint-docs:
runs-on: ubuntu-latest
needs: lint-chart
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Run helm-docs
run: .github/helm-docs.sh

kubeconform-chart:
runs-on: ubuntu-latest
needs:
- lint-chart
- lint-docs
strategy:
matrix:
k8s:
# from https://github.com/yannh/kubernetes-json-schema
- v1.24.15
- v1.25.9
- v1.26.4
- v1.27.3
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
fetch-depth: 0

- name: Run kubeconform
env:
KUBERNETES_VERSION: ${{ matrix.k8s }}
run: .github/kubeconform.sh

- name: Create kind ${{ matrix.k8s }} cluster
uses: helm/kind-action@fa81e57adff234b2908110485695db0f181f3c67 # v1.7.0
with:
node_image: kindest/node:${{ matrix.k8s }}
version: v0.20.0 # renovate: datasource=github-releases depName=kind packageName=kubernetes-sigs/kind

- name: Install chart-testing
uses: helm/chart-testing-action@e8788873172cb653a90ca2e819d79d65a66d4e76 # v2.4.0
with:
version: v3.8.0 # renovate: datasource=github-releases depName=chart-testing packageName=helm/chart-testing

- name: Run chart install
run: ct install --config .github/ct.yaml
45 changes: 45 additions & 0 deletions .github/workflows/release-helm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Release Charts

on:
push:
branches:
- main
paths:
- 'charts/fider/Chart.yaml'

jobs:
release:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
fetch-depth: 0

- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Install Helm
uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3.5
with:
version: v3.12.1 # renovate: datasource=github-releases depName=helm packageName=helm/helm

- name: Build chart dependencies
run: |
for dir in charts/*/
do
(cd ${dir}; helm dependency build)
done
- name: Run chart-releaser
uses: helm/chart-releaser-action@be16258da8010256c6e82849661221415f031968 # v1.5.0
with:
version: v1.6.0 # renovate: datasource=github-releases depName=chart-releaser packageName=helm/chart-releaser
charts_dir: 'charts'
env:
CR_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
CR_GENERATE_RELEASE_NOTES: true
Loading

0 comments on commit cb075c5

Please sign in to comment.