Open rafzei opened 1 year ago
We do have support in CodeBuild for batch builds. You'll need to declare that batch builds are possible: https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codebuild-readme.html#batch-builds
However, I don't think that's the answer you're looking for. Do you have an example of achieving this using CloudFormation?
This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.
We do have support in CodeBuild for batch builds. You'll need to declare that batch builds are possible: https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codebuild-readme.html#batch-builds
However, I don't think that's the answer you're looking for. Do you have an example of achieving this using CloudFormation?
No, I didn't find a way to do this directly.
@TheRealAmazonKendra any update?
I have the same need, but I think this issue should be raised with either the CodeBuild and/or EventBridge teams, because even outside of CDK I didn't find a way to have a Rule trigger a batch CodeBuild Project. I think this capability is just not present in the current product offering, which is sad.
I was thinking about using a lambda as a workaround like you mentioned, but it's killing a fly with a hammer...
You could likely build a custom resource to do this, but as it is not currently possible in CloudFormation, this is not something we can support at this time.
This is now possible in CloudFormation and the usual escape-hatch workaround can be used to do it in CDK for the time being. Just note that you will need to convert the props CfnProject.ProjectBuildBatchConfigProperty
into CamelCase for it to work in Cloudformation, since the generated CDK code for the L1 construct puts it into camelCase:
function addBatchBuilds(project: Project, batchBuildConfig: CfnProject.ProjectBuildBatchConfigProperty) {
const cfnProject = project.node.defaultChild as CfnProject
cfnProject.addOverride('Properties.BuildBatchConfig', objectKeysToPascalCase({
serviceRole: this.enableBatchBuilds()?.role?.roleArn,
...typeof batchBuildConfig !== 'boolean' ? batchBuildConfig : {}
}))
Describe the feature
I would like to schedule AWS Codebuild batch build using aws_events.Rule target.
The following code is scheduling standard build even if
test_project
has batch builds enabled.Use Case
I need this to run scheduled batch builds
Proposed Solution
test_project has to have batch_builds enabled
(test_project.enable_batch_builds())
.Other Information
Currently, I see two ways to run codebuild batch builds:
CDK Codebuild source:
webhook_triggers_batch_build=True
docs linkAWS CLI:
aws codebuild start-build-batch --project-name <project-name>
docs link It could be used in lambda as a workaround.Acknowledgements
CDK version used
2.50.0 (build 4c11af6)
Environment details (OS name and version, etc.)
Ubuntu 22.04