diff --git a/dist/index.js b/dist/index.js index 5aa13beb..b5ad0aaa 100644 Binary files a/dist/index.js and b/dist/index.js differ diff --git a/dist/index.js.map b/dist/index.js.map index 0207f163..28579d2b 100644 Binary files a/dist/index.js.map and b/dist/index.js.map differ diff --git a/src/model/cloud-runner/providers/k8s/kubernetes-task-runner.ts b/src/model/cloud-runner/providers/k8s/kubernetes-task-runner.ts index 900ca4b1..fcd7a188 100644 --- a/src/model/cloud-runner/providers/k8s/kubernetes-task-runner.ts +++ b/src/model/cloud-runner/providers/k8s/kubernetes-task-runner.ts @@ -32,7 +32,6 @@ class KubernetesTaskRunner { ? ` -f -c ${containerName}` : ` --previous`; - let logs; const callback = (outputChunk: string) => { output += outputChunk; @@ -47,15 +46,28 @@ class KubernetesTaskRunner { CloudRunnerLogger.log(`Loghash found`); } if (chunk.includes(`LOGS:`)) { + CloudRunnerLogger.log(`LOGS: found`); + // remove "LOGS: " and decode base64 remaining const unpacked = Buffer.from(chunk.split(`LOGS: `)[1], 'base64').toString('ascii'); const result = RemoteClientLogger.HandleLogFull(unpacked); CloudRunnerLogger.log(`Logs found HandleLogChunkLineResult:${result}`); + if (result) { + FollowLogStreamService.DidReceiveEndOfTransmission = true; + } + + return; } + ({ shouldReadLogs, shouldCleanup, output } = FollowLogStreamService.handleIteration( + chunk, + shouldReadLogs, + shouldCleanup, + output, + )); } }; try { - logs = await CloudRunnerSystem.Run(`kubectl logs ${podName}${extraFlags}`, false, true, callback); + await CloudRunnerSystem.Run(`kubectl logs ${podName}${extraFlags}`, false, true, callback); } catch (error: any) { await new Promise((resolve) => setTimeout(resolve, 3000)); const continueStreaming = await KubernetesPods.IsPodRunning(podName, namespace, kubeClient); @@ -70,26 +82,6 @@ class KubernetesTaskRunner { } throw error; } - const splitLogs = logs.split(`\n`); - for (const chunk of splitLogs) { - const message = CloudRunner.buildParameters.cloudRunnerDebug ? chunk : chunk.split(`Z `)[1]; - - // if line contains "LOGS: " then stop - if (message.includes(`LOGS:`)) { - CloudRunnerLogger.log(`LOGS: found`); - continue; - } - ({ shouldReadLogs, shouldCleanup, output } = FollowLogStreamService.handleIteration( - message, - shouldReadLogs, - shouldCleanup, - output, - )); - const result = RemoteClientLogger.HandleLog(message); - if (result) { - FollowLogStreamService.DidReceiveEndOfTransmission = true; - } - } if (FollowLogStreamService.DidReceiveEndOfTransmission) { CloudRunnerLogger.log('end of log stream'); break;