From e4ba0d3ce8c8d5755ee843c3ffe14ad1fa4e5e46 Mon Sep 17 00:00:00 2001 From: Ed Reed Date: Thu, 23 Jun 2022 09:28:40 -0700 Subject: [PATCH] fix: Ignore errors dumping logs after listing --- hack/log-dump/log-dump.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hack/log-dump/log-dump.sh b/hack/log-dump/log-dump.sh index bb3b4d80d5..0309a73729 100755 --- a/hack/log-dump/log-dump.sh +++ b/hack/log-dump/log-dump.sh @@ -98,7 +98,8 @@ function dump-log() { for log_file in "${log_files[@]}"; do if [[ "$(should-export-log "${log_file}" "${is_master}")" == "true" ]]; then echo "Dumping ${log_file}" - kubectl exec "${pod_name}" -- cat "${log_dir}/${log_file}" > "${dir}/${log_file}" + # Job pod logs may be deleted between listing and the attempt to dump, so we ignore errors from cat. + kubectl exec "${pod_name}" -- sh -c "(cat \"${log_dir}/${log_file}\" > \"${dir}/${log_file}\") || true" fi done