File tree 1 file changed +12
-3
lines changed
1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -93,11 +93,20 @@ jobs:
93
93
-d "{\"extra_vars\": {\"target_host\": \"$target_host\", \"folder\": \"$folder\"}}" \
94
94
"https://awx.mafyuh.xyz/api/v2/job_templates/13/launch/"
95
95
96
- sleep 45 # Delay for 45 seconds before fetching logs
96
+ sleep 45
97
97
98
98
job_id=$(curl -s -H "Authorization: Bearer ${{ secrets.AWX_API_TOKEN }}" https://awx.mafyuh.xyz/api/v2/job_templates/13/jobs/?order_by=-id | jq -r '.results[0].id')
99
- logs=$(curl -s -H "Authorization: Bearer ${{ secrets.AWX_API_TOKEN }}" https://awx.mafyuh.xyz/api/v2/jobs/$job_id/stdout/?format=json)
99
+ logs=$(curl -s -H "Authorization: Bearer ${{ secrets.AWX_API_TOKEN }}" https://awx.mafyuh.xyz/api/v2/jobs/$job_id/stdout/?format=txt)
100
+
100
101
echo "AWX Job Logs for folder: $folder"
101
102
echo "Content:"
102
- echo "$(echo "$logs" | jq -r '.content')"
103
+ echo "$logs"
104
+
105
+ # Check for 'failed=' in the play recap
106
+ if echo "$logs" | grep -q "failed=[1-9]"; then
107
+ echo "Detected failed steps in AWX job. Failing Actions run."
108
+ exit 1
109
+ else
110
+ echo "No failures detected in AWX job."
111
+ fi
103
112
done
You can’t perform that action at this time.
0 commit comments