fix common testing pipeline
This commit is contained in:
@@ -0,0 +1,42 @@
|
|||||||
|
---
|
||||||
|
rules:
|
||||||
|
braces:
|
||||||
|
min-spaces-inside: 0
|
||||||
|
max-spaces-inside: 0
|
||||||
|
min-spaces-inside-empty: -1
|
||||||
|
max-spaces-inside-empty: -1
|
||||||
|
brackets:
|
||||||
|
min-spaces-inside: 0
|
||||||
|
max-spaces-inside: 0
|
||||||
|
min-spaces-inside-empty: -1
|
||||||
|
max-spaces-inside-empty: -1
|
||||||
|
colons:
|
||||||
|
max-spaces-before: 0
|
||||||
|
max-spaces-after: 1
|
||||||
|
commas:
|
||||||
|
max-spaces-before: 0
|
||||||
|
min-spaces-after: 1
|
||||||
|
max-spaces-after: 1
|
||||||
|
comments:
|
||||||
|
require-starting-space: true
|
||||||
|
min-spaces-from-content: 2
|
||||||
|
document-end: disable
|
||||||
|
document-start: disable # No --- to start a file
|
||||||
|
empty-lines:
|
||||||
|
max: 2
|
||||||
|
max-start: 0
|
||||||
|
max-end: 0
|
||||||
|
hyphens:
|
||||||
|
max-spaces-after: 1
|
||||||
|
indentation:
|
||||||
|
spaces: consistent
|
||||||
|
indent-sequences: whatever # - list indentation will handle both indentation and without
|
||||||
|
check-multi-line-strings: false
|
||||||
|
key-duplicates: enable
|
||||||
|
line-length: disable # Lines can be any length
|
||||||
|
new-line-at-end-of-file: enable
|
||||||
|
new-lines:
|
||||||
|
type: unix
|
||||||
|
trailing-spaces: enable
|
||||||
|
truthy:
|
||||||
|
level: warning
|
||||||
@@ -111,7 +111,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix: ${{ fromJson(needs.generate-install-matrix.outputs.matrix1) }}
|
matrix: ${{ fromJson(needs.generate-install-matrix.outputs.matrix1) }}
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
max-parallel: 10
|
max-parallel: 4
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@@ -170,7 +170,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix: ${{ fromJson(needs.generate-install-matrix.outputs.matrix2) }}
|
matrix: ${{ fromJson(needs.generate-install-matrix.outputs.matrix2) }}
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
max-parallel: 10
|
max-parallel: 4
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@@ -229,7 +229,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix: ${{ fromJson(needs.generate-install-matrix.outputs.matrix3) }}
|
matrix: ${{ fromJson(needs.generate-install-matrix.outputs.matrix3) }}
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
max-parallel: 10
|
max-parallel: 4
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@@ -288,7 +288,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix: ${{ fromJson(needs.generate-install-matrix.outputs.matrix4) }}
|
matrix: ${{ fromJson(needs.generate-install-matrix.outputs.matrix4) }}
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
max-parallel: 10
|
max-parallel: 4
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@@ -347,7 +347,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix: ${{ fromJson(needs.generate-install-matrix.outputs.matrix5) }}
|
matrix: ${{ fromJson(needs.generate-install-matrix.outputs.matrix5) }}
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
max-parallel: 10
|
max-parallel: 4
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@@ -406,7 +406,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix: ${{ fromJson(needs.generate-install-matrix.outputs.matrix6) }}
|
matrix: ${{ fromJson(needs.generate-install-matrix.outputs.matrix6) }}
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
max-parallel: 10
|
max-parallel: 4
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
|||||||
@@ -0,0 +1,246 @@
|
|||||||
|
name: Common Library Tests
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
paths:
|
||||||
|
- "charts/charts/library/common/**"
|
||||||
|
- ".github/workflows/common-tests.yaml"
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
paths:
|
||||||
|
- "charts/charts/library/common/**"
|
||||||
|
- ".github/workflows/common-tests.yaml"
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
lint:
|
||||||
|
name: Lint Common
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
helm-version:
|
||||||
|
- v3.14.4
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 1
|
||||||
|
|
||||||
|
- name: Install Helm
|
||||||
|
uses: azure/setup-helm@fe7b79cd5ee1e45176fcad797de68ecaf3ca4814 # v4
|
||||||
|
with:
|
||||||
|
version: ${{ matrix.helm-version }}
|
||||||
|
|
||||||
|
- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5
|
||||||
|
with:
|
||||||
|
python-version: "3.10"
|
||||||
|
|
||||||
|
- name: Set up chart-testing
|
||||||
|
uses: helm/chart-testing-action@e6669bcd63d7cb57cb4380c33043eebe5d111992 # v2.6.1
|
||||||
|
|
||||||
|
- name: Run chart-testing (lint)
|
||||||
|
id: lint
|
||||||
|
run: |
|
||||||
|
ct lint --config .github/ct-lint.yaml \
|
||||||
|
--lint-conf .github/lint-conf.yaml \
|
||||||
|
--charts charts/library/common-test \
|
||||||
|
--debug
|
||||||
|
|
||||||
|
unittest:
|
||||||
|
needs:
|
||||||
|
- lint
|
||||||
|
name: Unit Tests
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
|
env:
|
||||||
|
helmUnitVersion: 0.5.0
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
helm-version:
|
||||||
|
- v3.14.4
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 1
|
||||||
|
|
||||||
|
- name: Install Helm
|
||||||
|
uses: azure/setup-helm@fe7b79cd5ee1e45176fcad797de68ecaf3ca4814 # v4
|
||||||
|
with:
|
||||||
|
version: ${{ matrix.helm-version }}
|
||||||
|
|
||||||
|
- name: Cache helm plugins
|
||||||
|
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
/home/runner/.local/share/helm/plugins/helm-unittest
|
||||||
|
/tmp/_dist/
|
||||||
|
key: helm-${{ matrix.helm-version }}-unittest-v${{ env.helmUnitVersion }}
|
||||||
|
restore-keys: |
|
||||||
|
helm-${{ matrix.helm-version }}-unittest-v${{ env.helmUnitVersion }}
|
||||||
|
|
||||||
|
- name: Run Unittests
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
(helm unittest -h > /dev/null) || helm plugin install https://github.com/helm-unittest/helm-unittest --version v${helmUnitVersion} || (sleep 10 && helm plugin install https://github.com/helm-unittest/helm-unittest --version v${helmUnitVersion}) || echo "finished unittest reinstall tries"
|
||||||
|
|
||||||
|
# Run tests
|
||||||
|
cd charts/library/common-test/
|
||||||
|
helm dependency update
|
||||||
|
helm unittest -f "tests/**/*.yaml" . -v ./unit-values.yaml
|
||||||
|
|
||||||
|
install:
|
||||||
|
needs:
|
||||||
|
- lint
|
||||||
|
name: Install Charts
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
# We test the latest k3s version and the lowest supported by either the oldest supported SCALE or FluxCD release
|
||||||
|
k3s-version:
|
||||||
|
- v1.26
|
||||||
|
- v1.29
|
||||||
|
# We test the latest k3s version and the lowest supported by either the oldest supported SCALE or FluxCD release
|
||||||
|
helm-version:
|
||||||
|
- v3.12.1
|
||||||
|
- v3.14.4
|
||||||
|
values:
|
||||||
|
- basic-values.yaml
|
||||||
|
- configmap-values.yaml
|
||||||
|
- secrets-values.yaml
|
||||||
|
- imagePullSecret-values.yaml
|
||||||
|
- daemonset-values.yaml
|
||||||
|
- job-values.yaml
|
||||||
|
- cron-values.yaml
|
||||||
|
- statefulset-values.yaml
|
||||||
|
- persistence-values.yaml
|
||||||
|
- extra-containers-values.yaml
|
||||||
|
- rbac-values.yaml
|
||||||
|
- ingress-values.yaml
|
||||||
|
- networkPolicy-values.yaml
|
||||||
|
# TODO: broken
|
||||||
|
# - codeserver-values.yaml
|
||||||
|
- netshoot-values.yaml
|
||||||
|
- metrics-values.yaml
|
||||||
|
- cnpg-values.yaml
|
||||||
|
- cnpg-multi-values.yaml
|
||||||
|
- register-operator-values.yaml
|
||||||
|
- portal-svc-values.yaml
|
||||||
|
- portal-ingress-values.yaml
|
||||||
|
## TODO: reenable when we've some credentials ready to rock for testing
|
||||||
|
# - volsync-dest-values.yaml
|
||||||
|
# - volsync-src-values.yaml
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 1
|
||||||
|
|
||||||
|
- name: Install Helm
|
||||||
|
uses: azure/setup-helm@fe7b79cd5ee1e45176fcad797de68ecaf3ca4814 # v4
|
||||||
|
with:
|
||||||
|
version: ${{ matrix.helm-version }}
|
||||||
|
|
||||||
|
- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5
|
||||||
|
with:
|
||||||
|
python-version: "3.10"
|
||||||
|
|
||||||
|
- name: Set up chart-testing
|
||||||
|
uses: helm/chart-testing-action@e6669bcd63d7cb57cb4380c33043eebe5d111992 # v2.6.1
|
||||||
|
|
||||||
|
- name: Create k3d cluster - Attempt 1/3
|
||||||
|
continue-on-error: true
|
||||||
|
id: createc1
|
||||||
|
uses: nolar/setup-k3d-k3s@293b8e5822a20bc0d5bcdd4826f1a665e72aba96 # tag=v1.0.9
|
||||||
|
with:
|
||||||
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
version: ${{ matrix.k3s-version }}
|
||||||
|
# Flags found here https://github.com/k3d-io/k3d
|
||||||
|
k3d-args: --k3s-arg --disable=metrics-server@server:*
|
||||||
|
|
||||||
|
- name: Wait 10 second to retry
|
||||||
|
if: steps.createc1.outcome=='failure'
|
||||||
|
run: |
|
||||||
|
sleep 10
|
||||||
|
- name: Create k3d cluster - Attempt 2/3
|
||||||
|
continue-on-error: true
|
||||||
|
if: steps.createc1.outcome=='failure'
|
||||||
|
id: createc2
|
||||||
|
uses: nolar/setup-k3d-k3s@293b8e5822a20bc0d5bcdd4826f1a665e72aba96 # tag=v1.0.9
|
||||||
|
with:
|
||||||
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
version: ${{ matrix.k3s-version }}
|
||||||
|
# Flags found here https://github.com/k3d-io/k3d
|
||||||
|
k3d-args: --k3s-arg --disable=metrics-server@server:*
|
||||||
|
|
||||||
|
- name: Wait 10 second to retry
|
||||||
|
if: steps.createc2.outcome=='failure'
|
||||||
|
run: |
|
||||||
|
sleep 10
|
||||||
|
- name: Create k3d cluster - Attempt 3/3
|
||||||
|
id: createc3
|
||||||
|
if: steps.createc2.outcome=='failure'
|
||||||
|
uses: nolar/setup-k3d-k3s@293b8e5822a20bc0d5bcdd4826f1a665e72aba96 # tag=v1.0.9
|
||||||
|
with:
|
||||||
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
version: ${{ matrix.k3s-version }}
|
||||||
|
# Flags found here https://github.com/k3d-io/k3d
|
||||||
|
k3d-args: --k3s-arg --disable=metrics-server@server:*
|
||||||
|
|
||||||
|
# Install Kail to grab logs from tests, as there are cases ct-install fail to output logs
|
||||||
|
- name: Install Kail
|
||||||
|
run: |
|
||||||
|
export KAIL_VERSION=v0.16.1
|
||||||
|
wget https://github.com/boz/kail/releases/download/${KAIL_VERSION}/kail_${KAIL_VERSION}_linux_amd64.tar.gz
|
||||||
|
tar -xvzf kail_${KAIL_VERSION}_linux_amd64.tar.gz
|
||||||
|
chmod +x kail
|
||||||
|
|
||||||
|
- name: Add Dependencies
|
||||||
|
run: |
|
||||||
|
if [[ "${{ matrix.values }}" =~ (ingress|metrics|cnpg|volsync).*-values.yaml ]]; then
|
||||||
|
helm install prometheus-operator oci://tccr.io/truecharts/prometheus-operator --namespace prometheus-operator --create-namespace --wait
|
||||||
|
fi
|
||||||
|
if [[ "${{ matrix.values }}" =~ cnpg.*-values.yaml ]]; then
|
||||||
|
helm install cloudnative-pg oci://tccr.io/truecharts/cloudnative-pg --namespace cloudnative-pg --create-namespace --wait
|
||||||
|
fi
|
||||||
|
if [[ "${{ matrix.values }}" =~ ingress.*-values.yaml ]]; then
|
||||||
|
helm install cert-manager oci://tccr.io/truecharts/cert-manager --namespace cert-manager --create-namespace --wait
|
||||||
|
helm install traefik oci://tccr.io/truecharts/traefik --namespace traefik --create-namespace --wait \
|
||||||
|
--set service.main.type=ClusterIP --set service.tcp.type=ClusterIP
|
||||||
|
fi
|
||||||
|
if [[ "${{ matrix.values }}" =~ volsync.*-values.yaml ]]; then
|
||||||
|
helm install volumesnapshots oci://tccr.io/truecharts/volumesnapshots --namespace volumesnapshots --create-namespace --wait
|
||||||
|
helm install volsync oci://tccr.io/truecharts/volsync --namespace volsync --create-namespace --wait
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Run chart-testing (install)
|
||||||
|
run: |
|
||||||
|
# Move all ci values on a temp location (or skip if already moved from another matrix job)
|
||||||
|
mv charts/library/common-test/ci charts/library/common-test/runtests || echo "Nothing to move"
|
||||||
|
|
||||||
|
# Move one values.yaml to the correct location to run the test
|
||||||
|
mv -f charts/library/common-test/runtests/${{ matrix.values }} charts/library/common-test/values.yaml
|
||||||
|
|
||||||
|
# Stat kail on the background to grab logs from tests
|
||||||
|
./kail --ignore-ns kube-system --ignore-ns cert-manager --ignore-ns metallb-system --ignore-ns prometheus-operator >> /tmp/output.log &
|
||||||
|
|
||||||
|
# Actually run the test
|
||||||
|
ct install --config .github/ct-install.yaml \
|
||||||
|
--charts charts/library/common-test \
|
||||||
|
--debug || (echo -e "\n\n--===PODLOGS===--\n\n" && \
|
||||||
|
cat /tmp/output.log && \
|
||||||
|
rm -f /tmp/output.log && exit 1)
|
||||||
|
|
||||||
|
kill $!
|
||||||
|
echo -e "\n\n--===PODLOGS===--\n\n"
|
||||||
|
cat /tmp/output.log
|
||||||
|
rm -f /tmp/output.log
|
||||||
|
|
||||||
Reference in New Issue
Block a user