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 core = __importStar(__webpack_require__(42186));
|
||||
const base64 = __webpack_require__(85848);
|
||||
const pollInterval = 50000;
|
||||
const pollInterval = 10000;
|
||||
class Kubernetes {
|
||||
static runBuildJob(buildParameters, baseImage) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
|
|
@ -1056,6 +1056,8 @@ class Kubernetes {
|
|||
let logQueryTime = 0;
|
||||
let mostRecentLine = '';
|
||||
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));
|
||||
core.info('Polling logs...');
|
||||
let logs;
|
||||
|
|
@ -1069,7 +1071,7 @@ class Kubernetes {
|
|||
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) {
|
||||
for (const element of arrayOfLines) {
|
||||
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) {
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -4,7 +4,7 @@ import { BuildParameters } from '.';
|
|||
import * as core from '@actions/core';
|
||||
const base64 = require('base-64');
|
||||
|
||||
const pollInterval = 50000;
|
||||
const pollInterval = 10000;
|
||||
|
||||
class Kubernetes {
|
||||
private static kubeClient: k8s.CoreV1Api;
|
||||
|
|
@ -342,6 +342,8 @@ class Kubernetes {
|
|||
let logQueryTime: number = 0;
|
||||
let mostRecentLine: string = '';
|
||||
while (running) {
|
||||
const pod = await this.kubeClient.readNamespacedPod(name, namespace);
|
||||
running = pod.body.status?.phase === 'Running';
|
||||
await new Promise((resolve) => setTimeout(resolve, pollInterval));
|
||||
core.info('Polling 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) {
|
||||
throw error;
|
||||
|
|
|
|||
Loading…
Reference in New Issue