2024-11-11 18:38:40 +00:00
|
|
|
name: Chart Validation
|
2024-11-11 06:41:59 +00:00
|
|
|
on:
|
|
|
|
pull_request:
|
2024-11-11 18:38:40 +00:00
|
|
|
paths:
|
|
|
|
- 'charts/**'
|
2024-11-11 06:41:59 +00:00
|
|
|
branches:
|
|
|
|
- 'main'
|
|
|
|
push:
|
2024-11-11 18:38:40 +00:00
|
|
|
paths:
|
|
|
|
- 'charts/**'
|
2024-11-11 06:41:59 +00:00
|
|
|
branches:
|
|
|
|
- 'main'
|
|
|
|
|
|
|
|
jobs:
|
2024-11-11 19:06:16 +00:00
|
|
|
charts-changed:
|
|
|
|
name: Get Charts being Changed
|
2024-11-11 06:41:59 +00:00
|
|
|
runs-on: flakes-action
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2024-11-11 10:47:00 +00:00
|
|
|
uses: actions/checkout@v4
|
2024-11-11 06:41:59 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
2024-11-11 18:38:40 +00:00
|
|
|
- name: List changed charts
|
|
|
|
id: changed-charts
|
2024-11-11 06:41:59 +00:00
|
|
|
run: |
|
2024-11-11 18:38:40 +00:00
|
|
|
changed=$(ct --config .forgejo/ct.yaml list-changed | tr '\n' ' ' | jq -R -s -c 'split(" ") | map(select(length > 0))')
|
2024-11-11 06:41:59 +00:00
|
|
|
if [[ -n "$changed" ]]; then
|
2024-11-11 18:38:40 +00:00
|
|
|
echo "changesExist=true" >> $GITHUB_ENV
|
|
|
|
echo "::set-output name=reposChanged::$changed" # Sets output as a JSON array
|
2024-11-11 06:41:59 +00:00
|
|
|
fi
|
2024-11-11 18:38:40 +00:00
|
|
|
outputs:
|
|
|
|
reposChanged: ${{ steps.changed-charts.outputs.reposChanged }}
|
|
|
|
changesExist: ${{ env.changesExist }}
|
2024-11-11 06:41:59 +00:00
|
|
|
|
2024-11-11 19:06:16 +00:00
|
|
|
validate-linting:
|
|
|
|
name: "Validate: Linting"
|
|
|
|
needs: charts-changed
|
|
|
|
if: needs.charts-changed.outputs.changesExist == 'true'
|
2024-11-11 06:41:59 +00:00
|
|
|
runs-on: flakes-action
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2024-11-11 10:47:00 +00:00
|
|
|
uses: actions/checkout@v4
|
2024-11-11 06:41:59 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
2024-11-11 19:06:16 +00:00
|
|
|
- name: Linting Changed Repositories
|
2024-11-11 06:41:59 +00:00
|
|
|
run: |
|
2024-11-11 19:06:16 +00:00
|
|
|
repos='${{ needs.charts-changed.outputs.reposChanged }}'
|
2024-11-11 18:38:40 +00:00
|
|
|
for repo in $(echo $repos | jq -r '.[]'); do
|
|
|
|
echo "Linting $repo"
|
|
|
|
ct --config .forgejo/ct.yaml lint "$repo"
|
2024-11-11 19:06:16 +00:00
|
|
|
done
|
2024-11-11 06:41:59 +00:00
|
|
|
|
2024-11-11 19:06:16 +00:00
|
|
|
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
|
2024-11-11 18:38:40 +00:00
|
|
|
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
|
2024-11-11 19:06:16 +00:00
|
|
|
done
|
2024-11-11 06:41:59 +00:00
|
|
|
|
2024-11-11 19:06:16 +00:00
|
|
|
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
|
2024-11-11 18:38:40 +00:00
|
|
|
echo "Checking deprecated apiVersions for $repo"
|
|
|
|
helm template "$repo" -f "$repo/ci/pluto-values.yaml" | pluto detect - --ignore-deprecations
|
|
|
|
done
|
|
|
|
#with:
|
|
|
|
# FORGEJO_API_URL=https://code.252.no/api/v1
|
|
|
|
# FORGEJO_TOKEN=123
|
|
|
|
# REPO_OWNER=tommy
|
|
|
|
# REPO_NAME=charts
|
|
|
|
# ISSUE_INDEX=115
|