pr feedback

This commit is contained in:
Frostebite
2025-12-13 07:53:30 +00:00
parent 343b784d44
commit 29b5b94bcd
4 changed files with 53 additions and 9 deletions
Generated Vendored
+17 -2
View File
@@ -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
Generated Vendored
+1 -1
View File
File diff suppressed because one or more lines are too long