mirror of
https://github.com/bjw-s-labs/helm-charts.git
synced 2025-07-03 08:37:03 +02:00
ci: 🧠
This commit is contained in:
parent
dfd0ebaf7b
commit
005339b3ef
4 changed files with 50 additions and 40 deletions
|
@ -10,7 +10,9 @@ chart-dirs:
|
|||
- charts/library
|
||||
- charts/stable
|
||||
|
||||
excluded-charts:
|
||||
excluded-charts-lint: []
|
||||
|
||||
excluded-charts-install: []
|
||||
|
||||
chart-repos:
|
||||
- bitnami=https://charts.bitnami.com/bitnami
|
2
.github/workflows/charts-lint.yaml
vendored
2
.github/workflows/charts-lint.yaml
vendored
|
@ -37,4 +37,4 @@ jobs:
|
|||
- name: Run chart-testing (lint)
|
||||
id: lint
|
||||
if: inputs.chartChanges != ''
|
||||
run: ct lint --config .ci/ct/ct-lint.yaml
|
||||
run: ct lint --config .ci/ct/ct.yaml
|
||||
|
|
72
.github/workflows/charts-test.yaml
vendored
72
.github/workflows/charts-test.yaml
vendored
|
@ -11,39 +11,39 @@ on:
|
|||
type: string
|
||||
|
||||
jobs:
|
||||
unit-test:
|
||||
name: Run unit tests
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: ${{ inputs.checkoutCommit }}
|
||||
# unit-test:
|
||||
# name: Run unit tests
|
||||
# runs-on: ubuntu-latest
|
||||
# steps:
|
||||
# - name: Checkout
|
||||
# uses: actions/checkout@v3
|
||||
# with:
|
||||
# fetch-depth: 0
|
||||
# ref: ${{ inputs.checkoutCommit }}
|
||||
|
||||
- name: Install Kubernetes tools
|
||||
uses: yokawasa/action-setup-kube-tools@v0.8.2
|
||||
with:
|
||||
setup-tools: |
|
||||
helmv3
|
||||
helm: "3.8.0"
|
||||
# - name: Install Kubernetes tools
|
||||
# uses: yokawasa/action-setup-kube-tools@v0.8.2
|
||||
# with:
|
||||
# setup-tools: |
|
||||
# helmv3
|
||||
# helm: "3.8.0"
|
||||
|
||||
- name: Install Ruby
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: 2.7
|
||||
# - name: Install Ruby
|
||||
# uses: ruby/setup-ruby@v1
|
||||
# with:
|
||||
# ruby-version: 2.7
|
||||
|
||||
- name: Install dependencies
|
||||
env:
|
||||
RUBYJQ_USE_SYSTEM_LIBRARIES: 1
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install libjq-dev
|
||||
bundle install
|
||||
# - name: Install dependencies
|
||||
# env:
|
||||
# RUBYJQ_USE_SYSTEM_LIBRARIES: 1
|
||||
# run: |
|
||||
# sudo apt-get update
|
||||
# sudo apt-get install libjq-dev
|
||||
# bundle install
|
||||
|
||||
- name: Run tests
|
||||
run: |
|
||||
bundle exec m -r ./test/
|
||||
# - name: Run tests
|
||||
# run: |
|
||||
# bundle exec m -r ./test/
|
||||
|
||||
generate-install-matrix:
|
||||
name: Generate matrix for install
|
||||
|
@ -51,7 +51,8 @@ jobs:
|
|||
outputs:
|
||||
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 }}
|
||||
steps:
|
||||
|
@ -68,10 +69,9 @@ jobs:
|
|||
id: list-changed
|
||||
if: inputs.chartChanges != ''
|
||||
run: |
|
||||
EXCLUDED=$(yq eval -o=json '.excluded-charts // []' .github/ct-install.yaml)
|
||||
CHARTS=$(ct list-changed --config .github/ct-install.yaml)
|
||||
CHARTS_JSON=$(echo "${CHARTS}" | jq -R -s -c 'split("\n")[:-1]')
|
||||
OUTPUT_JSON=$(echo "{\"excluded\": ${EXCLUDED}, \"all\": ${CHARTS_JSON}}" | jq -c '.all-.excluded')
|
||||
EXCLUDED=$(yq eval '.excluded-charts-install | join(",")' .ci/ct/ct.yaml)
|
||||
CHARTS=$(ct list-changed --config .ci/ct/ct.yaml --excluded-charts "${EXCLUDED}")
|
||||
OUTPUT_JSON=$(echo "${CHARTS}" | jq -R -s -c 'split("\n")[:-1]')
|
||||
echo ::set-output name=charts::${OUTPUT_JSON}
|
||||
if [[ $(echo ${OUTPUT_JSON} | jq -c '. | length') -gt 0 ]]; then
|
||||
echo "::set-output name=detected::true"
|
||||
|
@ -110,14 +110,14 @@ jobs:
|
|||
- name: Create k3d cluster
|
||||
uses: nolar/setup-k3d-k3s@v1
|
||||
with:
|
||||
version: v1.19
|
||||
version: ${{ matrix.k8s_version }}
|
||||
|
||||
- name: Remove node taints
|
||||
run: |
|
||||
kubectl taint --all=true nodes node.cloudprovider.kubernetes.io/uninitialized- || true
|
||||
|
||||
- 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
|
||||
install_success:
|
||||
|
|
|
@ -1,15 +1,23 @@
|
|||
---
|
||||
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:
|
||||
lint:
|
||||
desc: Run ct-lint on charts
|
||||
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
|
||||
|
||||
lint-all:
|
||||
desc: Run ct-lint on all charts
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue