Add Cloud Runner Pipeline to Main (#472)

* fix: k8s error handling

(cherry picked from commit f633a3efb42432a6d2492712aead865a950c8dca)

* include main in main cloud-runner pipeline

(cherry picked from commit a40fbe941bba1ba4593c83c754b37363a969bfe5)
This commit is contained in:
Frostebite
2022-11-08 09:37:16 +00:00
committed by GitHub
parent 4cca069ebb
commit f300dd27bb
6 changed files with 26 additions and 8 deletions

14
dist/index.js generated vendored
View File

@@ -2575,6 +2575,7 @@ class TaskService {
static awsListStacks(perResultCallback = false) {
var _a, _b;
return __awaiter(this, void 0, void 0, function* () {
cloud_runner_logger_1.default.log(`List Stacks`);
process.env.AWS_REGION = input_1.default.region;
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')) || [];
@@ -2600,6 +2601,7 @@ class TaskService {
}
static awsListTasks(perResultCallback = false) {
return __awaiter(this, void 0, void 0, function* () {
cloud_runner_logger_1.default.log(`List Tasks`);
process.env.AWS_REGION = input_1.default.region;
const ecs = new aws_sdk_1.default.ECS();
const clusters = (yield ecs.listClusters().promise()).clusterArns || [];
@@ -2636,6 +2638,7 @@ class TaskService {
static awsListJobs(perResultCallback = false) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
cloud_runner_logger_1.default.log(`List Jobs`);
process.env.AWS_REGION = input_1.default.region;
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)) || [];
@@ -3046,8 +3049,15 @@ class Kubernetes {
}
}
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 || ``;
const errorMessage = error.message || ``;
let errorParsed;
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`);
if (continueStreaming) {
cloud_runner_logger_1.default.log('Log Stream Container Not Found');