This commit is contained in:
Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs 2022-07-27 13:19:45 +02:00
parent dfd0ebaf7b
commit 005339b3ef
No known key found for this signature in database
GPG key ID: BC5E2BD907F9A8EC
4 changed files with 50 additions and 40 deletions

View file

@ -10,7 +10,9 @@ chart-dirs:
- charts/library - charts/library
- charts/stable - charts/stable
excluded-charts: excluded-charts-lint: []
excluded-charts-install: []
chart-repos: chart-repos:
- bitnami=https://charts.bitnami.com/bitnami - bitnami=https://charts.bitnami.com/bitnami

View file

@ -37,4 +37,4 @@ jobs:
- name: Run chart-testing (lint) - name: Run chart-testing (lint)
id: lint id: lint
if: inputs.chartChanges != '' if: inputs.chartChanges != ''
run: ct lint --config .ci/ct/ct-lint.yaml run: ct lint --config .ci/ct/ct.yaml

View file

@ -11,39 +11,39 @@ on:
type: string type: string
jobs: jobs:
unit-test: # unit-test:
name: Run unit tests # name: Run unit tests
runs-on: ubuntu-latest # runs-on: ubuntu-latest
steps: # steps:
- name: Checkout # - name: Checkout
uses: actions/checkout@v3 # uses: actions/checkout@v3
with: # with:
fetch-depth: 0 # fetch-depth: 0
ref: ${{ inputs.checkoutCommit }} # ref: ${{ inputs.checkoutCommit }}
- name: Install Kubernetes tools # - name: Install Kubernetes tools
uses: yokawasa/action-setup-kube-tools@v0.8.2 # uses: yokawasa/action-setup-kube-tools@v0.8.2
with: # with:
setup-tools: | # setup-tools: |
helmv3 # helmv3
helm: "3.8.0" # helm: "3.8.0"
- name: Install Ruby # - name: Install Ruby
uses: ruby/setup-ruby@v1 # uses: ruby/setup-ruby@v1
with: # with:
ruby-version: 2.7 # ruby-version: 2.7
- name: Install dependencies # - name: Install dependencies
env: # env:
RUBYJQ_USE_SYSTEM_LIBRARIES: 1 # RUBYJQ_USE_SYSTEM_LIBRARIES: 1
run: | # run: |
sudo apt-get update # sudo apt-get update
sudo apt-get install libjq-dev # sudo apt-get install libjq-dev
bundle install # bundle install
- name: Run tests # - name: Run tests
run: | # run: |
bundle exec m -r ./test/ # bundle exec m -r ./test/
generate-install-matrix: generate-install-matrix:
name: Generate matrix for install name: Generate matrix for install
@ -51,7 +51,8 @@ jobs:
outputs: outputs:
matrix: | matrix: |
{ {
"chart": ${{ steps.list-changed.outputs.charts }} "chart": ${{ steps.list-changed.outputs.charts }},
"k8s_version": ["v1.21", "v1.24"]
} }
detected: ${{ steps.list-changed.outputs.detected }} detected: ${{ steps.list-changed.outputs.detected }}
steps: steps:
@ -68,10 +69,9 @@ jobs:
id: list-changed id: list-changed
if: inputs.chartChanges != '' if: inputs.chartChanges != ''
run: | run: |
EXCLUDED=$(yq eval -o=json '.excluded-charts // []' .github/ct-install.yaml) EXCLUDED=$(yq eval '.excluded-charts-install | join(",")' .ci/ct/ct.yaml)
CHARTS=$(ct list-changed --config .github/ct-install.yaml) CHARTS=$(ct list-changed --config .ci/ct/ct.yaml --excluded-charts "${EXCLUDED}")
CHARTS_JSON=$(echo "${CHARTS}" | jq -R -s -c 'split("\n")[:-1]') OUTPUT_JSON=$(echo "${CHARTS}" | jq -R -s -c 'split("\n")[:-1]')
OUTPUT_JSON=$(echo "{\"excluded\": ${EXCLUDED}, \"all\": ${CHARTS_JSON}}" | jq -c '.all-.excluded')
echo ::set-output name=charts::${OUTPUT_JSON} echo ::set-output name=charts::${OUTPUT_JSON}
if [[ $(echo ${OUTPUT_JSON} | jq -c '. | length') -gt 0 ]]; then if [[ $(echo ${OUTPUT_JSON} | jq -c '. | length') -gt 0 ]]; then
echo "::set-output name=detected::true" echo "::set-output name=detected::true"
@ -110,14 +110,14 @@ jobs:
- name: Create k3d cluster - name: Create k3d cluster
uses: nolar/setup-k3d-k3s@v1 uses: nolar/setup-k3d-k3s@v1
with: with:
version: v1.19 version: ${{ matrix.k8s_version }}
- name: Remove node taints - name: Remove node taints
run: | run: |
kubectl taint --all=true nodes node.cloudprovider.kubernetes.io/uninitialized- || true kubectl taint --all=true nodes node.cloudprovider.kubernetes.io/uninitialized- || true
- name: Run chart-testing (install) - name: Run chart-testing (install)
run: ct install --config .github/ct-install.yaml --charts ${{ matrix.chart }} run: ct install --config .ci/ct/ct.yaml --charts ${{ matrix.chart }}
# Summarize matrix https://github.community/t/status-check-for-a-matrix-jobs/127354/7 # Summarize matrix https://github.community/t/status-check-for-a-matrix-jobs/127354/7
install_success: install_success:

View file

@ -1,15 +1,23 @@
--- ---
version: "3" version: "3"
vars:
CT_IMAGE: quay.io/helmpack/chart-testing:v3.6.0
CT_CONFIG_FILE: .ci/ct/ct.yaml
CHARTS_EXCLUDED_FROM_LINT:
sh: yq eval '.excluded-charts-lint | join(",")' {{.CT_CONFIG_FILE}}
CHARTS_EXCLUDED_FROM_INSTALL:
sh: yq eval '.excluded-charts-install | join(",")' {{.CT_CONFIG_FILE}}
tasks: tasks:
lint: lint:
desc: Run ct-lint on charts desc: Run ct-lint on charts
cmds: cmds:
- docker run --rm -it --workdir=/data --volume $(pwd):/data quay.io/helmpack/chart-testing:v3.6.0 ct lint --config .ci/ct/ct-lint.yaml - docker run --rm -it --workdir=/data --volume $(pwd):/data {{.CT_IMAGE}} ct lint --config {{.CT_CONFIG_FILE}} --excluded-charts "{{.CHARTS_EXCLUDED_FROM_LINT}}"
silent: true silent: true
lint-all: lint-all:
desc: Run ct-lint on all charts desc: Run ct-lint on all charts
cmds: cmds:
- docker run --rm -it --workdir=/data --volume $(pwd):/data quay.io/helmpack/chart-testing:v3.6.0 ct lint --config .ci/ct/ct-lint.yaml --all - docker run --rm -it --workdir=/data --volume $(pwd):/data {{.CT_IMAGE}} ct lint --config {{.CT_CONFIG_FILE}} --all --excluded-charts "{{.CHARTS_EXCLUDED_FROM_LINT}}"
silent: true silent: true