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

[pipelines]: Allow customizing the CodeBuild project for building Docker images #13645

Closed
wolverian opened this issue Mar 17, 2021 · 4 comments
Closed
Labels
@aws-cdk/aws-codebuild Related to AWS CodeBuild @aws-cdk/pipelines CDK Pipelines library effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. p1

Comments

@wolverian
Copy link

Allow the user to specify environment variables, build images etc. for how Docker images are built with CDK pipelines.

Use Case

I have a Docker image that requires DOCKER_BUILDKIT=1 set. I would also like to update the environment image from aws/codebuild/standard:4.0 to aws/codebuild/standard:5.0. I don't see easy ways to do this right now, and dropping down from automatic builds with cdk-pipelines to configuring your own CodeBuildActions seems like a fairly big refactoring.

Proposed Solution

I don't have a proposed API for this; the current "automagic" configuration of Docker builds via Stages doesn't really surface any hooks to us where we could add customization options. Some options would be:

  • Add properties to the CdkPipeline itself with high-level configuration properties for building assets.
  • Add API to CdkPipeline to get the build projects for each assets and let the user configure them directly.

This is a 🚀 Feature Request

@wolverian wolverian added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Mar 17, 2021
@github-actions github-actions bot added the @aws-cdk/aws-codebuild Related to AWS CodeBuild label Mar 17, 2021
@github-actions github-actions bot added the @aws-cdk/pipelines CDK Pipelines library label Mar 17, 2021
@rix0rrr rix0rrr added effort/medium Medium work item – several days of effort p1 labels Mar 22, 2021
@rix0rrr rix0rrr added this to the [GA] CDK Pipelines milestone Mar 22, 2021
@nemanjko
Copy link

I think this goes along my issue that I am currently experiencing with CDKPipeline construct. Thinks were working fine until today. Today my CodeBuild stage was breaking with the following error:

[Container] 2021/04/12 13:22:33 Running command npm install -g aws-cdk
npm ERR! code ETARGET
npm ERR! notarget No matching version found for @aws-cdk/region-info@1.98.0.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2021-04-12T13_22_38_578Z-debug.log
[Container] 2021/04/12 13:22:38 Command did not exit successfully npm install -g aws-cdk exit status 1
[Container] 2021/04/12 13:22:38 Phase complete: INSTALL State: FAILED
[Container] 2021/04/12 13:22:38 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: npm install -g aws-cdk. Reason: exit status 1

The only explanation I see is that the new aws-cdk version 1.98.0 has some dependency issue (as usual with CDK).

I solved it by manually modifying buildspec in CodeBuild, replacing
"commands": "npm install -g aws-cdk" with
"commands": "npm install -g aws-cdk@1.96.0"

Then it worked again.

@njlynch
Copy link
Contributor

njlynch commented Jul 1, 2021

@nemanjko - I'm super late to the party, but I don't think the error you encountered was related to this issue. From the timestamps, it looks like you ran into this error just as 1.98.0 was being published. I suspect aws-cdk@1.98.0 had been fully propagated and was available, but @aws-cdk/region-info@1.98.0 had not, resulting in the error. We publish our packages in topological order, but that doesn't always translate into when they're available via npm install. Had you simply re-tried the failing job (likely after ~20 minutes), I suspect the error would have gone away on its own.

@rix0rrr
Copy link
Contributor

rix0rrr commented Jul 5, 2021

This issue will be addressed by #15169 and #12326, so closing as duplicate.

@rix0rrr rix0rrr closed this as completed Jul 5, 2021
@github-actions
Copy link

github-actions bot commented Jul 5, 2021

⚠️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 @aws-cdk/pipelines CDK Pipelines library effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. p1
Projects
None yet
Development

No branches or pull requests

5 participants