K8s task loop, fail early

pull/496/head
Frostebite 2023-02-08 18:31:49 +00:00
parent b324d78732
commit e3f32d587b
3 changed files with 29 additions and 26 deletions

28
dist/index.js generated vendored
View File

@ -3308,7 +3308,7 @@ class Kubernetes {
});
}
runTaskInWorkflow(buildGuid, image, commands, mountdir, workingdir, environment, secrets) {
var _a, _b, _c, _d;
var _a, _b;
return __awaiter(this, void 0, void 0, function* () {
try {
cloud_runner_logger_1.default.log('Cloud Runner K8s workflow!');
@ -3329,7 +3329,7 @@ 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 (_e) {
catch (_c) {
// empty
}
if (!existsAlready || ((_b = status.state) === null || _b === void 0 ? void 0 : _b.terminated) !== undefined) {
@ -3353,20 +3353,22 @@ class Kubernetes {
yield this.cleanupTaskResources();
}
catch (error) {
let errorParsed;
// let errorParsed;
try {
errorParsed = JSON.parse(error);
// errorParsed = JSON.parse(error);
}
catch (_f) {
errorParsed = error;
catch (_d) {
// errorParsed = error;
}
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`) ||
errorMessage.includes(`an error occurred when try to find container`) ||
errorMessage.includes(`not found`) ||
errorMessage.includes(`Not Found`);
// const errorMessage =
// errorParsed.name || errorParsed.reason || errorParsed.response?.body?.reason || errorParsed.message;
const continueStreaming = false;
// errorMessage.includes(`dial timeout, backstop`) ||
// errorMessage.includes(`HttpError`) ||
// errorMessage.includes(`HttpError: HTTP request failed`) ||
// errorMessage.includes(`an error occurred when try to find container`) ||
// errorMessage.includes(`not found`) ||
// errorMessage.includes(`Not Found`);
if (continueStreaming) {
cloud_runner_logger_1.default.log('Log Stream Container Not Found');
yield new Promise((resolve) => resolve(5000));

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View File

@ -169,23 +169,24 @@ class Kubernetes implements ProviderInterface {
}
await this.cleanupTaskResources();
} catch (error: any) {
let errorParsed;
// let errorParsed;
try {
errorParsed = JSON.parse(error);
// errorParsed = JSON.parse(error);
} catch {
errorParsed = error;
// errorParsed = error;
}
const errorMessage =
errorParsed.name || errorParsed.reason || errorParsed.response?.body?.reason || errorParsed.message;
// const errorMessage =
// errorParsed.name || errorParsed.reason || errorParsed.response?.body?.reason || errorParsed.message;
const continueStreaming =
errorMessage.includes(`dial timeout, backstop`) ||
errorMessage.includes(`HttpError`) ||
errorMessage.includes(`HttpError: HTTP request failed`) ||
errorMessage.includes(`an error occurred when try to find container`) ||
errorMessage.includes(`not found`) ||
errorMessage.includes(`Not Found`);
const continueStreaming = false;
// errorMessage.includes(`dial timeout, backstop`) ||
// errorMessage.includes(`HttpError`) ||
// errorMessage.includes(`HttpError: HTTP request failed`) ||
// errorMessage.includes(`an error occurred when try to find container`) ||
// errorMessage.includes(`not found`) ||
// errorMessage.includes(`Not Found`);
if (continueStreaming) {
CloudRunnerLogger.log('Log Stream Container Not Found');
await new Promise((resolve) => resolve(5000));