From d6ac850da1fcd23a1aa8f1227bf49b81051098ef Mon Sep 17 00:00:00 2001 From: Frostebite Date: Thu, 17 Nov 2022 18:59:33 +0000 Subject: [PATCH] Fix "large package handling" to redirect to shared folder (#473) --- dist/index.js | Bin 21969038 -> 21967483 bytes dist/index.js.map | Bin 16362938 -> 16361186 bytes .../cloud-runner/cloud-runner-options.ts | 12 +-- src/model/cloud-runner/providers/aws/index.ts | 10 +- .../services/garbage-collection-service.ts | 22 ++-- .../providers/aws/services/task-service.ts | 99 ++++++++++++------ .../services/tertiary-resources-service.ts | 36 ------- src/model/cloud-runner/remote-client/index.ts | 16 +-- 8 files changed, 98 insertions(+), 97 deletions(-) delete mode 100644 src/model/cloud-runner/providers/aws/services/tertiary-resources-service.ts diff --git a/dist/index.js b/dist/index.js index 3164940e722d328fc87ac6d608a3cde257042158..2689df0b683277d174b0de919a5f785393eb1dcd 100644 GIT binary patch delta 2814 zcmaLX4SW;z9mnz4KbKt6(C3HHCZ${oB`uavECNysDV3to(#|rc=(M4|me4eTUOFsK z1BW26N$Wv>)lG+NbIz$$ahz;u0io83SU{a~!xeE4;&f$hYy-i4e`%?_eCn(3Pp^0X zyZhhe-`;n2pZ&sn`|MrYH(8qefsjXEwk2IJ=&h7R}e0!x>qk_a@LEaAG#83l6%TmojzoyYZ zm&l;IwoCD}^GR_`uQ+a}zWt({j-C*AQ-80RLQT6wnATRCWGa{@%#x-Q(+eFU`?I^y zu^!188^IlwaJ|AmseOi=Mv1*9IcsHf$Lyfmq=q8-iaNNVtX7Ko0JV>kQ)p|ph&MKM ziB|>r*2;1EQ%mF#OD;d;(Cu7b{Tgz40yz@SAkib79otQ2#Dc*oL{E~#c*j>fZ8`rwcr$Yl+k;P8^P(7&!iT0S zV^*YnZETg7 zZ-}9`gCd(sPD+I|^MJ6VMOTC}yd;$9f-t&Y6Ng1~RO06c80(LTMS}X0Ei$d`l`^UA z6)9E!;CPI&`H+|}c#>fp7U3(#bR>!d>hqf1rka}QQmR^S%CQcu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n?!p z@Y^F6bjCLg{annFedjGqK5yZ^2;EQ$wZEiL>!!^wwJ`R$|PsS@hIvp5DnDU$5PWTC~N34;{B$Zsq`2V<-KiOEy%s? z+!975nlsVl--QwvK9-}P?hkOD{j1Sw&q}@|?Bdz-fowG)(*%#xtmRxo-SsSr>h5BC zI%>!qLtC^gGA+1BTw!;1$lzZpp`fZO7#^SnVx6)sPzn|pK(;2Py>Fi>hDsXw5{g@e z=c(=vRD9xMo+tdF`VhNZ%$BvQ`RQ=#%gv0T91oABRhxL8?0=kXy(B*5AtAGe|D0gA zx!o+Z?X!BGBnDF*KC~m|J7*}N@qxQ)pje4>a(;`fH0yb8#KkKxc-~S&f(EaoCy!C( zaz2WVZWi_A+{B}EFY*?$$s=S?=j7RPcPXC`N&nr;8+_HBT(0gEw`L9eQbf(SwYJQa z+#c%c6^p3$OJfebVlpPs_CsP)WFE`%dghL!DZM5wt!qTR*h+D7;9iN;dRR=LT|LGa z>Rf7y4>Y8Z;gC3*(tE_HLbFS9+HDO|c0q;B)g)PQJ8eypyPydn&E^99UGP1N9_=wE zQeT@%?b~@+1S6Or6GlN6WW#94fn3Ogd@w@+6haYiztDyoap$e+O3fI6)sDW80&syFJm7_ea4Rf=#c&%efu*nv{sPOP z4cg&$SOF{H4p;>~SPgf=U9bk$!a7(FcS8qkfO}vg+zXrFJ|MUs9)JhoA$S-%VKY1e zTi{XH3Xj3#@B};w+u$j98n(kT@GR_rov;i1&;`%IZg?JEfEPiAJ@69jg_mI;yaKPn ze&~h+a1dUD*WnQKz+rd;-h{W{ZFmQcz`M{3N8vqqA3lJ;!r$QU@F5(7kKkiC4xhlM z@EM$dJ~#=V!x!)+d { - await TaskService.awsListJobs(); - await TertiaryResourcesService.awsListLogGroups(); - await TaskService.awsListTasks(); - await TaskService.awsListStacks(); + await TaskService.getCloudFormationJobStacks(); + await TaskService.getLogGroups(); + await TaskService.getTasks(); return []; } @@ -37,7 +35,7 @@ class AWSBuildEnvironment implements ProviderInterface { } async listOtherResources(): Promise { - await TertiaryResourcesService.awsListLogGroups(); + await TaskService.getLogGroups(); return ''; } diff --git a/src/model/cloud-runner/providers/aws/services/garbage-collection-service.ts b/src/model/cloud-runner/providers/aws/services/garbage-collection-service.ts index 51f58090..b46e660b 100644 --- a/src/model/cloud-runner/providers/aws/services/garbage-collection-service.ts +++ b/src/model/cloud-runner/providers/aws/services/garbage-collection-service.ts @@ -2,7 +2,6 @@ import AWS from 'aws-sdk'; import Input from '../../../../input'; import CloudRunnerLogger from '../../../services/cloud-runner-logger'; import { TaskService } from './task-service'; -import { TertiaryResourcesService } from './tertiary-resources-service'; export class GarbageCollectionService { static isOlderThan1day(date: any) { @@ -17,14 +16,17 @@ export class GarbageCollectionService { const ecs = new AWS.ECS(); const cwl = new AWS.CloudWatchLogs(); const taskDefinitionsInUse = new Array(); - await TaskService.awsListTasks(async (taskElement, element) => { + const tasks = await TaskService.getTasks(); + for (const task of tasks) { + const { taskElement, element } = task; taskDefinitionsInUse.push(taskElement.taskDefinitionArn); if (deleteResources && (!OneDayOlderOnly || GarbageCollectionService.isOlderThan1day(taskElement.CreatedAt))) { CloudRunnerLogger.log(`Stopping task ${taskElement.containers?.[0].name}`); await ecs.stopTask({ task: taskElement.taskArn || '', cluster: element }).promise(); } - }); - await TaskService.awsListStacks(async (element) => { + } + const jobStacks = await TaskService.getCloudFormationJobStacks(); + for (const element of jobStacks) { if ( (await CF.describeStackResources({ StackName: element.StackName }).promise()).StackResources?.some( (x) => x.ResourceType === 'AWS::ECS::TaskDefinition' && taskDefinitionsInUse.includes(x.PhysicalResourceId), @@ -44,8 +46,9 @@ export class GarbageCollectionService { const deleteStackInput: AWS.CloudFormation.DeleteStackInput = { StackName: element.StackName }; await CF.deleteStack(deleteStackInput).promise(); } - }); - await TertiaryResourcesService.awsListLogGroups(async (element) => { + } + const logGroups = await TaskService.getLogGroups(); + for (const element of logGroups) { if ( deleteResources && (!OneDayOlderOnly || GarbageCollectionService.isOlderThan1day(new Date(element.createdAt))) @@ -53,6 +56,11 @@ export class GarbageCollectionService { CloudRunnerLogger.log(`Deleting ${element.logGroupName}`); await cwl.deleteLogGroup({ logGroupName: element.logGroupName || '' }).promise(); } - }); + } + + const locks = await TaskService.getLocks(); + for (const element of locks) { + CloudRunnerLogger.log(`Lock: ${element.Key}`); + } } } diff --git a/src/model/cloud-runner/providers/aws/services/task-service.ts b/src/model/cloud-runner/providers/aws/services/task-service.ts index d8ba36f2..e9972854 100644 --- a/src/model/cloud-runner/providers/aws/services/task-service.ts +++ b/src/model/cloud-runner/providers/aws/services/task-service.ts @@ -3,6 +3,7 @@ import Input from '../../../../input'; import CloudRunnerLogger from '../../../services/cloud-runner-logger'; import { BaseStackFormation } from '../cloud-formations/base-stack-formation'; import AwsTaskRunner from '../aws-task-runner'; +import { ListObjectsRequest } from 'aws-sdk/clients/s3'; export class TaskService { static async watch() { @@ -15,16 +16,19 @@ export class TaskService { return output; } - public static async awsListStacks(perResultCallback: any = false) { - CloudRunnerLogger.log(`List Stacks`); + public static async getCloudFormationJobStacks() { + const result: any[] = []; + CloudRunnerLogger.log(``); + CloudRunnerLogger.log(`List Cloud Formation Stacks`); process.env.AWS_REGION = Input.region; const CF = new AWS.CloudFormation(); const stacks = (await CF.listStacks().promise()).StackSummaries?.filter( - (_x) => _x.StackStatus !== 'DELETE_COMPLETE', // && - // _x.TemplateDescription === TaskDefinitionFormation.description.replace('\n', ''), + (_x) => + _x.StackStatus !== 'DELETE_COMPLETE' && _x.TemplateDescription !== BaseStackFormation.baseStackDecription, ) || []; - CloudRunnerLogger.log(`Stacks ${stacks.length}`); + CloudRunnerLogger.log(``); + CloudRunnerLogger.log(`Cloud Formation Stacks ${stacks.length}`); for (const element of stacks) { const ageDate: Date = new Date(Date.now() - element.CreationTime.getTime()); @@ -33,13 +37,14 @@ export class TaskService { ageDate.getHours() / 24, )} H${ageDate.getHours()} M${ageDate.getMinutes()}`, ); - if (perResultCallback) await perResultCallback(element); + result.push(element); } const baseStacks = (await CF.listStacks().promise()).StackSummaries?.filter( (_x) => _x.StackStatus !== 'DELETE_COMPLETE' && _x.TemplateDescription === BaseStackFormation.baseStackDecription, ) || []; + CloudRunnerLogger.log(``); CloudRunnerLogger.log(`Base Stacks ${baseStacks.length}`); for (const element of baseStacks) { const ageDate: Date = new Date(Date.now() - element.CreationTime.getTime()); @@ -49,18 +54,20 @@ export class TaskService { ageDate.getHours() / 24, )} H${ageDate.getHours()} M${ageDate.getMinutes()}`, ); - if (perResultCallback) await perResultCallback(element); - } - if (stacks === undefined) { - return; + result.push(element); } + CloudRunnerLogger.log(``); + + return result; } - public static async awsListTasks(perResultCallback: any = false) { + public static async getTasks() { + const result: any[] = []; + CloudRunnerLogger.log(``); CloudRunnerLogger.log(`List Tasks`); process.env.AWS_REGION = Input.region; const ecs = new AWS.ECS(); const clusters = (await ecs.listClusters().promise()).clusterArns || []; - CloudRunnerLogger.log(`Clusters ${clusters.length}`); + CloudRunnerLogger.log(`Task Clusters ${clusters.length}`); for (const element of clusters) { const input: AWS.ECS.ListTasksRequest = { cluster: element, @@ -71,6 +78,7 @@ export class TaskService { const describeInput: AWS.ECS.DescribeTasksRequest = { tasks: list, cluster: element }; const describeList = (await ecs.describeTasks(describeInput).promise()).tasks || []; if (describeList.length === 0) { + CloudRunnerLogger.log(`No Tasks`); continue; } CloudRunnerLogger.log(`Tasks ${describeList.length}`); @@ -84,31 +92,13 @@ export class TaskService { CloudRunnerLogger.log(`Skipping ${taskElement.taskDefinitionArn} no createdAt date`); continue; } - if (perResultCallback) await perResultCallback(taskElement, element); + result.push({ taskElement, element }); } } } - } - public static async awsListJobs(perResultCallback: any = false) { - CloudRunnerLogger.log(`List Jobs`); - process.env.AWS_REGION = Input.region; - const CF = new AWS.CloudFormation(); - const stacks = - (await CF.listStacks().promise()).StackSummaries?.filter( - (_x) => - _x.StackStatus !== 'DELETE_COMPLETE' && _x.TemplateDescription !== BaseStackFormation.baseStackDecription, - ) || []; - CloudRunnerLogger.log(`Stacks ${stacks.length}`); - for (const element of stacks) { - const ageDate: Date = new Date(Date.now() - element.CreationTime.getTime()); + CloudRunnerLogger.log(``); - CloudRunnerLogger.log( - `Task Stack ${element.StackName} - Age D${Math.floor( - ageDate.getHours() / 24, - )} H${ageDate.getHours()} M${ageDate.getMinutes()}`, - ); - if (perResultCallback) await perResultCallback(element); - } + return result; } public static async awsDescribeJob(job: string) { process.env.AWS_REGION = Input.region; @@ -131,4 +121,47 @@ export class TaskService { return message; } + public static async getLogGroups() { + const result: any[] = []; + process.env.AWS_REGION = Input.region; + const ecs = new AWS.CloudWatchLogs(); + let logStreamInput: AWS.CloudWatchLogs.DescribeLogGroupsRequest = { + /* logGroupNamePrefix: 'game-ci' */ + }; + let logGroupsDescribe = await ecs.describeLogGroups(logStreamInput).promise(); + const logGroups = logGroupsDescribe.logGroups || []; + while (logGroupsDescribe.nextToken) { + logStreamInput = { /* logGroupNamePrefix: 'game-ci',*/ nextToken: logGroupsDescribe.nextToken }; + logGroupsDescribe = await ecs.describeLogGroups(logStreamInput).promise(); + logGroups.push(...(logGroupsDescribe?.logGroups || [])); + } + + CloudRunnerLogger.log(`Log Groups ${logGroups.length}`); + for (const element of logGroups) { + if (element.creationTime === undefined) { + CloudRunnerLogger.log(`Skipping ${element.logGroupName} no createdAt date`); + continue; + } + const ageDate: Date = new Date(Date.now() - element.creationTime); + + CloudRunnerLogger.log( + `Task Stack ${element.logGroupName} - Age D${Math.floor( + ageDate.getHours() / 24, + )} H${ageDate.getHours()} M${ageDate.getMinutes()}`, + ); + result.push(element); + } + + return result; + } + public static async getLocks() { + process.env.AWS_REGION = Input.region; + const s3 = new AWS.S3(); + const listRequest: ListObjectsRequest = { + Bucket: `game-ci-test-storage`, + }; + const results = await s3.listObjects(listRequest).promise(); + + return results.Contents || []; + } } diff --git a/src/model/cloud-runner/providers/aws/services/tertiary-resources-service.ts b/src/model/cloud-runner/providers/aws/services/tertiary-resources-service.ts deleted file mode 100644 index 22300269..00000000 --- a/src/model/cloud-runner/providers/aws/services/tertiary-resources-service.ts +++ /dev/null @@ -1,36 +0,0 @@ -import AWS from 'aws-sdk'; -import Input from '../../../../input'; -import CloudRunnerLogger from '../../../services/cloud-runner-logger'; - -export class TertiaryResourcesService { - public static async awsListLogGroups(perResultCallback: any = false) { - process.env.AWS_REGION = Input.region; - const ecs = new AWS.CloudWatchLogs(); - let logStreamInput: AWS.CloudWatchLogs.DescribeLogGroupsRequest = { - /* logGroupNamePrefix: 'game-ci' */ - }; - let logGroupsDescribe = await ecs.describeLogGroups(logStreamInput).promise(); - const logGroups = logGroupsDescribe.logGroups || []; - while (logGroupsDescribe.nextToken) { - logStreamInput = { /* logGroupNamePrefix: 'game-ci',*/ nextToken: logGroupsDescribe.nextToken }; - logGroupsDescribe = await ecs.describeLogGroups(logStreamInput).promise(); - logGroups.push(...(logGroupsDescribe?.logGroups || [])); - } - - CloudRunnerLogger.log(`Log Groups ${logGroups.length}`); - for (const element of logGroups) { - if (element.creationTime === undefined) { - CloudRunnerLogger.log(`Skipping ${element.logGroupName} no createdAt date`); - continue; - } - const ageDate: Date = new Date(Date.now() - element.creationTime); - - CloudRunnerLogger.log( - `Task Stack ${element.logGroupName} - Age D${Math.floor( - ageDate.getHours() / 24, - )} H${ageDate.getHours()} M${ageDate.getMinutes()}`, - ); - if (perResultCallback) await perResultCallback(element, element); - } - } -} diff --git a/src/model/cloud-runner/remote-client/index.ts b/src/model/cloud-runner/remote-client/index.ts index bfe126fc..e86db9c8 100644 --- a/src/model/cloud-runner/remote-client/index.ts +++ b/src/model/cloud-runner/remote-client/index.ts @@ -105,15 +105,15 @@ export class RemoteClient { } static replaceLargePackageReferencesWithSharedReferences() { - const manifest = fs.readFileSync( - path.join(CloudRunnerFolders.projectPathAbsolute, `Packages/manifest.json`), - 'utf8', - ); - if (CloudRunner.buildParameters.cloudRunnerDebug) { - CloudRunnerLogger.log(manifest); - } if (CloudRunner.buildParameters.useSharedLargePackages) { - manifest.replace(/LargePackages/g, '../../LargePackages'); + const filePath = path.join(CloudRunnerFolders.projectPathAbsolute, `Packages/manifest.json`); + let manifest = fs.readFileSync(filePath, 'utf8'); + manifest = manifest.replace(/LargeContent/g, '../../LargeContent'); + fs.writeFileSync(filePath, manifest); + if (CloudRunner.buildParameters.cloudRunnerDebug) { + CloudRunnerLogger.log(`Package Manifest`); + CloudRunnerLogger.log(manifest); + } } }