pull/524/head
Frostebite 2023-03-17 22:45:05 +00:00
parent 820fd169ec
commit 890f64d0a1
3 changed files with 20 additions and 17 deletions

12
dist/index.js vendored
View File

@ -3762,9 +3762,11 @@ class KubernetesTaskRunner {
const dateString = `${chunk.toString().split(`Z `)[0]}Z`; const dateString = `${chunk.toString().split(`Z `)[0]}Z`;
const newDate = Date.parse(dateString); const newDate = Date.parse(dateString);
new Date(newDate).toISOString(); new Date(newDate).toISOString();
KubernetesTaskRunner.lastReceivedTimestamp = newDate; if (KubernetesTaskRunner.lastReceivedTimestamp < newDate) {
const message = cloud_runner_1.default.buildParameters.cloudRunnerDebug ? chunk : chunk.split(`Z `)[1]; KubernetesTaskRunner.lastReceivedTimestamp = newDate;
({ shouldReadLogs, shouldCleanup, output } = follow_log_stream_service_1.FollowLogStreamService.handleIteration(message, shouldReadLogs, shouldCleanup, output)); const message = cloud_runner_1.default.buildParameters.cloudRunnerDebug ? chunk : chunk.split(`Z `)[1];
({ shouldReadLogs, shouldCleanup, output } = follow_log_stream_service_1.FollowLogStreamService.handleIteration(message, shouldReadLogs, shouldCleanup, output));
}
} }
if (!didStreamAnyLogs) { if (!didStreamAnyLogs) {
core.error('Failed to stream any logs, listing namespace events, check for an error with the container'); core.error('Failed to stream any logs, listing namespace events, check for an error with the container');
@ -3783,11 +3785,11 @@ class KubernetesTaskRunner {
}, undefined, 4)); }, undefined, 4));
throw new Error(`No logs streamed from k8s`); throw new Error(`No logs streamed from k8s`);
} }
cloud_runner_logger_1.default.log('end of log stream');
} }
catch (error) { catch (error) {
cloud_runner_logger_1.default.log(`k8s task runner failed ${JSON.stringify(error, undefined, 4)}`); cloud_runner_logger_1.default.log(`k8s stream watching failed ${JSON.stringify(error, undefined, 4)}`);
} }
cloud_runner_logger_1.default.log('end of log stream');
return output; return output;
} }
static async watchUntilPodRunning(kubeClient, podName, namespace) { static async watchUntilPodRunning(kubeClient, podName, namespace) {

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -43,15 +43,16 @@ class KubernetesTaskRunner {
const dateString = `${chunk.toString().split(`Z `)[0]}Z`; const dateString = `${chunk.toString().split(`Z `)[0]}Z`;
const newDate = Date.parse(dateString); const newDate = Date.parse(dateString);
new Date(newDate).toISOString(); new Date(newDate).toISOString();
KubernetesTaskRunner.lastReceivedTimestamp = newDate; if (KubernetesTaskRunner.lastReceivedTimestamp < newDate) {
KubernetesTaskRunner.lastReceivedTimestamp = newDate;
const message = CloudRunner.buildParameters.cloudRunnerDebug ? chunk : chunk.split(`Z `)[1]; const message = CloudRunner.buildParameters.cloudRunnerDebug ? chunk : chunk.split(`Z `)[1];
({ shouldReadLogs, shouldCleanup, output } = FollowLogStreamService.handleIteration( ({ shouldReadLogs, shouldCleanup, output } = FollowLogStreamService.handleIteration(
message, message,
shouldReadLogs, shouldReadLogs,
shouldCleanup, shouldCleanup,
output, output,
)); ));
}
} }
if (!didStreamAnyLogs) { if (!didStreamAnyLogs) {
@ -77,10 +78,10 @@ class KubernetesTaskRunner {
); );
throw new Error(`No logs streamed from k8s`); throw new Error(`No logs streamed from k8s`);
} }
CloudRunnerLogger.log('end of log stream');
} catch (error: any) { } catch (error: any) {
CloudRunnerLogger.log(`k8s task runner failed ${JSON.stringify(error, undefined, 4)}`); CloudRunnerLogger.log(`k8s stream watching failed ${JSON.stringify(error, undefined, 4)}`);
} }
CloudRunnerLogger.log('end of log stream');
return output; return output;
} }