Previous pod logs included for fast completion scenarios
parent
ec58c24ea7
commit
6dc4d12ac5
|
|
@ -733,7 +733,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
const k8s = __importStar(__webpack_require__(89679));
|
const k8s = __importStar(__webpack_require__(89679));
|
||||||
const core = __importStar(__webpack_require__(42186));
|
const core = __importStar(__webpack_require__(42186));
|
||||||
const base64 = __webpack_require__(85848);
|
const base64 = __webpack_require__(85848);
|
||||||
const pollInterval = 50000;
|
const pollInterval = 10000;
|
||||||
class Kubernetes {
|
class Kubernetes {
|
||||||
static runBuildJob(buildParameters, baseImage) {
|
static runBuildJob(buildParameters, baseImage) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
|
@ -1056,6 +1056,8 @@ class Kubernetes {
|
||||||
let logQueryTime = 0;
|
let logQueryTime = 0;
|
||||||
let mostRecentLine = '';
|
let mostRecentLine = '';
|
||||||
while (running) {
|
while (running) {
|
||||||
|
const pod = yield this.kubeClient.readNamespacedPod(name, namespace);
|
||||||
|
running = ((_a = pod.body.status) === null || _a === void 0 ? void 0 : _a.phase) === 'Running';
|
||||||
yield new Promise((resolve) => setTimeout(resolve, pollInterval));
|
yield new Promise((resolve) => setTimeout(resolve, pollInterval));
|
||||||
core.info('Polling logs...');
|
core.info('Polling logs...');
|
||||||
let logs;
|
let logs;
|
||||||
|
|
@ -1069,7 +1071,7 @@ class Kubernetes {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const arrayOfLines = (_a = logs === null || logs === void 0 ? void 0 : logs.body.match(/[^\n\r]+/g)) === null || _a === void 0 ? void 0 : _a.reverse();
|
const arrayOfLines = (_b = logs === null || logs === void 0 ? void 0 : logs.body.match(/[^\n\r]+/g)) === null || _b === void 0 ? void 0 : _b.reverse();
|
||||||
if (arrayOfLines) {
|
if (arrayOfLines) {
|
||||||
for (const element of arrayOfLines) {
|
for (const element of arrayOfLines) {
|
||||||
const [time, ...line] = element.split(' ');
|
const [time, ...line] = element.split(' ');
|
||||||
|
|
@ -1085,8 +1087,6 @@ class Kubernetes {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const pod = yield this.kubeClient.readNamespacedPod(name, namespace);
|
|
||||||
running = ((_b = pod.body.status) === null || _b === void 0 ? void 0 : _b.phase) === 'Running';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -4,7 +4,7 @@ import { BuildParameters } from '.';
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
const base64 = require('base-64');
|
const base64 = require('base-64');
|
||||||
|
|
||||||
const pollInterval = 50000;
|
const pollInterval = 10000;
|
||||||
|
|
||||||
class Kubernetes {
|
class Kubernetes {
|
||||||
private static kubeClient: k8s.CoreV1Api;
|
private static kubeClient: k8s.CoreV1Api;
|
||||||
|
|
@ -342,6 +342,8 @@ class Kubernetes {
|
||||||
let logQueryTime: number = 0;
|
let logQueryTime: number = 0;
|
||||||
let mostRecentLine: string = '';
|
let mostRecentLine: string = '';
|
||||||
while (running) {
|
while (running) {
|
||||||
|
const pod = await this.kubeClient.readNamespacedPod(name, namespace);
|
||||||
|
running = pod.body.status?.phase === 'Running';
|
||||||
await new Promise((resolve) => setTimeout(resolve, pollInterval));
|
await new Promise((resolve) => setTimeout(resolve, pollInterval));
|
||||||
core.info('Polling logs...');
|
core.info('Polling logs...');
|
||||||
let logs;
|
let logs;
|
||||||
|
|
@ -381,8 +383,6 @@ class Kubernetes {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const pod = await this.kubeClient.readNamespacedPod(name, namespace);
|
|
||||||
running = pod.body.status?.phase === 'Running';
|
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw error;
|
throw error;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue