Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring helm charts validation #6

Merged
merged 16 commits into from
May 18, 2021
2 changes: 1 addition & 1 deletion .github/kind-cluster.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
kind: Cluster
apiVersion: kind.sigs.k8s.io/v1alpha3
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
# the control plane node config
- role: control-plane
Expand Down
26 changes: 0 additions & 26 deletions .github/kubeval.sh

This file was deleted.

86 changes: 61 additions & 25 deletions .github/workflows/helm_charts_scalar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,42 +12,68 @@ on:
paths:
- "charts/**"

env:
HELM_VERSION: v3.5.2

jobs:
lint-chart:
runs-on: ubuntu-latest
env:
PYTHON_VERSION: 3.7

steps:
- uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
superbrothers marked this conversation as resolved.
Show resolved Hide resolved

- name: Fetch history for chart testing
run: git fetch --prune --unshallow
- name: Set up Helm
uses: azure/setup-helm@v1
with:
version: ${{ env.HELM_VERSION }}

- name: Run chart-testing (lint)
id: lint
uses: helm/[email protected]
- name: Set up Python
uses: actions/setup-python@v2
with:
command: lint
config: .github/ct.yaml
python-version: ${{ env.PYTHON_VERSION }}

- name: Set up chart-testing
uses: helm/[email protected]

- name: Run chart-testing (lint)
run: ct lint --config .github/ct.yaml

kubeval-chart:
runs-on: ubuntu-latest
needs: lint-chart
# Uses 1.16.4 since it doesn't support 1.16.13 in https://github.com/instrumenta/kubernetes-json-schema.
strategy:
matrix:
k8s:
- v1.15.7
- v1.16.4
- v1.18.1
superbrothers marked this conversation as resolved.
Show resolved Hide resolved

steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
superbrothers marked this conversation as resolved.
Show resolved Hide resolved

- name: Fetch history for chart testing
run: git fetch --prune --unshallow
- name: Set up Helm
uses: azure/setup-helm@v1
with:
version: ${{ env.HELM_VERSION }}

- name: Install helm-kubeval plugin
run: helm plugin install https://github.com/instrumenta/helm-kubeval

- name: Run kubeval
run: |
chart_dirs=$(ls charts)
for chart_dir in ${chart_dirs}; do
echo "kubeval(idating) charts/${chart_dir} chart..."
helm kubeval "charts/${chart_dir}" -v "${KUBERNETES_VERSION#v}"
done
env:
KUBERNETES_VERSION: ${{ matrix.k8s }}
run: .github/kubeval.sh

install-chart:
name: install-chart
Expand All @@ -59,24 +85,34 @@ jobs:
DOCKER_REGISTRY_PASSWORD: ${{ secrets.CR_PAT }}
DOCKER_REGISTRY_USERNAME: scalar-git
DOCKER_REGISTRY_SERVER: ghcr.io
# Uses 1.16.9 since it doesn't support 1.16.13 in https://hub.docker.com/r/kindest/node/tags.
strategy:
matrix:
k8s:
- v1.15.11
- v1.16.9
- v1.19.7

steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
superbrothers marked this conversation as resolved.
Show resolved Hide resolved

- name: Set up chart-testing
uses: helm/[email protected]

- name: Fetch history for chart testing
run: git fetch --prune --unshallow
- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed --config .github/ct.yaml)
if [[ -n "$changed" ]]; then
echo "::set-output name=changed::true"
fi

- name: Create kind ${{ matrix.k8s }} cluster
uses: helm/kind-action@v1.0.0-rc.1
uses: helm/kind-action@v1.1.0
with:
config: .github/kind-cluster.yaml
node_image: kindest/node:${{ matrix.k8s }}
if: steps.list-changed.outputs.changed == 'true'

- name: Setup kubernetes (Kind) with registry, cassandra and schema
run: |
Expand All @@ -87,14 +123,14 @@ jobs:
kubectl get pods,svc,endpoints,nodes -o wide

- name: Run chart-testing (install)
uses: helm/[email protected]
with:
command: "install"
config: .github/ct.yaml
run: ct install --config .github/ct.yaml

verify-chart-docs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v2

- name: Verify chart docs
run: ./scripts/verify-chart-docs.sh