(CodePipeline): use source S3 trigger without cloudtrail
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### Describe the bug
when using CodePipeline with S3 source:
```
const pipeline = new CodePipeline(this, `Pipeline-dev`, {
selfMutation: true,
pipelineName,
synth: new CodeBuildStep('Synth', {
input: CodePipelineSource.s3(sourceBucket, artifactZipName, {
trigger: S3Trigger.EVENTS
}),
```
the template generated contains the following EventBridge rule:
```
{
"detail-type": ["AWS API Call via CloudTrail"],
"source": ["aws.s3"],
"detail": {...
```
This event pattern is not triggered since the source is wrong. Contacting AWS Support, they told us we need to use the following event source instead:
`"eventSource": ["s3.amazonaws.com"]`
As also mentioned in this documentation https://docs.aws.amazon.com/codepipeline/latest/userguide/create-cloudtrail-S3-source-console.html
Even after upgrading CDK to the latest version, the event source is still not created correctly.
### Expected Behavior
Generate template with correct event source for S3 triggered CodePipeline source:
`"eventSource": ["s3.amazonaws.com"]`
### Current Behavior
Template is generated with wrong source for S3 triggered CodePipeline source:
`"source": ["aws.s3"]`
### Reproduction Steps
use a simple CodePipeline as described here
https://cdkworkshop.com/20-typescript/70-advanced-topics/200-pipelines/3000-new-pipeline.html
and use S3 as source instead, with event based trigger
https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.pipelines.CodePipelineSource.html#static-s3bucket-objectkey-props
### Possible Solution
_No response_
### Additional Information/Context
_No response_
### CDK CLI Version
2.50.0 (build 4c11af6)
### Framework Version
2.50.0
### Node.js Version
16.17.0
### OS
Windows 10
### Language
Typescript
### Language Version
TypeScript (4.6.4)
### Other information
_No response_
Contributor guide
Research direction
Start with the CodePipelineSource.s3 entry point and reproduce the issue using a simple pipeline with an S3 source and event-based trigger. Inspect the generated EventBridge rule; done means its event pattern uses eventSource ["s3.amazonaws.com"] rather than source ["aws.s3"].
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- ci-cd, cloud, devops
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100