diff --git a/.gitea/workflows/lint-test-helm-push.yaml b/.gitea/workflows/lint-test-helm-push.yaml deleted file mode 100644 index 4c77c4d25..000000000 --- a/.gitea/workflows/lint-test-helm-push.yaml +++ /dev/null @@ -1,133 +0,0 @@ -name: lint-test-helm - -on: - push: - branches: - - main - paths: - - 'clusters/*/helm/**' - -env: - CLUSTER: cl01tl - BASE_BRANCH: "origin/${{ gitea.base_ref }}" - -jobs: - lint-push: - runs-on: ubuntu-js - if: github.event_name == 'push' - steps: - - name: Checkout - uses: actions/checkout@v6 - with: - fetch-depth: 0 - - - name: Set up Helm - uses: azure/setup-helm@v4 - with: - token: ${{ secrets.GITEA_TOKEN }} - version: v3.19.2 - - - name: Check which Directories have Changes - id: check-dir-changes - run: | - CHANGED_CHARTS=() - - echo ">> Target branch for diff is: ${BASE_BRANCH}" - echo "" - echo ">> Checking for changes ..." - GIT_DIFF=$(git diff --name-only "${BASE_BRANCH}" -- | xargs -I {} dirname {} | sort -u | grep 'clusters/*/helm/') - - if [ -n "${GIT_DIFF}" ]; then - echo "" - echo ">> Changes detected:" - echo "$GIT_DIFF" - - for path in $GIT_DIFF; do - CHANGED_CHARTS+=$(echo "$path" | awk -F '/' '{print $4}') - done - - else - echo "" - echo ">> No changes detected" - - fi - - if [ -n "${CHANGED_CHARTS}" ]; then - echo "" - echo ">> Chart to Lint:" - echo "$(echo "${CHANGED_CHARTS[@]}" | sort -u)" - - echo "----" - - echo "changes-detected=true" >> $GITEA_OUTPUT - echo "chart-dir<> $GITEA_OUTPUT - echo "$(echo "${CHANGED_CHARTS[@]}" | sort -u)" >> $GITEA_OUTPUT - echo "EOF" >> $GITEA_OUTPUT - else - echo "changes-detected=false" >> $GITEA_OUTPUT - fi - - - name: Add Repositories - if: steps.check-dir-changes.outputs.changes-detected == 'true' - env: - CHANGED_CHARTS: ${{ steps.check-dir-changes.outputs.chart-dir }} - run: | - echo ">> Adding repositories for chart dependencies ..." - for dir in ${CHANGED_CHARTS}; do - helm dependency list --max-col-width 120 clusters/${CLUSTER}/helm/$dir 2> /dev/null \ - | tail +2 | head -n -1 \ - | awk '{ print "helm repo add " $1 " " $3 }' \ - | while read cmd; do echo "$cmd" | sh; done || true - done - - if helm repo list | tail +2 | read -r; then - echo "" - echo ">> Update repository cache ..." - helm repo update - fi - - echo "----" - - - name: Lint Helm Chart - if: steps.check-dir-changes.outputs.changes-detected == 'true' - env: - CHANGED_CHARTS: ${{ steps.check-dir-changes.outputs.chart-dir }} - run: | - echo ">> Running linting on changed charts ..." - - for dir in ${CHANGED_CHARTS}; do - chart_path=clusters/${CLUSTER}/helm/$dir - chart_name=$(basename "$chart_path") - - if [ -f "$chart_path/Chart.yaml" ]; then - cd $chart_path - - echo "" - echo ">> Building helm dependency ..." - helm dependency build --skip-refresh - - echo "" - echo ">> Linting helm ..." - helm lint --namespace "$chart_name" - - else - echo "" - echo ">> Directory $chart_path does not contain a Chart.yaml. Skipping ..." - echo "" - fi - done - - - name: ntfy Failed - uses: niniyas/ntfy-action@master - if: failure() - with: - url: '${{ secrets.NTFY_URL }}' - topic: '${{ secrets.NTFY_TOPIC }}' - title: 'Test Failure - Infrastructure' - priority: 4 - headers: '{"Authorization": "Bearer ${{ secrets.NTFY_CRED }}"}' - tags: action,failed - details: 'Helm linting on Push for Infrastructure has failed!' - icon: 'https://cdn.jsdelivr.net/gh/selfhst/icons/png/gitea.png' - actions: '[{"action": "view", "label": "Open Gitea", "url": "https://gitea.alexlebens.dev/alexlebens/infrastructure/actions?workflow=lint-test-helm-push.yaml", "clear": true}]' - image: true diff --git a/.gitea/workflows/lint-test-helm-pull.yaml b/.gitea/workflows/lint-test-helm.yaml similarity index 100% rename from .gitea/workflows/lint-test-helm-pull.yaml rename to .gitea/workflows/lint-test-helm.yaml