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

Change default CodeBuild Project build container to version 4 for faster codebuild builds #11960

Closed
yvthepief opened this issue Dec 9, 2020 · 12 comments
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/enhancement A new API to make things easier or more intuitive. A catch-all for general feature requests. feature-request A feature should be added or improved. p2

Comments

@yvthepief
Copy link

yvthepief commented Dec 9, 2020

Short Description

Change default CodeBuild Project build container to version 4

Use Case

When creating a codebuild project, the default project buildimage is Linux Standard v1.0.
Because AWS only caches latest versions of containers, in this case version 4, a CodeBuild build with the default container version 1, the provision time takes up to 4/5 minutes instead of seconds.

Proposed Solution

Change default BuildEnvironment.LinuxBuildImage.STANDARD_1_0 to version 4 => BuildEnvironment.LinuxBuildImage.STANDARD_4_0

found in aws-cdk/packages/@aws-cdk/aws-codebuild/lib/project.ts

 /**
   * Build environment to use for the build.
   *
   * @default BuildEnvironment.LinuxBuildImage.STANDARD_1_0
   */

This is a 🚀 Feature Request

@yvthepief yvthepief added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Dec 9, 2020
@skinny85
Copy link
Contributor

Hey @yvthepief ,

thanks for opening the issue. I'm a little hesitant about changing this default, as it would result in changes for all CDK customers that upgrade their versions (and there could potentially be differences between version 1 and version 4 that would make their builds start failing).

I think we could only make this change when we release version 2.0 of the CDK, which we hope to do soon 🙂.

Thanks,
Adam

@skinny85 skinny85 added breaking-change This issue requires a breaking change to remediate. effort/small Small work item – less than a day of effort p2 and removed needs-triage This issue or PR still needs to be triaged. labels Dec 10, 2020
@skinny85 skinny85 self-assigned this Dec 10, 2020
@skinny85 skinny85 added the @aws-cdk/aws-codebuild Related to AWS CodeBuild label Dec 10, 2020
@yvthepief
Copy link
Author

Thanks for the reply Adam (@skinny85).

I understand that, hence the feature request. Lets wait on CDK 2 ;-)

@rzamana
Copy link
Contributor

rzamana commented Dec 22, 2020

@skinny85 For the next version, instead of updating the version why not set a latest version? With this the client knows that it will always grab the latest version, if he wants a specific version, it needs to be defined!

@skinny85
Copy link
Contributor

@rzamana is that possible? Is it legal to use latest when specifying the CodeBuild image?

@ericzbeard ericzbeard added the feature/enhancement A new API to make things easier or more intuitive. A catch-all for general feature requests. label Apr 2, 2021
@EhsanHerai
Copy link

how can I manually change it.
I need to use Node.js 14 in codebuild buildspec.
for now I receive this warning after specifying node.js version.
[WARN] Skipping install of runtimes. Runtime version selection is not supported by this build image.

@skinny85
Copy link
Contributor

You need to set the buildImage property of the environment property of Project to LinuxBuildImage.STANDARD_5_0.

@EhsanHerai
Copy link

@skinny85 thank you for quick response.
actually I did it. but still have the same warning.

        version: '0.2',
        environment: {
          buildImage: LinuxBuildImage.STANDARD_5_0,
        },
        phases: {
          install: {
            'runtime-versions': {
              nodejs: '14.x',
            },
            commands: ['yarn install --frozen-lockfile'],
          },
          build: {
            commands: [
              `CDK_DIR="$PWD"`,
              `cd ..`,

@skinny85
Copy link
Contributor

skinny85 commented Feb 28, 2022

You're putting environment in the wrong place (you put it in the buildspec, while it's a property of Project, like I linked to above).

@EhsanHerai
Copy link

@skinny85 thanks.
actually I'm deploying a cdk stack inside buildSpec commnads. can I put credential for the account needed to deploy the stack inside environment as well.

@skinny85
Copy link
Contributor

skinny85 commented Mar 1, 2022

You can assume a Role in your buildspec. The Role of the Project needs the correct permissions.

@peterwoodworth
Copy link
Contributor

Closing in favor of newer issue #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.

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/enhancement A new API to make things easier or more intuitive. A catch-all for general feature requests. feature-request A feature should be added or improved. p2
Projects
None yet
Development

No branches or pull requests

6 participants