From 458ee75c0b88229c18fd2168884cbe5a79e13242 Mon Sep 17 00:00:00 2001 From: Shruthi Kumar Date: Thu, 18 Jan 2024 12:58:28 -0600 Subject: [PATCH] Add event logging for Terraform recipe publishing (#7028) # Description Adding logs to track pod failures during scheduled functional test runs ## Type of change - This pull request is a minor refactor, code cleanup, test improvement, or other maintenance task and doesn't change the functionality of Radius #6563 Fixes: #6563 Signed-off-by: sk593 --- .github/workflows/functional-test.yaml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.github/workflows/functional-test.yaml b/.github/workflows/functional-test.yaml index f0bac96611..cbaaacb515 100644 --- a/.github/workflows/functional-test.yaml +++ b/.github/workflows/functional-test.yaml @@ -578,6 +578,28 @@ jobs: with: name: ${{ matrix.name }}_container_logs path: ./${{ env.RADIUS_CONTAINER_LOG_BASE }} + - name: Get Terraform recipe publishing logs + if: always() + run: | + # Create pod-logs directory + mkdir -p recipes/pod-logs + # Get pod logs and save to file + namespace="radius-test-tf-module-server" + label="app.kubernetes.io/name=tf-module-server" + pod_names=($(kubectl get pods -l $label -n $namespace -o jsonpath='{.items[*].metadata.name}')) + for pod_name in "${pod_names[@]}"; do + kubectl logs $pod_name -n $namespace > recipes/pod-logs/${pod_name}.txt + done + echo "Pod logs saved to recipes/pod-logs/" + # Get kubernetes events and save to file + kubectl get events -n $namespace > recipes/pod-logs/events.txt + - name: Upload Terraform recipe publishing logs + uses: actions/upload-artifact@v3 + if: always() + with: + name: recipes-pod-logs + path: recipes/pod-logs + if-no-files-found: error - uses: marocchino/sticky-pull-request-comment@v2 if: success() && env.PR_NUMBER != '' continue-on-error: true