Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(codebuild): fleet attribute-based compute type #32574

Conversation

nmussy
Copy link
Contributor

@nmussy nmussy commented Dec 18, 2024

Issue # (if applicable)

None that I could find, related to #30458

Reason for this change

Implement missing attribute-based compute feature to the L2 CodeBuild Fleet construct. See docs for (sparse) reference

Description of changes

  • Add computeConfiguration property to the Fleet resource
    • Add ATTRIBUTE_BASED value to the existing FleetComputeType enum
    • Add section to the CodeBuild README

Describe any new or updated permissions being added

None

Description of how you validated changes

Added unit and integration tests. The failed configurations were also listed in the integration, with an explanation given as to why their deployment had resulted in an error

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@aws-cdk-automation aws-cdk-automation requested a review from a team December 18, 2024 14:04
@github-actions github-actions bot added p2 distinguished-contributor [Pilot] contributed 50+ PRs to the CDK labels Dec 18, 2024
Comment on lines +207 to +214
if (props.computeConfiguration && props.computeType !== FleetComputeType.ATTRIBUTE_BASED) {
throw new Error('computeConfiguration can only be specified if computeType is "ATTRIBUTE_BASED"');
}

if (props.computeType === FleetComputeType.ATTRIBUTE_BASED &&
(!props.computeConfiguration || Object.keys(props.computeConfiguration).length === 0)) {
throw new Error('At least one compute configuration criteria must be specified if computeType is "ATTRIBUTE_BASED"');
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm only doing base prop validation here. I think currently invalid attribute configurations, such as the 192 GiB of memory and NVME machine type described in the integ test, shouldn't be validated by the CDK. These limitations are bound to change over time and across regions.

Comment on lines +42 to +73
// No NVME instance is available with this much memory, and the deployment fails.
// Throws error: The specified compute configurations do not match any available instance type
// When creating a fleet in the web console with the same constraints,
// "reserved.x86-64.96cpu.192gib" is selected as the instance type, despite not meeting the NVME criteria
/* {
computeConfiguration: {
memory: 192,
machineType: codebuild.FleetComputeConfigurationMachineType.NVME,
},
expectedInstanceType: 'reserved.x86-64.96cpu.192gib',
}, */

// A default account wasn't allowed to deploy the smallest available NVME instance in us-east-1
// Throws error: The number of instances of type c5d.12xlarge exceeded limit 0
// Skipping this test instead of opening a quota increase support ticket to save myself and future integ runners the trouble
/* {
computeConfiguration: {
machineType: codebuild.FleetComputeConfigurationMachineType.NVME,
disk: 824,
memory: 96,
vCpu: 48,
},
expectedInstanceType: 'reserved.x86-64.48cpu.96gib.NVME',
}, */

// Prior to setting default values for numeric attributes internally, the CloudFormation template fails on deployment:
// Throws error: Resource handler returned message: "Cannot invoke "java.lang.Integer.intValue()" because the return value of "software.amazon.codebuild.fleet.ComputeConfiguration.getMemory()" is null"
// { vCpu: 1 },
// Throws error: Resource handler returned message: "Cannot invoke "java.lang.Integer.intValue()" because the return value of "software.amazon.codebuild.fleet.ComputeConfiguration.getvCpu()" is null"
// { memory: 1 },
// Throws error: Resource handler returned message: "Cannot invoke "java.lang.Integer.intValue()" because the return value of "software.amazon.codebuild.fleet.ComputeConfiguration.getDisk()" is null"
// { memory: 1, vCpu: 1 },
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies if this seems very verbose, but I think laying out my testing process is helpful both for this PR's reviewer and future maintainers, given how little the official documentation explains any of this

@nmussy nmussy changed the title feat(codebuild): fleet attribute based compute type feat(codebuild): fleet attribute-based compute type Dec 18, 2024
@nmussy nmussy mentioned this pull request Dec 18, 2024
2 tasks
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 6120d8f
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Dec 18, 2024
@nmussy
Copy link
Contributor Author

nmussy commented Dec 19, 2024

Duplicate of #32251

@nmussy nmussy closed this Dec 19, 2024
Copy link

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
distinguished-contributor [Pilot] contributed 50+ PRs to the CDK p2 pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants