fix
parent
95e005365f
commit
ce724d8304
|
|
@ -2296,23 +2296,23 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
const client_node_1 = __webpack_require__(89679);
|
const client_node_1 = __webpack_require__(89679);
|
||||||
const stream_1 = __webpack_require__(92413);
|
const stream_1 = __webpack_require__(92413);
|
||||||
const cloud_runner_logger_1 = __importDefault(__webpack_require__(22855));
|
const cloud_runner_logger_1 = __importDefault(__webpack_require__(22855));
|
||||||
const cloud_runner_state_1 = __webpack_require__(70912);
|
|
||||||
const core = __importStar(__webpack_require__(42186));
|
const core = __importStar(__webpack_require__(42186));
|
||||||
const fs_1 = __importDefault(__webpack_require__(35747));
|
|
||||||
const cloud_runner_statics_1 = __webpack_require__(90828);
|
const cloud_runner_statics_1 = __webpack_require__(90828);
|
||||||
const async_wait_until_1 = __importDefault(__webpack_require__(41299));
|
const async_wait_until_1 = __importDefault(__webpack_require__(41299));
|
||||||
|
const __1 = __webpack_require__(41359);
|
||||||
class KubernetesTaskRunner {
|
class KubernetesTaskRunner {
|
||||||
static runTask(kubeConfig, kubeClient, jobName, podName, containerName, namespace, logCallback) {
|
static runTask(kubeConfig, kubeClient, jobName, podName, containerName, namespace, logCallback) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
cloud_runner_logger_1.default.log(`Streaming logs from pod: ${podName} container: ${containerName} namespace: ${namespace}`);
|
cloud_runner_logger_1.default.log(`Streaming logs from pod: ${podName} container: ${containerName} namespace: ${namespace}`);
|
||||||
const stream = new stream_1.Writable();
|
const stream = new stream_1.Writable();
|
||||||
|
let output = '';
|
||||||
let didStreamAnyLogs = false;
|
let didStreamAnyLogs = false;
|
||||||
stream._write = (chunk, encoding, next) => {
|
stream._write = (chunk, encoding, next) => {
|
||||||
didStreamAnyLogs = true;
|
didStreamAnyLogs = true;
|
||||||
let message = chunk.toString();
|
let message = chunk.toString();
|
||||||
message = `[${cloud_runner_statics_1.CloudRunnerStatics.logPrefix}] ${message}`;
|
message = `[${cloud_runner_statics_1.CloudRunnerStatics.logPrefix}] ${message}`;
|
||||||
if (cloud_runner_state_1.CloudRunnerState.buildParams.logToFile) {
|
if (__1.Input.cloudRunnerTests) {
|
||||||
fs_1.default.appendFileSync(`${cloud_runner_state_1.CloudRunnerState.buildParams.buildGuid}-outputfile.txt`, `${message}\n`);
|
output += message;
|
||||||
}
|
}
|
||||||
logCallback(message);
|
logCallback(message);
|
||||||
next();
|
next();
|
||||||
|
|
@ -2349,6 +2349,7 @@ class KubernetesTaskRunner {
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
cloud_runner_logger_1.default.log('end of log stream');
|
cloud_runner_logger_1.default.log('end of log stream');
|
||||||
|
return output;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
static watchUntilPodRunning(kubeClient, podName, namespace) {
|
static watchUntilPodRunning(kubeClient, podName, namespace) {
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -1,11 +1,10 @@
|
||||||
import { CoreV1Api, KubeConfig, Log } from '@kubernetes/client-node';
|
import { CoreV1Api, KubeConfig, Log } from '@kubernetes/client-node';
|
||||||
import { Writable } from 'stream';
|
import { Writable } from 'stream';
|
||||||
import CloudRunnerLogger from '../services/cloud-runner-logger';
|
import CloudRunnerLogger from '../services/cloud-runner-logger';
|
||||||
import { CloudRunnerState } from '../state/cloud-runner-state';
|
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import fs from 'fs';
|
|
||||||
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 { Input } from '../..';
|
||||||
|
|
||||||
class KubernetesTaskRunner {
|
class KubernetesTaskRunner {
|
||||||
static async runTask(
|
static async runTask(
|
||||||
|
|
@ -19,13 +18,14 @@ class KubernetesTaskRunner {
|
||||||
) {
|
) {
|
||||||
CloudRunnerLogger.log(`Streaming logs from pod: ${podName} container: ${containerName} namespace: ${namespace}`);
|
CloudRunnerLogger.log(`Streaming logs from pod: ${podName} container: ${containerName} namespace: ${namespace}`);
|
||||||
const stream = new Writable();
|
const stream = new Writable();
|
||||||
|
let output = '';
|
||||||
let didStreamAnyLogs: boolean = false;
|
let didStreamAnyLogs: boolean = false;
|
||||||
stream._write = (chunk, encoding, next) => {
|
stream._write = (chunk, encoding, next) => {
|
||||||
didStreamAnyLogs = true;
|
didStreamAnyLogs = true;
|
||||||
let message = chunk.toString();
|
let message = chunk.toString();
|
||||||
message = `[${CloudRunnerStatics.logPrefix}] ${message}`;
|
message = `[${CloudRunnerStatics.logPrefix}] ${message}`;
|
||||||
if (CloudRunnerState.buildParams.logToFile) {
|
if (Input.cloudRunnerTests) {
|
||||||
fs.appendFileSync(`${CloudRunnerState.buildParams.buildGuid}-outputfile.txt`, `${message}\n`);
|
output += message;
|
||||||
}
|
}
|
||||||
logCallback(message);
|
logCallback(message);
|
||||||
next();
|
next();
|
||||||
|
|
@ -69,6 +69,7 @@ class KubernetesTaskRunner {
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
CloudRunnerLogger.log('end of log stream');
|
CloudRunnerLogger.log('end of log stream');
|
||||||
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
static async watchUntilPodRunning(kubeClient: CoreV1Api, podName: string, namespace: string) {
|
static async watchUntilPodRunning(kubeClient: CoreV1Api, podName: string, namespace: string) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue