@@ -64,27 +64,34 @@ spec:
6464 >> $(results.failed_info.path)
6565 done
6666
67+ if [ -s "$(results.failed_info.path)" ]; then
68+ failed_pod_name=$(cat $(results.failed_info.path) | jq '.pod' -r)
69+ failed_task=$(cat $(results.failed_info.path) | jq '.task' -r)
70+ failed_step=$(cat $(results.failed_info.path) | jq '.step' -r)
71+
72+ echo $failed_task > $(results.failed_task.path)
73+ echo $failed_step > $(results.failed_step.path)
74+ echo $failed_pod_name > $(results.failed_pod_name.path)
75+ fi
76+
6777 - name : get-failed-logs
6878 image : {{ .Values.images.curl | default "curlimages/curl:latest"}}
6979 imagePullPolicy : {{ .Values.imagePullPolicy }}
7080 script : |
7181 #!/bin/sh
7282
73- failed_pod_name=$(cat $(results.failed_info.path) | jq '.pod' -r)
74- failed_task=$(cat $(results.failed_info.path) | jq '.task' -r)
75- failed_step=$(cat $(results.failed_info.path) | jq '.step' -r)
83+ failed_pod_name=$(cat $(results.failed_pod_name.path))
84+ failed_step=$(cat $(results.failed_step.path))
7685
7786 if [ -n "$failed_pod_name" ] && [ -n "$failed_step" ]; then
7887 # Fetch logs and save info about the failed task
7988 echo "Fetching logs for failed task: ${failed_task}, step: ${failed_step}"
8089 curl -sk "https://tekton-logs-server.ci.svc.cluster.local/logs/ci/${failed_pod_name}/step-${failed_step}" | tail -c 1982 > $(results.logs.path)
81- echo $failed_task > $(results.failed_task.path)
82- echo $failed_step > $(results.failed_step.path)
8390 else
8491 echo 'No failed taskRuns'
8592 fi
8693
87- sleep 1000
94+ sleep 300
8895
8996 - name : notification
9097 image : {{ .Values.images.slack | default "cloudposse/slack-notifier:latest"}}
0 commit comments