mirror of
https://github.com/game-ci/unity-builder.git
synced 2026-06-12 17:03:55 -07:00
pr feedback
This commit is contained in:
+17
-2
@@ -4603,8 +4603,23 @@ class KubernetesTaskRunner {
|
||||
cloud_runner_logger_1.default.log('Pod is terminated, reading log file as fallback to capture post-build messages...');
|
||||
try {
|
||||
// Try to read the log file from the terminated pod
|
||||
// Use kubectl exec with --previous flag or try to access via PVC
|
||||
const logFileContent = await cloud_runner_system_1.CloudRunnerSystem.Run(`kubectl exec ${podName} -c ${containerName} -n ${namespace} --previous -- cat /home/job-log.txt 2>/dev/null || kubectl exec ${podName} -c ${containerName} -n ${namespace} -- cat /home/job-log.txt 2>/dev/null || echo ""`, true, true);
|
||||
// For killed pods (OOM), kubectl exec might not work, so we try multiple approaches
|
||||
// First try --previous flag for terminated containers, then try without it
|
||||
let logFileContent = '';
|
||||
try {
|
||||
logFileContent = await cloud_runner_system_1.CloudRunnerSystem.Run(`kubectl exec ${podName} -c ${containerName} -n ${namespace} --previous -- cat /home/job-log.txt 2>/dev/null || echo ""`, true, true);
|
||||
}
|
||||
catch {
|
||||
// If --previous fails, try without it (for recently terminated pods)
|
||||
try {
|
||||
logFileContent = await cloud_runner_system_1.CloudRunnerSystem.Run(`kubectl exec ${podName} -c ${containerName} -n ${namespace} -- cat /home/job-log.txt 2>/dev/null || echo ""`, true, true);
|
||||
}
|
||||
catch {
|
||||
// If both fail (pod might be killed/OOM), log but continue with existing output
|
||||
cloud_runner_logger_1.default.logWarning('Could not read log file from terminated pod (may be OOM-killed). Using available logs.');
|
||||
logFileContent = '';
|
||||
}
|
||||
}
|
||||
if (logFileContent && logFileContent.trim()) {
|
||||
cloud_runner_logger_1.default.log(`Read log file from pod as fallback (${logFileContent.length} chars) to capture missing messages`);
|
||||
// Get the lines we already have in output to avoid duplicates
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user