mirror of
https://github.com/bjw-s-labs/helm-charts.git
synced 2025-07-04 00:47:04 +02:00
Implement custom action to collect changes / matrix
This commit is contained in:
parent
fe0b8338e0
commit
d83abae451
20 changed files with 22213 additions and 183 deletions
42
.github/workflows/charts-lint.yaml
vendored
42
.github/workflows/charts-lint.yaml
vendored
|
@ -6,7 +6,9 @@ on:
|
|||
checkoutCommit:
|
||||
required: true
|
||||
type: string
|
||||
chartChanges:
|
||||
chartsToLint:
|
||||
description: >
|
||||
A JSON encoded array of charts to lint
|
||||
required: true
|
||||
type: string
|
||||
|
||||
|
@ -14,41 +16,12 @@ env:
|
|||
HELM_VERSION: 3.9.2
|
||||
|
||||
jobs:
|
||||
generate-lint-matrix:
|
||||
name: Generate matrix for linting
|
||||
runs-on: ubuntu-22.04
|
||||
outputs:
|
||||
lint-matrix: |
|
||||
{
|
||||
"chart": ${{ steps.list-changed.outputs.charts }}
|
||||
}
|
||||
detected: ${{ steps.list-changed.outputs.detected }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: ${{ inputs.checkoutCommit }}
|
||||
|
||||
- name: Run chart-testing (list-changed)
|
||||
id: list-changed
|
||||
if: inputs.chartChanges != ''
|
||||
run: |
|
||||
EXCLUDED=$(yq -o json eval '.excluded-charts-lint' .ci/ct/ct.yaml)
|
||||
CHARTS_JSON=$(yq --null-input -o json eval '"${{ inputs.chartChanges }}" | split(" ")')
|
||||
OUTPUT_JSON=$(yq --null-input -o json eval "$CHARTS_JSON - $EXCLUDED")
|
||||
echo ::set-output name=charts::${OUTPUT_JSON}
|
||||
if [[ $(echo ${OUTPUT_JSON} | jq -c '. | length') -gt 0 ]]; then
|
||||
echo "::set-output name=detected::true"
|
||||
fi
|
||||
|
||||
lint-chart:
|
||||
needs:
|
||||
- generate-lint-matrix
|
||||
if: needs.generate-lint-matrix.outputs.detected == 'true'
|
||||
if: ${{ inputs.chartsToLint != '[]' }}
|
||||
name: Lint chart
|
||||
strategy:
|
||||
matrix: ${{ fromJson(needs.generate-lint-matrix.outputs.lint-matrix) }}
|
||||
matrix:
|
||||
chart: ${{ fromJSON(inputs.chartsToLint) }}
|
||||
fail-fast: false
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
|
@ -80,7 +53,6 @@ jobs:
|
|||
# Summarize matrix https://github.community/t/status-check-for-a-matrix-jobs/127354/7
|
||||
lint_success:
|
||||
needs:
|
||||
- generate-lint-matrix
|
||||
- lint-chart
|
||||
if: |
|
||||
always()
|
||||
|
@ -88,5 +60,5 @@ jobs:
|
|||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Check lint matrix status
|
||||
if: ${{ (needs.generate-lint-matrix.outputs.detected == 'true') && (needs.lint-chart.result != 'success') }}
|
||||
if: ${{ (inputs.chartsToLint != '' && inputs.chartsToLint != '[]') && (needs.lint-chart.result != 'success') }}
|
||||
run: exit 1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue