Skip to content

Commit f264575

Browse files
authored
Added retries to deployment and fixed logging (#819)
Co-authored-by: hickeydh <hickeydh@amazon.com>
1 parent b0227ae commit f264575

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

src/deployments/cdk/toolkit.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,13 @@ export class CdkToolkit {
176176
messageType,
177177
};
178178

179-
console.log(JSON.stringify(stackLoggingInfo, null, 4));
179+
console.log(JSON.stringify(stackLoggingInfo));
180180
}
181+
182+
async sleep(ms) {
183+
return new Promise(resolve => setTimeout(resolve, ms));
184+
}
185+
181186
async deployStack(stack: CloudFormationStackArtifact, retries: number = 0): Promise<StackOutput[]> {
182187
this.deploymentLog(stack, 'Deploying Stack');
183188
const stackExists = await this.cloudFormation.stackExists({ stack });
@@ -265,9 +270,10 @@ export class CdkToolkit {
265270
await this.destroyStack(stack);
266271
this.deploymentLog(stack, 'Deleted failed stack');
267272
}
268-
if (retries < 1) {
273+
if (retries < 2) {
269274
console.log(e);
270-
this.deploymentLog(stack, 'Deployment failed because of error. Retrying deployment');
275+
this.deploymentLog(stack, `Deployment failed because of error. Retrying deployment ${retries}`);
276+
await this.sleep(10000);
271277
return await this.deployStack(stack, retries + 1);
272278
}
273279
throw e;

src/installer/cdk/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,13 @@ async function main() {
8282
});
8383
const codebuildComputeType = new cdk.CfnParameter(stack, 'CodeBuild Compute Type', {
8484
description: 'The compute type of the build server for the Accelerator deployments.',
85-
default: codebuild.ComputeType.MEDIUM,
85+
default: codebuild.ComputeType.LARGE,
8686
allowedValues: [codebuild.ComputeType.MEDIUM, codebuild.ComputeType.LARGE, codebuild.ComputeType.X2_LARGE],
8787
});
8888

8989
const stackDeployPageSize = new cdk.CfnParameter(stack, 'Deployment Page Size', {
9090
description: 'The number of stacks to deploy in parallel. This value SHOULD NOT normally be changed.',
91-
default: 900,
91+
default: 680,
9292
});
9393
const stateMachineName = `${acceleratorPrefix}MainStateMachine_sm`;
9494

0 commit comments

Comments
 (0)