Improve k8s logging accuracy

pull/496/head
Frostebite 2023-02-03 03:04:10 +00:00
parent a1e58e3e99
commit 4e173629ae
3 changed files with 7 additions and 7 deletions

10
dist/index.js generated vendored
View File

@ -3294,7 +3294,7 @@ class Kubernetes {
});
}
runTaskInWorkflow(buildGuid, image, commands, mountdir, workingdir, environment, secrets) {
var _a, _b, _c;
var _a, _b, _c, _d;
return __awaiter(this, void 0, void 0, function* () {
try {
cloud_runner_logger_1.default.log('Cloud Runner K8s workflow!');
@ -3315,10 +3315,10 @@ class Kubernetes {
cloud_runner_logger_1.default.log(JSON.stringify((_a = status.body.status) === null || _a === void 0 ? void 0 : _a.containerStatuses, undefined, 4));
existsAlready = true;
}
catch (_d) {
catch (_e) {
// empty
}
if (!existsAlready || status.state.terminated !== undefined) {
if (!existsAlready || ((_b = status.state) === null || _b === void 0 ? void 0 : _b.terminated) !== undefined) {
cloud_runner_logger_1.default.log('Job does not exist');
yield this.createNamespacedJob(commands, image, mountdir, workingdir, environment, secrets);
const find = yield Kubernetes.findPodFromJob(this.kubeClient, this.jobName, this.namespace);
@ -3343,10 +3343,10 @@ class Kubernetes {
try {
errorParsed = JSON.parse(error);
}
catch (_e) {
catch (_f) {
errorParsed = error;
}
const errorMessage = errorParsed.name || errorParsed.reason || ((_c = (_b = errorParsed.response) === null || _b === void 0 ? void 0 : _b.body) === null || _c === void 0 ? void 0 : _c.reason) || errorParsed.message;
const errorMessage = errorParsed.name || errorParsed.reason || ((_d = (_c = errorParsed.response) === null || _c === void 0 ? void 0 : _c.body) === null || _d === void 0 ? void 0 : _d.reason) || errorParsed.message;
const continueStreaming = errorMessage.includes(`dial timeout, backstop`) ||
errorMessage.includes(`HttpError`) ||
errorMessage.includes(`HttpError: HTTP request failed`) ||

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View File

@ -142,7 +142,7 @@ class Kubernetes implements ProviderInterface {
} catch {
// empty
}
if (!existsAlready || status.state.terminated !== undefined) {
if (!existsAlready || status.state?.terminated !== undefined) {
CloudRunnerLogger.log('Job does not exist');
await this.createNamespacedJob(commands, image, mountdir, workingdir, environment, secrets);
const find = await Kubernetes.findPodFromJob(this.kubeClient, this.jobName, this.namespace);