aws / aws/aws-cdk

aws_codebuild: Add possibility to schedule batch build

Open
#22,841 7 comments 0 reactions 0 assignees View on GitHub
@aws-cdk/aws-codebuild @aws-cdk/aws-codepipeline @aws-cdk/aws-codepipeline-actions effort/large feature-request p3
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### 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.
```python
aws_events.Rule(
self,
"schedule_rule",
schedule=aws_events.Schedule.cron(cron_schedule),
targets=[
aws_events_targets.CodeBuildProject(
project=test_project,
event=aws_events.RuleTargetInput.from_object(
rule_target_input
),
),
],
)
```

### Use Case

I need this to run scheduled batch builds

### Proposed Solution

```python
aws_events.Rule(
self,
"schedule_rule",
schedule=aws_events.Schedule.cron(cron_schedule),
targets=[
aws_events_targets.CodeBuildProject(
project=test_project,
event=aws_events.RuleTargetInput.from_object(
rule_target_input
),
batch_build=True
),
],
)
```
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:

1. CDK Codebuild source:
`webhook_triggers_batch_build=True`
[docs link](https://docs.aws.amazon.com/cdk/api/v1/python/aws_cdk.aws_codebuild/README.html#githubsource-and-githubenterprisesource)

2. AWS CLI:
`aws codebuild start-build-batch --project-name `
[docs link](https://docs.aws.amazon.com/codebuild/latest/userguide/run-batch-build-cli.html)
It could be used in lambda as a workaround.

### Acknowledgements

- [ ] I may be able to implement this feature request
- [ ] This feature might incur a breaking change

### CDK version used

2.50.0 (build 4c11af6)

### Environment details (OS name and version, etc.)

Ubuntu 22.04

Contributor guide

Open the contributing guide

Research direction

Start at the aws_events_targets.CodeBuildProject target and compare its current behavior with the AWS CLI start-build-batch operation. Verify how the target currently starts standard builds and how the proposed batch_build option should be passed when the project has batch builds enabled. Done means scheduled rules can trigger batch builds without the Lambda workaround, with coverage for the new option.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud, devops
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.