Improve k8s logging accuracy

pull/496/head
Frostebite 2023-02-03 01:58:48 +00:00
parent e833b5e231
commit 04b01c4e50
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;
var _a, _b, _c;
return __awaiter(this, void 0, void 0, function* () {
try {
cloud_runner_logger_1.default.log('Cloud Runner K8s workflow!');
@ -3311,10 +3311,10 @@ class Kubernetes {
let existsAlready = false;
try {
const status = yield this.kubeClient.readNamespacedPodStatus(this.podName, this.namespace);
cloud_runner_logger_1.default.log(JSON.stringify(status, undefined, 4));
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 (_c) {
catch (_d) {
// empty
}
if (!existsAlready) {
@ -3342,10 +3342,10 @@ class Kubernetes {
try {
errorParsed = JSON.parse(error);
}
catch (_d) {
catch (_e) {
errorParsed = error;
}
const errorMessage = errorParsed.name || errorParsed.reason || ((_b = (_a = errorParsed.response) === null || _a === void 0 ? void 0 : _a.body) === null || _b === void 0 ? void 0 : _b.reason) || errorParsed.message;
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 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

@ -136,7 +136,7 @@ class Kubernetes implements ProviderInterface {
let existsAlready = false;
try {
const status = await this.kubeClient.readNamespacedPodStatus(this.podName, this.namespace);
CloudRunnerLogger.log(JSON.stringify(status, undefined, 4));
CloudRunnerLogger.log(JSON.stringify(status.body.status?.containerStatuses, undefined, 4));
existsAlready = true;
} catch {
// empty