Skip to content

Commit

Permalink
fix: Fargate provider storage size setting doesn't work (#661)
Browse files Browse the repository at this point in the history
- Corrected the logical grouping of the nullish coalescing operator and ternary operator for the ephemeralStorageGiB property.
- Ensured that the ephemeralStorageGiB property is correctly set when provided in the props.
- This fix ensures that the correct storage value is reflected in the synthesized CloudFormation template.
- Prior to this fix the storage value would always be set to 25
  • Loading branch information
ToddMurphy92 authored Nov 29, 2024
1 parent 774d6d0 commit d293ca2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/providers/fargate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ export class FargateRunnerProvider extends BaseProvider implements IRunnerProvid
{
cpu: props?.cpu ?? 1024,
memoryLimitMiB: props?.memoryLimitMiB ?? 2048,
ephemeralStorageGiB: props?.ephemeralStorageGiB ?? !image.os.is(Os.WINDOWS) ? 25 : undefined,
ephemeralStorageGiB: props?.ephemeralStorageGiB ?? (!image.os.is(Os.WINDOWS) ? 25 : undefined),
runtimePlatform: {
operatingSystemFamily: os,
cpuArchitecture: arch,
Expand Down
4 changes: 3 additions & 1 deletion test/providers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ test('CodeBuild provider privileged', () => {
Environment: {
PrivilegedMode: true,
},
}), 2/*runners*/+3/*image builders*/);
}), 2/*runners*/ + 3/*image builders*/);

template.hasResourceProperties('AWS::CodeBuild::Project', Match.objectLike({
Environment: {
Expand Down Expand Up @@ -73,6 +73,7 @@ test('Fargate provider', () => {
new FargateRunnerProvider(stack, 'provider', {
vpc: vpc,
securityGroups: [sg],
ephemeralStorageGiB: 100,
});

const template = Template.fromStack(stack);
Expand All @@ -87,6 +88,7 @@ test('Fargate provider', () => {
Name: 'runner',
},
],
EphemeralStorage: { SizeInGiB: 100 },
}));
});

Expand Down

0 comments on commit d293ca2

Please sign in to comment.