Skip to content

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

@richardm

Description

@richardm

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

Metadata

Metadata

Labels

@aws-cdk/aws-codebuildRelated to AWS CodeBuildbreaking-changeThis issue requires a breaking change to remediate.effort/smallSmall work item – less than a day of effortfeature-requestA feature should be added or improved.p2

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions