fix: k8s error handling
(cherry picked from commit f633a3efb42432a6d2492712aead865a950c8dca)pull/472/head
parent
4cca069ebb
commit
0579324822
|
|
@ -2575,6 +2575,7 @@ class TaskService {
|
||||||
static awsListStacks(perResultCallback = false) {
|
static awsListStacks(perResultCallback = false) {
|
||||||
var _a, _b;
|
var _a, _b;
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
cloud_runner_logger_1.default.log(`List Stacks`);
|
||||||
process.env.AWS_REGION = input_1.default.region;
|
process.env.AWS_REGION = input_1.default.region;
|
||||||
const CF = new aws_sdk_1.default.CloudFormation();
|
const CF = new aws_sdk_1.default.CloudFormation();
|
||||||
const stacks = ((_a = (yield CF.listStacks().promise()).StackSummaries) === null || _a === void 0 ? void 0 : _a.filter((_x) => _x.StackStatus !== 'DELETE_COMPLETE')) || [];
|
const stacks = ((_a = (yield CF.listStacks().promise()).StackSummaries) === null || _a === void 0 ? void 0 : _a.filter((_x) => _x.StackStatus !== 'DELETE_COMPLETE')) || [];
|
||||||
|
|
@ -2600,6 +2601,7 @@ class TaskService {
|
||||||
}
|
}
|
||||||
static awsListTasks(perResultCallback = false) {
|
static awsListTasks(perResultCallback = false) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
cloud_runner_logger_1.default.log(`List Tasks`);
|
||||||
process.env.AWS_REGION = input_1.default.region;
|
process.env.AWS_REGION = input_1.default.region;
|
||||||
const ecs = new aws_sdk_1.default.ECS();
|
const ecs = new aws_sdk_1.default.ECS();
|
||||||
const clusters = (yield ecs.listClusters().promise()).clusterArns || [];
|
const clusters = (yield ecs.listClusters().promise()).clusterArns || [];
|
||||||
|
|
@ -2636,6 +2638,7 @@ class TaskService {
|
||||||
static awsListJobs(perResultCallback = false) {
|
static awsListJobs(perResultCallback = false) {
|
||||||
var _a;
|
var _a;
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
cloud_runner_logger_1.default.log(`List Jobs`);
|
||||||
process.env.AWS_REGION = input_1.default.region;
|
process.env.AWS_REGION = input_1.default.region;
|
||||||
const CF = new aws_sdk_1.default.CloudFormation();
|
const CF = new aws_sdk_1.default.CloudFormation();
|
||||||
const stacks = ((_a = (yield CF.listStacks().promise()).StackSummaries) === null || _a === void 0 ? void 0 : _a.filter((_x) => _x.StackStatus !== 'DELETE_COMPLETE' && _x.TemplateDescription !== base_stack_formation_1.BaseStackFormation.baseStackDecription)) || [];
|
const stacks = ((_a = (yield CF.listStacks().promise()).StackSummaries) === null || _a === void 0 ? void 0 : _a.filter((_x) => _x.StackStatus !== 'DELETE_COMPLETE' && _x.TemplateDescription !== base_stack_formation_1.BaseStackFormation.baseStackDecription)) || [];
|
||||||
|
|
@ -3046,8 +3049,15 @@ class Kubernetes {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
const reason = ((_b = (_a = error.response) === null || _a === void 0 ? void 0 : _a.body) === null || _b === void 0 ? void 0 : _b.reason) || error.reason || ``;
|
let errorParsed;
|
||||||
const errorMessage = error.message || ``;
|
try {
|
||||||
|
errorParsed = JSON.parse(error);
|
||||||
|
}
|
||||||
|
catch (_c) {
|
||||||
|
errorParsed = error;
|
||||||
|
}
|
||||||
|
const reason = errorParsed.reason || ((_b = (_a = errorParsed.response) === null || _a === void 0 ? void 0 : _a.body) === null || _b === void 0 ? void 0 : _b.reason) || ``;
|
||||||
|
const errorMessage = errorParsed.message || ``;
|
||||||
const continueStreaming = reason === `NotFound` || errorMessage.includes(`dial timeout, backstop`);
|
const continueStreaming = reason === `NotFound` || errorMessage.includes(`dial timeout, backstop`);
|
||||||
if (continueStreaming) {
|
if (continueStreaming) {
|
||||||
cloud_runner_logger_1.default.log('Log Stream Container Not Found');
|
cloud_runner_logger_1.default.log('Log Stream Container Not Found');
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -16,6 +16,7 @@ export class TaskService {
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
public static async awsListStacks(perResultCallback: any = false) {
|
public static async awsListStacks(perResultCallback: any = false) {
|
||||||
|
CloudRunnerLogger.log(`List Stacks`);
|
||||||
process.env.AWS_REGION = Input.region;
|
process.env.AWS_REGION = Input.region;
|
||||||
const CF = new AWS.CloudFormation();
|
const CF = new AWS.CloudFormation();
|
||||||
const stacks =
|
const stacks =
|
||||||
|
|
@ -55,6 +56,7 @@ export class TaskService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static async awsListTasks(perResultCallback: any = false) {
|
public static async awsListTasks(perResultCallback: any = false) {
|
||||||
|
CloudRunnerLogger.log(`List Tasks`);
|
||||||
process.env.AWS_REGION = Input.region;
|
process.env.AWS_REGION = Input.region;
|
||||||
const ecs = new AWS.ECS();
|
const ecs = new AWS.ECS();
|
||||||
const clusters = (await ecs.listClusters().promise()).clusterArns || [];
|
const clusters = (await ecs.listClusters().promise()).clusterArns || [];
|
||||||
|
|
@ -88,6 +90,7 @@ export class TaskService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static async awsListJobs(perResultCallback: any = false) {
|
public static async awsListJobs(perResultCallback: any = false) {
|
||||||
|
CloudRunnerLogger.log(`List Jobs`);
|
||||||
process.env.AWS_REGION = Input.region;
|
process.env.AWS_REGION = Input.region;
|
||||||
const CF = new AWS.CloudFormation();
|
const CF = new AWS.CloudFormation();
|
||||||
const stacks =
|
const stacks =
|
||||||
|
|
|
||||||
|
|
@ -155,8 +155,14 @@ class Kubernetes implements ProviderInterface {
|
||||||
CloudRunnerLogger.log('Pod still running, recovering stream...');
|
CloudRunnerLogger.log('Pod still running, recovering stream...');
|
||||||
}
|
}
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
const reason = error.response?.body?.reason || error.reason || ``;
|
let errorParsed;
|
||||||
const errorMessage = error.message || ``;
|
try {
|
||||||
|
errorParsed = JSON.parse(error);
|
||||||
|
} catch {
|
||||||
|
errorParsed = error;
|
||||||
|
}
|
||||||
|
const reason = errorParsed.reason || errorParsed.response?.body?.reason || ``;
|
||||||
|
const errorMessage = errorParsed.message || ``;
|
||||||
|
|
||||||
const continueStreaming = reason === `NotFound` || errorMessage.includes(`dial timeout, backstop`);
|
const continueStreaming = reason === `NotFound` || errorMessage.includes(`dial timeout, backstop`);
|
||||||
if (continueStreaming) {
|
if (continueStreaming) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue