stream logs through standard input and new remote client cli command

pull/531/head
Frostebite 2023-06-05 22:48:19 +01:00
parent d1a2969bf6
commit 596f3fb648
3 changed files with 11 additions and 11 deletions

10
dist/index.js generated vendored
View File

@ -3951,13 +3951,13 @@ class KubernetesTaskRunner {
return output; return output;
} }
static async watchUntilPodRunning(kubeClient, podName, namespace) { static async watchUntilPodRunning(kubeClient, podName, namespace) {
let success = false; let waitComplete = false;
let message = ``; let message = ``;
cloud_runner_logger_1.default.log(`Watching ${podName} ${namespace}`); cloud_runner_logger_1.default.log(`Watching ${podName} ${namespace}`);
await async_wait_until_1.default(async () => { await async_wait_until_1.default(async () => {
const status = await kubeClient.readNamespacedPodStatus(podName, namespace); const status = await kubeClient.readNamespacedPodStatus(podName, namespace);
const phase = status?.body.status?.phase; const phase = status?.body.status?.phase;
success = phase === 'Running'; waitComplete = phase !== 'Pending' && phase !== 'Unknown';
message = `Phase:${status.body.status?.phase} \n Reason:${status.body.status?.conditions?.[0].reason || ''} \n Message:${status.body.status?.conditions?.[0].message || ''}`; message = `Phase:${status.body.status?.phase} \n Reason:${status.body.status?.conditions?.[0].reason || ''} \n Message:${status.body.status?.conditions?.[0].message || ''}`;
// CloudRunnerLogger.log( // CloudRunnerLogger.log(
// JSON.stringify( // JSON.stringify(
@ -3974,17 +3974,17 @@ class KubernetesTaskRunner {
// 4, // 4,
// ), // ),
// ); // );
if (success || phase !== 'Pending') if (waitComplete || phase !== 'Pending')
return true; return true;
return false; return false;
}, { }, {
timeout: 2000000, timeout: 2000000,
intervalBetweenAttempts: 15000, intervalBetweenAttempts: 15000,
}); });
if (!success) { if (!waitComplete) {
cloud_runner_logger_1.default.log(message); cloud_runner_logger_1.default.log(message);
} }
return success; return waitComplete;
} }
} }
KubernetesTaskRunner.lastReceivedTimestamp = 0; KubernetesTaskRunner.lastReceivedTimestamp = 0;

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View File

@ -111,14 +111,14 @@ class KubernetesTaskRunner {
} }
static async watchUntilPodRunning(kubeClient: CoreV1Api, podName: string, namespace: string) { static async watchUntilPodRunning(kubeClient: CoreV1Api, podName: string, namespace: string) {
let success: boolean = false; let waitComplete: boolean = false;
let message = ``; let message = ``;
CloudRunnerLogger.log(`Watching ${podName} ${namespace}`); CloudRunnerLogger.log(`Watching ${podName} ${namespace}`);
await waitUntil( await waitUntil(
async () => { async () => {
const status = await kubeClient.readNamespacedPodStatus(podName, namespace); const status = await kubeClient.readNamespacedPodStatus(podName, namespace);
const phase = status?.body.status?.phase; const phase = status?.body.status?.phase;
success = phase === 'Running'; waitComplete = phase !== 'Pending' && phase !== 'Unknown';
message = `Phase:${status.body.status?.phase} \n Reason:${ message = `Phase:${status.body.status?.phase} \n Reason:${
status.body.status?.conditions?.[0].reason || '' status.body.status?.conditions?.[0].reason || ''
} \n Message:${status.body.status?.conditions?.[0].message || ''}`; } \n Message:${status.body.status?.conditions?.[0].message || ''}`;
@ -138,7 +138,7 @@ class KubernetesTaskRunner {
// 4, // 4,
// ), // ),
// ); // );
if (success || phase !== 'Pending') return true; if (waitComplete || phase !== 'Pending') return true;
return false; return false;
}, },
@ -147,11 +147,11 @@ class KubernetesTaskRunner {
intervalBetweenAttempts: 15000, intervalBetweenAttempts: 15000,
}, },
); );
if (!success) { if (!waitComplete) {
CloudRunnerLogger.log(message); CloudRunnerLogger.log(message);
} }
return success; return waitComplete;
} }
} }