From eef3ab35dfcc9dc2b1ee0b734ce52270b7ac24e9 Mon Sep 17 00:00:00 2001 From: sk593 Date: Fri, 12 Jan 2024 18:33:52 -0800 Subject: [PATCH] add event logging for TF recipe publishing 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 8c39239d2b..d117acfb00 100644 --- a/.github/workflows/functional-test.yaml +++ b/.github/workflows/functional-test.yaml @@ -576,6 +576,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