diff --git a/.github/workflows/functional-test.yaml b/.github/workflows/functional-test.yaml index 915020e564d..642890fe810 100644 --- a/.github/workflows/functional-test.yaml +++ b/.github/workflows/functional-test.yaml @@ -480,6 +480,7 @@ jobs: message: | :x: Failed to install Radius for ${{ matrix.name }} functional test. Please check [the logs](${{ env.ACTION_LINK }}) for more details - name: Publish Terraform test recipes + id: publish-tf-recipes run: | make publish-test-terraform-recipes - name: Run functional tests @@ -559,6 +560,30 @@ jobs: --subscription ${{ secrets.INTEGRATION_TEST_SUBSCRIPTION_ID }} \ --name ${{ env.AZURE_TEST_RESOURCE_GROUP }} \ --yes --verbose + # TODO add once tested: if: failure() && steps.publish-tf-recipes.outcome == 'failure' + - name: Get pod logs for recipe publishing failure + id: get-pod-logs + 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 + # TODO add once tested: if: failure() && steps.get-pod-logs.outcome.outcome == 'success' + - name: Upload Pod logs for failed steps + uses: actions/upload-artifact@v3 + with: + name: recipes-pod-logs + path: recipes/pod-logs + retention-days: 30 + if-no-files-found: error report-failure: name: Report test failure needs: [build, tests] @@ -575,4 +600,4 @@ jobs: title: `Scheduled functional test failed - Run ID: ${context.runId}`, labels: ['bug', 'test-failure'], body: `## Bug information \n\nThis bug is generated automatically if the scheduled functional test fails. The Radius functional test operates on a schedule of every 4 hours during weekdays and every 12 hours over the weekend. It's important to understand that the test may fail due to workflow infrastructure issues, like network problems, rather than the flakiness of the test itself. For the further investigation, please visit [here](${process.env.ACTION_LINK}).` - }) + }) \ No newline at end of file