2022-03-30 04:46:56 -04:00
|
|
|
name: "Charts: Lint"
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_call:
|
|
|
|
inputs:
|
|
|
|
checkoutCommit:
|
|
|
|
required: true
|
|
|
|
type: string
|
|
|
|
chartChangesDetected:
|
|
|
|
required: true
|
|
|
|
type: string
|
|
|
|
|
|
|
|
jobs:
|
2022-03-30 13:59:15 -04:00
|
|
|
generate-lint-matrix:
|
|
|
|
name: Generate matrix for lint
|
2022-03-30 04:46:56 -04:00
|
|
|
runs-on: ubuntu-latest
|
2022-03-30 13:59:15 -04:00
|
|
|
outputs:
|
2022-03-30 14:54:57 -04:00
|
|
|
matrix1: |
|
2022-03-30 13:59:15 -04:00
|
|
|
{
|
2022-03-30 14:54:57 -04:00
|
|
|
"chart": ${{ steps.list-changed.outputs.charts1 }}
|
|
|
|
}
|
|
|
|
matrix2: |
|
|
|
|
{
|
|
|
|
"chart": ${{ steps.list-changed.outputs.charts2 }}
|
2022-03-30 13:59:15 -04:00
|
|
|
}
|
2022-04-05 13:30:02 -04:00
|
|
|
matrix3: |
|
|
|
|
{
|
|
|
|
"chart": ${{ steps.list-changed.outputs.charts3 }}
|
|
|
|
}
|
|
|
|
matrix4: |
|
|
|
|
{
|
|
|
|
"chart": ${{ steps.list-changed.outputs.charts4 }}
|
|
|
|
}
|
|
|
|
matrix5: |
|
|
|
|
{
|
|
|
|
"chart": ${{ steps.list-changed.outputs.charts5 }}
|
|
|
|
}
|
|
|
|
matrix6: |
|
|
|
|
{
|
|
|
|
"chart": ${{ steps.list-changed.outputs.charts6 }}
|
|
|
|
}
|
2022-03-31 05:14:14 -04:00
|
|
|
detected1: ${{ steps.list-changed.outputs.detected1 }}
|
|
|
|
detected2: ${{ steps.list-changed.outputs.detected2 }}
|
2022-04-05 13:30:02 -04:00
|
|
|
detected3: ${{ steps.list-changed.outputs.detected3 }}
|
|
|
|
detected4: ${{ steps.list-changed.outputs.detected4 }}
|
|
|
|
detected5: ${{ steps.list-changed.outputs.detected5 }}
|
|
|
|
detected6: ${{ steps.list-changed.outputs.detected6 }}
|
2022-03-30 04:46:56 -04:00
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2022-04-16 02:32:13 -04:00
|
|
|
uses: actions/checkout@dcd71f646680f2efd8db4afa5ad64fdcba30e748 # tag=v3
|
2022-03-30 04:46:56 -04:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
ref: ${{ inputs.checkoutCommit }}
|
|
|
|
|
|
|
|
- name: Set up chart-testing
|
2022-03-31 07:21:48 -04:00
|
|
|
uses: helm/chart-testing-action@dae259e86a35ff09145c0805e2d7dd3f7207064a # tag=v2.2.1
|
2022-03-30 04:46:56 -04:00
|
|
|
|
2022-03-30 14:54:57 -04:00
|
|
|
- name: Collect changes
|
2022-03-30 04:46:56 -04:00
|
|
|
id: list-changed
|
|
|
|
if: inputs.chartChangesDetected == 'true'
|
|
|
|
run: |
|
2022-04-07 09:25:14 -04:00
|
|
|
EXCLUDED=$(yq eval -o=json '.excluded-charts // []' .github/ct-lint.yaml)
|
|
|
|
CHARTS=$(ct list-changed --config .github/ct-lint.yaml)
|
2022-03-30 04:46:56 -04:00
|
|
|
CHARTS_JSON=$(echo "${CHARTS}" | jq -R -s -c 'split("\n")[:-1]')
|
|
|
|
OUTPUT_JSON=$(echo "{\"excluded\": ${EXCLUDED}, \"all\": ${CHARTS_JSON}}" | jq -c '.all-.excluded')
|
2022-04-05 13:30:02 -04:00
|
|
|
OUTPUT_JSON1=$(echo $OUTPUT_JSON | jq -r -c '.[:250]')
|
|
|
|
OUTPUT_JSON2=$(echo $OUTPUT_JSON | jq -r -c '.[251:500]')
|
|
|
|
OUTPUT_JSON3=$(echo $OUTPUT_JSON | jq -r -c '.[501:750]')
|
|
|
|
OUTPUT_JSON4=$(echo $OUTPUT_JSON | jq -r -c '.[751:1000]')
|
|
|
|
OUTPUT_JSON5=$(echo $OUTPUT_JSON | jq -r -c '.[1001:1250]')
|
|
|
|
OUTPUT_JSON6=$(echo $OUTPUT_JSON | jq -r -c '.[1251:1500]')
|
2022-03-30 14:54:57 -04:00
|
|
|
echo ::set-output name=charts1::${OUTPUT_JSON1}
|
|
|
|
echo ::set-output name=charts2::${OUTPUT_JSON2}
|
2022-04-05 13:30:02 -04:00
|
|
|
echo ::set-output name=charts2::${OUTPUT_JSON3}
|
|
|
|
echo ::set-output name=charts2::${OUTPUT_JSON4}
|
|
|
|
echo ::set-output name=charts2::${OUTPUT_JSON5}
|
|
|
|
echo ::set-output name=charts2::${OUTPUT_JSON6}
|
2022-03-31 05:14:14 -04:00
|
|
|
if [[ $(echo ${OUTPUT_JSON1} | jq -c '. | length') -gt 0 ]]; then
|
|
|
|
echo "::set-output name=detected1::true"
|
|
|
|
fi
|
|
|
|
if [[ $(echo ${OUTPUT_JSON2} | jq -c '. | length') -gt 0 ]]; then
|
|
|
|
echo "::set-output name=detected2::true"
|
2022-03-30 04:46:56 -04:00
|
|
|
fi
|
2022-04-05 13:30:02 -04:00
|
|
|
if [[ $(echo ${OUTPUT_JSON3} | jq -c '. | length') -gt 0 ]]; then
|
|
|
|
echo "::set-output name=detected3::true"
|
|
|
|
fi
|
|
|
|
if [[ $(echo ${OUTPUT_JSON4} | jq -c '. | length') -gt 0 ]]; then
|
|
|
|
echo "::set-output name=detected4::true"
|
|
|
|
fi
|
|
|
|
if [[ $(echo ${OUTPUT_JSON5} | jq -c '. | length') -gt 0 ]]; then
|
|
|
|
echo "::set-output name=detected5::true"
|
|
|
|
fi
|
|
|
|
if [[ $(echo ${OUTPUT_JSON6} | jq -c '. | length') -gt 0 ]]; then
|
|
|
|
echo "::set-output name=detected6::true"
|
|
|
|
fi
|
2022-03-30 04:46:56 -04:00
|
|
|
|
2022-03-30 14:54:57 -04:00
|
|
|
lint-charts1:
|
2022-03-30 13:59:15 -04:00
|
|
|
needs:
|
|
|
|
- generate-lint-matrix
|
2022-03-31 05:14:14 -04:00
|
|
|
if: needs.generate-lint-matrix.outputs.detected1 == 'true'
|
2022-03-30 15:01:19 -04:00
|
|
|
name: Lint charts Part 1
|
2022-03-30 13:59:15 -04:00
|
|
|
strategy:
|
2022-03-30 14:54:57 -04:00
|
|
|
matrix: ${{ fromJson(needs.generate-lint-matrix.outputs.matrix1) }}
|
2022-03-31 05:14:14 -04:00
|
|
|
fail-fast: false
|
2022-04-05 13:30:02 -04:00
|
|
|
max-parallel: 5
|
2022-03-30 13:59:15 -04:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2022-04-16 02:32:13 -04:00
|
|
|
uses: actions/checkout@dcd71f646680f2efd8db4afa5ad64fdcba30e748 # tag=v3
|
2022-03-30 13:59:15 -04:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
ref: ${{ inputs.checkoutCommit }}
|
|
|
|
|
|
|
|
- name: lint Kubernetes tools
|
2022-03-31 07:21:48 -04:00
|
|
|
uses: yokawasa/action-setup-kube-tools@c81bf94cddd6c3172e6f61aa7f5ad66a2b5db98d # tag=v0.8.0
|
2022-03-30 13:59:15 -04:00
|
|
|
with:
|
|
|
|
setup-tools: |
|
|
|
|
helmv3
|
|
|
|
helm: "3.8.0"
|
|
|
|
|
2022-04-11 16:11:26 -04:00
|
|
|
- uses: actions/setup-python@98f2ad02fd48d057ee3b4d4f66525b231c3e52b6 # tag=v3
|
2022-03-30 13:59:15 -04:00
|
|
|
with:
|
|
|
|
python-version: "3.10"
|
|
|
|
|
|
|
|
- name: Set up chart-testing
|
2022-03-31 07:21:48 -04:00
|
|
|
uses: helm/chart-testing-action@dae259e86a35ff09145c0805e2d7dd3f7207064a # tag=v2.2.1
|
2022-03-30 13:59:15 -04:00
|
|
|
|
2022-03-30 04:46:56 -04:00
|
|
|
- name: Run chart-testing (lint)
|
2022-03-31 06:31:14 -04:00
|
|
|
run: ct lint --config ".github/ct-lint.yaml" --charts "${{ matrix.chart }}"
|
2022-04-05 13:30:02 -04:00
|
|
|
|
2022-03-30 14:54:57 -04:00
|
|
|
lint-charts2:
|
|
|
|
needs:
|
|
|
|
- generate-lint-matrix
|
2022-03-31 05:14:14 -04:00
|
|
|
if: needs.generate-lint-matrix.outputs.detected2 == 'true'
|
2022-03-30 15:01:19 -04:00
|
|
|
name: Lint charts Part 2
|
2022-03-30 14:54:57 -04:00
|
|
|
strategy:
|
|
|
|
matrix: ${{ fromJson(needs.generate-lint-matrix.outputs.matrix2) }}
|
2022-03-31 05:14:14 -04:00
|
|
|
fail-fast: false
|
2022-03-30 15:17:11 -04:00
|
|
|
max-parallel: 5
|
2022-03-30 14:54:57 -04:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2022-04-16 02:32:13 -04:00
|
|
|
uses: actions/checkout@dcd71f646680f2efd8db4afa5ad64fdcba30e748 # tag=v3
|
2022-03-30 14:54:57 -04:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
ref: ${{ inputs.checkoutCommit }}
|
|
|
|
|
|
|
|
- name: lint Kubernetes tools
|
2022-03-31 07:21:48 -04:00
|
|
|
uses: yokawasa/action-setup-kube-tools@c81bf94cddd6c3172e6f61aa7f5ad66a2b5db98d # tag=v0.8.0
|
2022-03-30 14:54:57 -04:00
|
|
|
with:
|
|
|
|
setup-tools: |
|
|
|
|
helmv3
|
|
|
|
helm: "3.8.0"
|
|
|
|
|
2022-04-11 16:11:26 -04:00
|
|
|
- uses: actions/setup-python@98f2ad02fd48d057ee3b4d4f66525b231c3e52b6 # tag=v3
|
2022-03-30 14:54:57 -04:00
|
|
|
with:
|
|
|
|
python-version: "3.10"
|
|
|
|
|
|
|
|
- name: Set up chart-testing
|
2022-03-31 07:21:48 -04:00
|
|
|
uses: helm/chart-testing-action@dae259e86a35ff09145c0805e2d7dd3f7207064a # tag=v2.2.1
|
2022-03-30 14:54:57 -04:00
|
|
|
|
|
|
|
- name: Run chart-testing (lint)
|
2022-03-31 06:31:14 -04:00
|
|
|
run: ct lint --config ".github/ct-lint.yaml" --charts "${{ matrix.chart }}"
|
2022-03-30 13:59:15 -04:00
|
|
|
|
2022-04-05 13:30:02 -04:00
|
|
|
lint-charts3:
|
|
|
|
needs:
|
|
|
|
- generate-lint-matrix
|
|
|
|
if: needs.generate-lint-matrix.outputs.detected3 == 'true'
|
|
|
|
name: Lint charts Part 3
|
|
|
|
strategy:
|
|
|
|
matrix: ${{ fromJson(needs.generate-lint-matrix.outputs.matrix3) }}
|
|
|
|
fail-fast: false
|
|
|
|
max-parallel: 5
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2022-04-16 02:32:13 -04:00
|
|
|
uses: actions/checkout@dcd71f646680f2efd8db4afa5ad64fdcba30e748 # tag=v3
|
2022-04-05 13:30:02 -04:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
ref: ${{ inputs.checkoutCommit }}
|
|
|
|
|
|
|
|
- name: lint Kubernetes tools
|
|
|
|
uses: yokawasa/action-setup-kube-tools@c81bf94cddd6c3172e6f61aa7f5ad66a2b5db98d # tag=v0.8.0
|
|
|
|
with:
|
|
|
|
setup-tools: |
|
|
|
|
helmv3
|
|
|
|
helm: "3.8.0"
|
|
|
|
|
2022-04-11 16:11:26 -04:00
|
|
|
- uses: actions/setup-python@98f2ad02fd48d057ee3b4d4f66525b231c3e52b6 # tag=v3
|
2022-04-05 13:30:02 -04:00
|
|
|
with:
|
|
|
|
python-version: "3.10"
|
|
|
|
|
|
|
|
- name: Set up chart-testing
|
|
|
|
uses: helm/chart-testing-action@dae259e86a35ff09145c0805e2d7dd3f7207064a # tag=v2.2.1
|
|
|
|
|
|
|
|
- name: Run chart-testing (lint)
|
|
|
|
run: ct lint --config ".github/ct-lint.yaml" --charts "${{ matrix.chart }}"
|
|
|
|
|
|
|
|
lint-charts4:
|
|
|
|
needs:
|
|
|
|
- generate-lint-matrix
|
|
|
|
if: needs.generate-lint-matrix.outputs.detected4 == 'true'
|
|
|
|
name: Lint charts Part 4
|
|
|
|
strategy:
|
|
|
|
matrix: ${{ fromJson(needs.generate-lint-matrix.outputs.matrix4) }}
|
|
|
|
fail-fast: false
|
|
|
|
max-parallel: 5
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2022-04-16 02:32:13 -04:00
|
|
|
uses: actions/checkout@dcd71f646680f2efd8db4afa5ad64fdcba30e748 # tag=v3
|
2022-04-05 13:30:02 -04:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
ref: ${{ inputs.checkoutCommit }}
|
|
|
|
|
|
|
|
- name: lint Kubernetes tools
|
|
|
|
uses: yokawasa/action-setup-kube-tools@c81bf94cddd6c3172e6f61aa7f5ad66a2b5db98d # tag=v0.8.0
|
|
|
|
with:
|
|
|
|
setup-tools: |
|
|
|
|
helmv3
|
|
|
|
helm: "3.8.0"
|
|
|
|
|
2022-04-11 16:11:26 -04:00
|
|
|
- uses: actions/setup-python@98f2ad02fd48d057ee3b4d4f66525b231c3e52b6 # tag=v3
|
2022-04-05 13:30:02 -04:00
|
|
|
with:
|
|
|
|
python-version: "3.10"
|
|
|
|
|
|
|
|
- name: Set up chart-testing
|
|
|
|
uses: helm/chart-testing-action@dae259e86a35ff09145c0805e2d7dd3f7207064a # tag=v2.2.1
|
|
|
|
|
|
|
|
- name: Run chart-testing (lint)
|
|
|
|
run: ct lint --config ".github/ct-lint.yaml" --charts "${{ matrix.chart }}"
|
|
|
|
|
|
|
|
lint-charts5:
|
|
|
|
needs:
|
|
|
|
- generate-lint-matrix
|
|
|
|
if: needs.generate-lint-matrix.outputs.detected5 == 'true'
|
|
|
|
name: Lint charts Part 5
|
|
|
|
strategy:
|
|
|
|
matrix: ${{ fromJson(needs.generate-lint-matrix.outputs.matrix5) }}
|
|
|
|
fail-fast: false
|
|
|
|
max-parallel: 5
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2022-04-16 02:32:13 -04:00
|
|
|
uses: actions/checkout@dcd71f646680f2efd8db4afa5ad64fdcba30e748 # tag=v3
|
2022-04-05 13:30:02 -04:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
ref: ${{ inputs.checkoutCommit }}
|
|
|
|
|
|
|
|
- name: lint Kubernetes tools
|
|
|
|
uses: yokawasa/action-setup-kube-tools@c81bf94cddd6c3172e6f61aa7f5ad66a2b5db98d # tag=v0.8.0
|
|
|
|
with:
|
|
|
|
setup-tools: |
|
|
|
|
helmv3
|
|
|
|
helm: "3.8.0"
|
|
|
|
|
2022-04-11 16:11:26 -04:00
|
|
|
- uses: actions/setup-python@98f2ad02fd48d057ee3b4d4f66525b231c3e52b6 # tag=v3
|
2022-04-05 13:30:02 -04:00
|
|
|
with:
|
|
|
|
python-version: "3.10"
|
|
|
|
|
|
|
|
- name: Set up chart-testing
|
|
|
|
uses: helm/chart-testing-action@dae259e86a35ff09145c0805e2d7dd3f7207064a # tag=v2.2.1
|
|
|
|
|
|
|
|
- name: Run chart-testing (lint)
|
|
|
|
run: ct lint --config ".github/ct-lint.yaml" --charts "${{ matrix.chart }}"
|
|
|
|
|
|
|
|
lint-charts6:
|
|
|
|
needs:
|
|
|
|
- generate-lint-matrix
|
|
|
|
if: needs.generate-lint-matrix.outputs.detected6 == 'true'
|
|
|
|
name: Lint charts Part 6
|
|
|
|
strategy:
|
|
|
|
matrix: ${{ fromJson(needs.generate-lint-matrix.outputs.matrix6) }}
|
|
|
|
fail-fast: false
|
|
|
|
max-parallel: 5
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2022-04-16 02:32:13 -04:00
|
|
|
uses: actions/checkout@dcd71f646680f2efd8db4afa5ad64fdcba30e748 # tag=v3
|
2022-04-05 13:30:02 -04:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
ref: ${{ inputs.checkoutCommit }}
|
|
|
|
|
|
|
|
- name: lint Kubernetes tools
|
|
|
|
uses: yokawasa/action-setup-kube-tools@c81bf94cddd6c3172e6f61aa7f5ad66a2b5db98d # tag=v0.8.0
|
|
|
|
with:
|
|
|
|
setup-tools: |
|
|
|
|
helmv3
|
|
|
|
helm: "3.8.0"
|
|
|
|
|
2022-04-11 16:11:26 -04:00
|
|
|
- uses: actions/setup-python@98f2ad02fd48d057ee3b4d4f66525b231c3e52b6 # tag=v3
|
2022-04-05 13:30:02 -04:00
|
|
|
with:
|
|
|
|
python-version: "3.10"
|
|
|
|
|
|
|
|
- name: Set up chart-testing
|
|
|
|
uses: helm/chart-testing-action@dae259e86a35ff09145c0805e2d7dd3f7207064a # tag=v2.2.1
|
|
|
|
|
|
|
|
- name: Run chart-testing (lint)
|
|
|
|
run: ct lint --config ".github/ct-lint.yaml" --charts "${{ matrix.chart }}"
|
|
|
|
|
|
|
|
|
2022-03-30 13:59:15 -04:00
|
|
|
# Summarize matrix https://github.community/t/status-check-for-a-matrix-jobs/127354/7
|
|
|
|
lint_success:
|
|
|
|
needs:
|
|
|
|
- generate-lint-matrix
|
2022-03-30 14:54:57 -04:00
|
|
|
- lint-charts1
|
|
|
|
- lint-charts2
|
2022-03-30 13:59:15 -04:00
|
|
|
if: |
|
|
|
|
always()
|
|
|
|
name: Lint successful
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Check lint matrix status
|
2022-04-05 13:30:02 -04:00
|
|
|
if: ${{ ( (needs.generate-lint-matrix.outputs.detected1 == 'true') && (needs.lint-charts1.result != 'success') ) && ( (needs.generate-lint-matrix.outputs.detected2 == 'true') && ( (needs.lint-charts2.result != 'success') || ( needs.lint-charts2.result != 'skipped' ) ) ) && ( (needs.generate-lint-matrix.outputs.detected3 == 'true') && ( (needs.lint-charts2.result != 'success') || ( needs.lint-charts3.result != 'skipped' ) ) ) && ( (needs.generate-lint-matrix.outputs.detected4 == 'true') && ( (needs.lint-charts2.result != 'success') || ( needs.lint-charts4.result != 'skipped' ) ) ) && ( (needs.generate-lint-matrix.outputs.detected5 == 'true') && ( (needs.lint-charts2.result != 'success') || ( needs.lint-charts5.result != 'skipped' ) ) ) && ( (needs.generate-lint-matrix.outputs.detected6 == 'true') && ( (needs.lint-charts2.result != 'success') || ( needs.lint-charts6.result != 'skipped' ) ) ) }}
|
2022-03-30 13:59:15 -04:00
|
|
|
run: exit 1
|