kubectl system run test

pull/496/head
Frostebite 2023-02-16 17:24:05 +00:00
parent 16b596ded3
commit 6487d8f07c
1 changed files with 17 additions and 10 deletions

View File

@ -5,6 +5,7 @@ import * as core from '@actions/core';
import { CloudRunnerStatics } from '../../cloud-runner-statics'; import { CloudRunnerStatics } from '../../cloud-runner-statics';
import waitUntil from 'async-wait-until'; import waitUntil from 'async-wait-until';
import { FollowLogStreamService } from '../../services/follow-log-stream-service'; import { FollowLogStreamService } from '../../services/follow-log-stream-service';
import { CloudRunnerSystem } from '../../services/cloud-runner-system';
class KubernetesTaskRunner { class KubernetesTaskRunner {
static lastReceivedTimestamp: number; static lastReceivedTimestamp: number;
@ -73,18 +74,24 @@ class KubernetesTaskRunner {
// timestamps?: boolean; // timestamps?: boolean;
// } // }
const logOptions = { // const logOptions = {
follow: !alreadyFinished, // follow: !alreadyFinished,
pretty: false, // pretty: false,
previous: alreadyFinished, // previous: alreadyFinished,
timestamps: true, // timestamps: true,
}; // sinceSeconds: KubernetesTaskRunner.lastReceivedTimestamp,
// };
try { try {
const resultError = await new Log(kubeConfig).log(namespace, podName, containerName, stream, logOptions); // const resultError = await new Log(kubeConfig).log(namespace, podName, containerName, stream, logOptions);
await CloudRunnerSystem.Run(`kubectl logs ${podName} -c ${containerName} > app.log`);
output += await CloudRunnerSystem.Run(`cat app.log`);
stream.destroy(); stream.destroy();
if (resultError) {
throw resultError; // if (resultError) {
} // throw resultError;
// }
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');
core.error( core.error(