From ecaad5020af069445c271c3ca1ea6d21ab680aa3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=A9rence=20Chateign=C3=A9?= Date: Sun, 19 Jan 2025 17:17:22 +0100 Subject: [PATCH] test: pr --- .github/workflows/pr-argo-diff.yaml | 35 +++++++++++++++++++---------- k8s-apps/argocd/values.yaml | 2 +- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/.github/workflows/pr-argo-diff.yaml b/.github/workflows/pr-argo-diff.yaml index a410405c..88f5ccd0 100644 --- a/.github/workflows/pr-argo-diff.yaml +++ b/.github/workflows/pr-argo-diff.yaml @@ -11,6 +11,8 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Set up environment run: | @@ -18,29 +20,38 @@ jobs: curl -sSL -o /usr/local/bin/argocd https://github.com/argoproj/argo-cd/releases/latest/download/argocd-linux-amd64 chmod +x /usr/local/bin/argocd - - name: Get updated charts - id: updated-charts + - name: Get updated apps + id: updated-apps run: | - UPDATED_APPS=$(git diff --name-only origin/main...HEAD | grep '^k8s-apps/' | awk -F'/' '{print $2}' | sort -u) - echo "Updated charts: $UPDATED_APPS" - echo "::set-output name=apps::$UPDATED_APPS" + git fetch origin + # Extract unique app names from the modified paths under k8s-apps + MODIFIED_APPS=$(git diff --name-only origin/main...HEAD | grep '^k8s-apps/' | awk -F'/' '{print $2}' | sort -u | xargs) + if [ -z "$MODIFIED_APPS" ]; then + echo "No changes detected" + echo "apps=" >> $GITHUB_OUTPUT + else + echo "Modified apps: $MODIFIED_APPS" + echo "apps=$MODIFIED_APPS" >> $GITHUB_OUTPUT + fi - name: Login to ArgoCD - if: steps.updated-charts.outputs.apps != '' + if: steps.updated-apps.outputs.apps != '' run: | - argocd login --grpc-web --username admin --password $ARGOCD_ADMIN_PASSWORD argocd.terence.cloud + argocd login argocd.terence.cloud --grpc-web --username admin --password $ARGOCD_ADMIN_PASSWORD + env: + ARGOCD_ADMIN_PASSWORD: ${{ secrets.ARGOCD_ADMIN_PASSWORD }} - name: ArgoCD Diff for updated apps - if: steps.updated-charts.outputs.apps != '' + if: steps.updated-apps.outputs.apps != '' run: | - for APP in ${{ steps.updated-charts.outputs.apps }}; do + for APP in ${{ steps.updated-apps.outputs.apps }}; do echo "Processing app: $APP" cd "k8s-apps/$APP" + helm dep update argocd app diff "$APP" \ --grpc-web \ --local-repo-root $(git rev-parse --show-toplevel) \ --local $PWD \ - --loglevel warn + --loglevel warn \ + --exit-code=false done - env: - ARGOCD_ADMIN_PASSWORD: ${{ secrets.ARGOCD_ADMIN_PASSWORD }} diff --git a/k8s-apps/argocd/values.yaml b/k8s-apps/argocd/values.yaml index 01c1e6fe..6101dfd4 100644 --- a/k8s-apps/argocd/values.yaml +++ b/k8s-apps/argocd/values.yaml @@ -361,7 +361,7 @@ argo-cd: # paths: # - /argocd(/|$)(.*) hostname: - argocd.terence.cloud + argocd.terence.clouds # - k8s-ingress.snow-delta.ts.net tls: true ingressClassName: nginx