mirror of https://github.com/portainer/k8s.git
103 lines
3.5 KiB
YAML
103 lines
3.5 KiB
YAML
name: Lint and Test Charts
|
|
|
|
on:
|
|
push:
|
|
paths:
|
|
- 'charts/**'
|
|
- '.github/**'
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
KUBE_SCORE_VERSION: 1.10.0
|
|
HELM_VERSION: v3.4.1
|
|
|
|
jobs:
|
|
lint-test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v1
|
|
|
|
- name: Set up Helm
|
|
uses: azure/setup-helm@v1
|
|
with:
|
|
version: ${{ env.HELM_VERSION }}
|
|
|
|
- name: Set up kube-score
|
|
run: |
|
|
wget https://github.com/zegl/kube-score/releases/download/v${{ env.KUBE_SCORE_VERSION }}/kube-score_${{ env.KUBE_SCORE_VERSION }}_linux_amd64 -O kube-score
|
|
chmod 755 kube-score
|
|
|
|
- name: Kube-score generated manifests
|
|
run: helm template charts/* | ./kube-score score -
|
|
--ignore-test pod-networkpolicy
|
|
--ignore-test deployment-has-poddisruptionbudget
|
|
--ignore-test deployment-has-host-podantiaffinity
|
|
--ignore-test container-security-context
|
|
--ignore-test container-resources
|
|
--ignore-test pod-probes
|
|
--ignore-test container-image-tag
|
|
--enable-optional-test container-security-context-privileged
|
|
|
|
# python is a requirement for the chart-testing action below (supports yamllint among other tests)
|
|
- uses: actions/setup-python@v2
|
|
with:
|
|
python-version: 3.13.1
|
|
|
|
- name: Set up chart-testing
|
|
uses: helm/chart-testing-action@v2.0.1
|
|
|
|
- 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"
|
|
fi
|
|
|
|
- name: Run chart-testing (lint)
|
|
run: ct lint --config .ci/ct-config.yaml
|
|
|
|
# Refer to https://github.com/kubernetes-sigs/kind/releases when updating the node_images
|
|
- name: Create 1.28 kind cluster
|
|
uses: helm/kind-action@v1.4.0
|
|
with:
|
|
node_image: kindest/node:v1.28.13@sha256:45d319897776e11167e4698f6b14938eb4d52eb381d9e3d7a9086c16c69a8110
|
|
cluster_name: kubernetes-1.28
|
|
if: steps.list-changed.outputs.changed == 'true'
|
|
|
|
- name: Run chart-testing (install) against 1.28
|
|
run: ct install --config .ci/ct-config.yaml
|
|
|
|
- name: Create 1.29 kind cluster
|
|
uses: helm/kind-action@v1.4.0
|
|
with:
|
|
node_image: kindest/node:v1.29.8@sha256:d46b7aa29567e93b27f7531d258c372e829d7224b25e3fc6ffdefed12476d3aa
|
|
cluster_name: kubernetes-1.29
|
|
if: steps.list-changed.outputs.changed == 'true'
|
|
|
|
- name: Run chart-testing (install) against 1.29
|
|
run: ct install --config .ci/ct-config.yaml
|
|
|
|
- name: Create 1.30 kind cluster
|
|
uses: helm/kind-action@v1.4.0
|
|
with:
|
|
node_image: kindest/node:v1.30.4@sha256:976ea815844d5fa93be213437e3ff5754cd599b040946b5cca43ca45c2047114
|
|
cluster_name: kubernetes-1.30
|
|
if: steps.list-changed.outputs.changed == 'true'
|
|
|
|
- name: Run chart-testing (install) against 1.30
|
|
run: ct install --config .ci/ct-config.yaml
|
|
|
|
- name: Create 1.31 kind cluster
|
|
uses: helm/kind-action@v1.4.0
|
|
with:
|
|
node_image: kindest/node:v1.31.0@sha256:53df588e04085fd41ae12de0c3fe4c72f7013bba32a20e7325357a1ac94ba865
|
|
cluster_name: kubernetes-1.31
|
|
if: steps.list-changed.outputs.changed == 'true'
|
|
|
|
- name: Run chart-testing (install) against 1.31
|
|
run: ct install --config .ci/ct-config.yaml |