From 41be9723b7a21b69540af446a7b0f14cc460db21 Mon Sep 17 00:00:00 2001 From: Tommy Skaug Date: Mon, 11 Nov 2024 20:06:16 +0100 Subject: [PATCH] chore: split steps into different jobs according to function --- .../{testing.yaml => validate-charts.yaml} | 44 ++++++++++++++++--- 1 file changed, 38 insertions(+), 6 deletions(-) rename .forgejo/workflows/{testing.yaml => validate-charts.yaml} (58%) diff --git a/.forgejo/workflows/testing.yaml b/.forgejo/workflows/validate-charts.yaml similarity index 58% rename from .forgejo/workflows/testing.yaml rename to .forgejo/workflows/validate-charts.yaml index 20e0bc5..25b7ef3 100644 --- a/.forgejo/workflows/testing.yaml +++ b/.forgejo/workflows/validate-charts.yaml @@ -12,7 +12,8 @@ on: - 'main' jobs: - chart-testing: + charts-changed: + name: Get Charts being Changed runs-on: flakes-action steps: - name: Checkout @@ -32,9 +33,10 @@ jobs: reposChanged: ${{ steps.changed-charts.outputs.reposChanged }} changesExist: ${{ env.changesExist }} - validation: - needs: chart-testing - if: needs.chart-testing.outputs.changesExist == 'true' + validate-linting: + name: "Validate: Linting" + needs: charts-changed + if: needs.charts-changed.outputs.changesExist == 'true' runs-on: flakes-action steps: - name: Checkout @@ -42,20 +44,50 @@ jobs: with: fetch-depth: 0 - - name: Process Changed Repositories + - name: Linting Changed Repositories run: | - repos='${{ needs.chart-testing.outputs.reposChanged }}' + repos='${{ needs.charts-changed.outputs.reposChanged }}' for repo in $(echo $repos | jq -r '.[]'); do echo "Linting $repo" ct --config .forgejo/ct.yaml lint "$repo" + done + validate-audit: + name: "Validate: Audit" + needs: charts-changed + if: needs.charts-changed.outputs.changesExist == 'true' + runs-on: flakes-action + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Auditing changed charts + run: | + repos='${{ needs.charts-changed.outputs.reposChanged }}' + for repo in $(echo $repos | jq -r '.[]'); do echo "Auditing $repo" polaris audit --helm-chart "$repo" \ --helm-values "$repo/values.yaml" \ --format pretty \ --set-exit-code-on-danger \ --set-exit-code-below-score 90 + done + validate-api: + name: "Validate: Outdated APIs" + needs: charts-changed + if: needs.charts-changed.outputs.changesExist == 'true' + runs-on: flakes-action + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Checking changed charts for outdated APIs + run: | + repos='${{ needs.charts-changed.outputs.reposChanged }}' + for repo in $(echo $repos | jq -r '.[]'); do echo "Checking deprecated apiVersions for $repo" helm template "$repo" -f "$repo/ci/pluto-values.yaml" | pluto detect - --ignore-deprecations done