Skip to content

Commit

Permalink
add logs for kubernetes events
Browse files Browse the repository at this point in the history
Signed-off-by: sk593 <[email protected]>
  • Loading branch information
sk593 committed Nov 16, 2023
1 parent 5564c98 commit c3cf9f6
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion .github/workflows/functional-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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]
Expand All @@ -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}).`
})
})

0 comments on commit c3cf9f6

Please sign in to comment.