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

aws-codebuild: The default image of aws/codebuild/standard:1.0 results in slow provisioning times #23096

Closed
richardm opened this issue Nov 26, 2022 · 4 comments
Assignees
Labels
@aws-cdk/aws-codebuild Related to AWS CodeBuild breaking-change This issue requires a breaking change to remediate. effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2

Comments

@richardm
Copy link

Describe the bug

Running a Hello World CodeBuild Project consistently takes 2+ minutes to provision yet only seconds to execute. This appears to be due to the AWS CDK using aws/codebuild/standard:1.0 by default. According to the references below, the latest image for Ubuntu 18.04 is aws/codebuild/standard:4.0, and it appears that only the latest images are cached.

166-seconds-to-provision

default-standard-1

Expected Behavior

Per the AWS CodeBuild docs: "By default, projects use a small instance with an Ubuntu 18.04 image. You can use the environment property to customize the build environment."

I expected the default image to be cached since presumably most people new to the CDK (like me) would use the default. I further expected it to be the latest Ubuntu 18.04 image, which appears to be aws/codebuild/standard:4.0.

Current Behavior

The default image used is aws/codebuild/standard:1.0, which takes 2+ minutes to provision.

default-standard-1

Reproduction Steps

return new Project(this, 'Project', {
  environment: {
    // Reproduce by not specifying any environment properties
  }
});

Possible Solution

I provided a value for the build image, and it reduced provisioning times to under 30 seconds, which is a substantial improvement:

return new Project(this, 'Project', {
  environment: {
    buildImage: LinuxBuildImage.STANDARD_4_0
  }
});

Screenshot 2022-11-25 at 7 08 26 PM

Screenshot 2022-11-25 at 7 09 12 PM

Additional Information/Context

No response

CDK CLI Version

2.51.1 (build 3d30cdb)

Framework Version

No response

Node.js Version

v14.18.2

OS

Mac OS Ventura 13.0.1

Language

Typescript

Language Version

No response

Other information

No response

@richardm richardm added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Nov 26, 2022
@github-actions github-actions bot added the @aws-cdk/aws-codebuild Related to AWS CodeBuild label Nov 26, 2022
@peterwoodworth
Copy link
Contributor

This is defined here

this.buildImage = (props.environment && props.environment.buildImage) || LinuxBuildImage.STANDARD_1_0;

Something like this we'd need to have a feature flag to adjust, in case anyone is using the default value intentionally and doesn't desire that to change

@peterwoodworth peterwoodworth added p2 feature-request A feature should be added or improved. effort/small Small work item – less than a day of effort breaking-change This issue requires a breaking change to remediate. and removed bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Nov 26, 2022
@richardm
Copy link
Author

Is there a reference that documents the planned release schedule or planned end of maintenance for these codebuild/standard images? I found the AWS-codebuild-docker-images readme which claims that the codebuild/standard images below 4.0 are no longer maintained or updated, but it's unclear how much longer 4.0 will receive support. If the default gets changed to 4.0, I wonder if we will soon find ourselves back in this same situation of the default image not being cached and another round of breaking changes required to update the default. Perhaps if the default gets changed, it should be to 5.0 or later, but even that simply delays the need to repeat this process.

From an end user standpoint, I don't mind adding a couple of lines to use a different image. The issue is there was nothing warning me that I should not use the default settings -- or that they referred to an unsupported image. At minimum, this could this be called out more clearly in the docs.

How about also marking LinuxBuildImage.STANDARD_1_0 - LinuxBuildImage.STANDARD_3_0 as deprecated? That seems appropriate given that the images are no longer supported or maintained, and I see this has already been done for AMAZON_LINUX_2_ARM (though possibly for different reasons). That doesn't solve the problem for projects using the defaults, but it does provide a gentle nudge for those who at one point hard-coded the image value and just haven't gotten around to upgrading.

When I run cdk synth with the default environment settings, it informs me that I'm using the 1.0 image. How about having cdk synth or cdk deploy warn anyone using lower than 4.0 that the image they are using is no longer maintained and recommending an upgrade to 4:0 or higher? This would encourage everyone to update to a newer (cached) image without the downside of breaking changes. This is also a more sustainable long-term solution to this issue, since a LinuxBuildImage.MINIMUM_SUPPPORTED_VERSION const could be easily updated once 4.0 is no longer supported.

I'm happy to work on a PR for some of these changes but wanted to confirm direction first.

@peterwoodworth
Copy link
Contributor

Thanks again for the request and your input. If you're still interested in continuing this discussion, let's do so in #16707

@peterwoodworth peterwoodworth closed this as not planned Won't fix, can't repro, duplicate, stale Mar 8, 2023
@github-actions
Copy link

github-actions bot commented Mar 8, 2023

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

mergify bot pushed a commit that referenced this issue Dec 31, 2023
…ined (#28533)

As per these documents, the following build image is not actively maintained, so I added @deprecated tag in this PR.

- `standard`
  - `STANDARD_1_0`
  - `STANDARD_2_0`
  - `STANDARD_3_0`
  - `STANDARD_4_0`
- `amazonlinux2-x86_64-standard`
  - `AMAZON_LINUX_2`
  - `AMAZON_LINUX_2_2`
  - `AMAZON_LINUX_2_3`
- `amazonlinux2-aarch64-standard`
  - `AMAZON_LINUX_2_STANDARD_1_0`

https://github.com/aws/aws-codebuild-docker-images?tab=readme-ov-file#image-maintenance
https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-available.html

relates: #23096 (comment), #16707

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
paulhcsun pushed a commit to paulhcsun/aws-cdk that referenced this issue Jan 5, 2024
…ined (aws#28533)

As per these documents, the following build image is not actively maintained, so I added @deprecated tag in this PR.

- `standard`
  - `STANDARD_1_0`
  - `STANDARD_2_0`
  - `STANDARD_3_0`
  - `STANDARD_4_0`
- `amazonlinux2-x86_64-standard`
  - `AMAZON_LINUX_2`
  - `AMAZON_LINUX_2_2`
  - `AMAZON_LINUX_2_3`
- `amazonlinux2-aarch64-standard`
  - `AMAZON_LINUX_2_STANDARD_1_0`

https://github.com/aws/aws-codebuild-docker-images?tab=readme-ov-file#image-maintenance
https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-available.html

relates: aws#23096 (comment), aws#16707

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-codebuild Related to AWS CodeBuild breaking-change This issue requires a breaking change to remediate. effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2
Projects
None yet
Development

No branches or pull requests

3 participants