mirror of
https://github.com/bjw-s-labs/helm-charts.git
synced 2025-07-04 00:47:04 +02:00
More CI improvements
This commit is contained in:
parent
d83abae451
commit
bcded223a6
41 changed files with 359 additions and 120 deletions
35
.github/workflows/charts-test.yaml
vendored
35
.github/workflows/charts-test.yaml
vendored
|
@ -9,8 +9,14 @@ on:
|
|||
chartsToTest:
|
||||
description: >
|
||||
A JSON encoded array of charts to lint
|
||||
required: true
|
||||
type: string
|
||||
required: true
|
||||
overrideDeps:
|
||||
description: >
|
||||
A JSON encoded array of dependencies to override before testing
|
||||
type: string
|
||||
required: false
|
||||
default: '[]'
|
||||
|
||||
env:
|
||||
HELM_VERSION: 3.9.2
|
||||
|
@ -19,7 +25,7 @@ jobs:
|
|||
install-chart:
|
||||
name: Install chart
|
||||
runs-on: ubuntu-22.04
|
||||
if: ${{ inputs.chartsToTest != '' && inputs.chartsToTest != '[]' }}
|
||||
if: ${{ inputs.chartsToTest != '[]' && inputs.chartsToTest != '' }}
|
||||
strategy:
|
||||
matrix:
|
||||
chart: ${{ fromJSON(inputs.chartsToTest) }}
|
||||
|
@ -57,6 +63,13 @@ jobs:
|
|||
run: |
|
||||
kubectl taint --all=true nodes node.cloudprovider.kubernetes.io/uninitialized- || true
|
||||
|
||||
- name: Override chart dependencies
|
||||
uses: ./.github/actions/override-chart-deps
|
||||
if: ${{ inputs.overrideDeps != '[]' }}
|
||||
with:
|
||||
chart: ${{ matrix.chart }}
|
||||
overrides: ${{ inputs.overrideDeps }}
|
||||
|
||||
- name: Run chart-testing (install)
|
||||
run: ct install --config .ci/ct/ct.yaml --charts "charts/${{ matrix.chart }}"
|
||||
|
||||
|
@ -70,13 +83,13 @@ jobs:
|
|||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Check install matrix status
|
||||
if: ${{ (inputs.chartsToTest != '' && inputs.chartsToTest != '[]') && needs.install-chart.result != 'success' }}
|
||||
if: ${{ (inputs.chartsToTest != '[]' && inputs.chartsToTest != '') && needs.install-chart.result != 'success' }}
|
||||
run: exit 1
|
||||
|
||||
unittest-chart:
|
||||
name: Unit-test chart
|
||||
runs-on: ubuntu-20.04
|
||||
if: ${{ inputs.chartsToTest != '' && inputs.chartsToTest != '[]' }}
|
||||
if: ${{ inputs.chartsToTest != '[]' && inputs.chartsToTest != '' }}
|
||||
strategy:
|
||||
matrix:
|
||||
chart: ${{ fromJSON(inputs.chartsToTest) }}
|
||||
|
@ -95,12 +108,18 @@ jobs:
|
|||
helmv3
|
||||
helm: "${{ env.HELM_VERSION }}"
|
||||
|
||||
- name: Override chart dependencies
|
||||
uses: ./.github/actions/override-chart-deps
|
||||
if: ${{ inputs.overrideDeps != '[]' }}
|
||||
with:
|
||||
chart: ${{ matrix.chart }}
|
||||
overrides: ${{ inputs.overrideDeps }}
|
||||
|
||||
- name: Run tests
|
||||
run: |
|
||||
helm plugin install https://github.com/vbehar/helm3-unittest --version v1.0.16
|
||||
cd "charts/${{ matrix.chart }}"
|
||||
helm dep update
|
||||
helm unittest -f "tests/**/*_test.yaml" .
|
||||
helm dep update "charts/${{ matrix.chart }}"
|
||||
helm unittest -f "tests/**/*_test.yaml" "charts/${{ matrix.chart }}"
|
||||
|
||||
# Summarize matrix https://github.community/t/status-check-for-a-matrix-jobs/127354/7
|
||||
unittest_success:
|
||||
|
@ -112,5 +131,5 @@ jobs:
|
|||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Check unittest matrix status
|
||||
if: ${{ (inputs.chartsToTest != '' && inputs.chartsToTest != '[]') && needs.unittest-chart.result != 'success' }}
|
||||
if: ${{ (inputs.chartsToTest != '[]' && inputs.chartsToTest != '') && needs.unittest-chart.result != 'success' }}
|
||||
run: exit 1
|
||||
|
|
18
.github/workflows/pr-validate.yaml
vendored
18
.github/workflows/pr-validate.yaml
vendored
|
@ -53,3 +53,21 @@ jobs:
|
|||
with:
|
||||
checkoutCommit: ${{ github.sha }}
|
||||
chartsToTest: ${{ needs.pr-metadata.outputs.chartsToInstall }}
|
||||
|
||||
library-charts-test:
|
||||
uses: bjw-s/helm-charts/.github/workflows/charts-test.yaml@main
|
||||
needs:
|
||||
- pr-metadata
|
||||
with:
|
||||
checkoutCommit: ${{ github.sha }}
|
||||
chartsToTest: |-
|
||||
${{
|
||||
(
|
||||
contains(fromJSON(needs.pr-metadata.outputs.addedOrModifiedCharts), 'library/common') &&
|
||||
'["other/kah-common-chart"]'
|
||||
) || '[]'
|
||||
}}
|
||||
overrideDeps: |-
|
||||
[
|
||||
{"name": "common", "repository": "file://../../library/common", "version": "*"}
|
||||
]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue