pr feedback
parent
343b784d44
commit
29b5b94bcd
|
|
@ -837,6 +837,16 @@ jobs:
|
||||||
cloudRunnerTests: true
|
cloudRunnerTests: true
|
||||||
versioning: None
|
versioning: None
|
||||||
PROVIDER_STRATEGY: local-docker
|
PROVIDER_STRATEGY: local-docker
|
||||||
|
AWS_STACK_NAME: game-ci-team-pipelines
|
||||||
|
AWS_ACCESS_KEY_ID: test
|
||||||
|
AWS_SECRET_ACCESS_KEY: test
|
||||||
|
AWS_ENDPOINT: http://localhost:4566
|
||||||
|
AWS_ENDPOINT_URL: http://localhost:4566
|
||||||
|
AWS_S3_ENDPOINT: http://localhost:4566
|
||||||
|
INPUT_AWSS3ENDPOINT: http://localhost:4566
|
||||||
|
INPUT_AWSENDPOINT: http://localhost:4566
|
||||||
|
AWS_S3_FORCE_PATH_STYLE: 'true'
|
||||||
|
AWS_EC2_METADATA_DISABLED: 'true'
|
||||||
GIT_PRIVATE_TOKEN: ${{ secrets.GIT_PRIVATE_TOKEN }}
|
GIT_PRIVATE_TOKEN: ${{ secrets.GIT_PRIVATE_TOKEN }}
|
||||||
GITHUB_TOKEN: ${{ secrets.GIT_PRIVATE_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GIT_PRIVATE_TOKEN }}
|
||||||
- name: Clean up disk space
|
- name: Clean up disk space
|
||||||
|
|
|
||||||
|
|
@ -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...');
|
cloud_runner_logger_1.default.log('Pod is terminated, reading log file as fallback to capture post-build messages...');
|
||||||
try {
|
try {
|
||||||
// Try to read the log file from the terminated pod
|
// Try to read the log file from the terminated pod
|
||||||
// Use kubectl exec with --previous flag or try to access via PVC
|
// For killed pods (OOM), kubectl exec might not work, so we try multiple approaches
|
||||||
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);
|
// 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()) {
|
if (logFileContent && logFileContent.trim()) {
|
||||||
cloud_runner_logger_1.default.log(`Read log file from pod as fallback (${logFileContent.length} chars) to capture missing messages`);
|
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
|
// Get the lines we already have in output to avoid duplicates
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -220,12 +220,31 @@ class KubernetesTaskRunner {
|
||||||
CloudRunnerLogger.log('Pod is terminated, reading log file as fallback to capture post-build messages...');
|
CloudRunnerLogger.log('Pod is terminated, reading log file as fallback to capture post-build messages...');
|
||||||
try {
|
try {
|
||||||
// Try to read the log file from the terminated pod
|
// Try to read the log file from the terminated pod
|
||||||
// Use kubectl exec with --previous flag or try to access via PVC
|
// For killed pods (OOM), kubectl exec might not work, so we try multiple approaches
|
||||||
const logFileContent = await CloudRunnerSystem.Run(
|
// First try --previous flag for terminated containers, then try without it
|
||||||
`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 ""`,
|
let logFileContent = '';
|
||||||
|
try {
|
||||||
|
logFileContent = await CloudRunnerSystem.Run(
|
||||||
|
`kubectl exec ${podName} -c ${containerName} -n ${namespace} --previous -- cat /home/job-log.txt 2>/dev/null || echo ""`,
|
||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
|
} catch {
|
||||||
|
// If --previous fails, try without it (for recently terminated pods)
|
||||||
|
try {
|
||||||
|
logFileContent = await 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
|
||||||
|
CloudRunnerLogger.logWarning(
|
||||||
|
'Could not read log file from terminated pod (may be OOM-killed). Using available logs.',
|
||||||
|
);
|
||||||
|
logFileContent = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (logFileContent && logFileContent.trim()) {
|
if (logFileContent && logFileContent.trim()) {
|
||||||
CloudRunnerLogger.log(
|
CloudRunnerLogger.log(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue