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)
pull/477/head
Frostebite 2022-11-08 09:37:16 +00:00 committed by GitHub
parent 4cca069ebb
commit f300dd27bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 26 additions and 8 deletions

View File

@ -85,12 +85,11 @@ jobs:
- run: | - run: |
mv ./cloud-runner-cache/${{ steps.unity-build.outputs.CACHE_KEY }}/build/build-${{ steps.unity-build.outputs.BUILD_GUID }}.tar.lz4 build-${{ steps.unity-build.outputs.BUILD_GUID }}.tar.lz4 mv ./cloud-runner-cache/${{ steps.unity-build.outputs.CACHE_KEY }}/build/build-${{ steps.unity-build.outputs.BUILD_GUID }}.tar.lz4 build-${{ steps.unity-build.outputs.BUILD_GUID }}.tar.lz4
ls ls
- run: yarn run cli -m list-resources
########################### ###########################
# Upload # # Upload #
########################### ###########################
- uses: actions/upload-artifact@v2 - uses: actions/upload-artifact@v2
with: with:
name: AWS Build (${{ matrix.targetPlatform }}) name: Local Build (${{ matrix.targetPlatform }})
path: build-${{ steps.unity-build.outputs.BUILD_GUID }}.tar.lz4 path: build-${{ steps.unity-build.outputs.BUILD_GUID }}.tar.lz4
retention-days: 14 retention-days: 14

View File

@ -1,7 +1,7 @@
name: Cloud Runner CI Pipeline name: Cloud Runner CI Pipeline
on: on:
push: { branches: [cloud-runner-develop, cloud-runner-preview] } push: { branches: [cloud-runner-develop, cloud-runner-preview, main] }
env: env:
GKE_ZONE: 'us-central1' GKE_ZONE: 'us-central1'

14
dist/index.js generated vendored
View File

@ -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');

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View File

@ -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 =

View File

@ -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) {