-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Event Rule for CodePipeline S3 Source Action Missing Event Names #4634
Comments
In addition to 'PutObject', also match on event names, 'CopyObject' and 'CompleteMultipartUpload'; otherwise the Pipeline does not trigger when files are uploaded using those APIs. E.g., CodeBuild output is uploaded using the multipart API. fixes aws#4634
Thanks for reporting @njlaw . I think the issue is actually in the S3 library: the While we're in the area, we should fix the docs on this method -- they're pretty clearly copy-pasted from ECR's Re-assigning to S3 and @eladb . |
Thanks for the follow up @skinny85 . One hiccup came up when I was testing solutions for this. It looks like it won't be as simple as changing the Event Rule to
since this ends up matching on copies from the S3 bucket to another bucket as well. At least under some conditions CodePipeline itself uses CopyObject to copy the source from the source bucket to the artifact bucket, resulting in an infinite loop triggering the CodePipeline. I'm playing with rule combinations that may work and will post an update here when I figure something out. |
But |
I've confirmed that the following Event Rule works correctly for CopyObject. It triggers only when the object is copied to the bucket/key and not from it.
What do you think about changing If you think it would be helpful, I'm happy to try putting together a pull request for this; otherwise, I can leave it in yours and @eladb 's hands. |
In addition to 'PutObject', also match on event names, 'CopyObject' and 'CompleteMultipartUpload'; otherwise the Pipeline does not trigger when files are uploaded using those APIs. E.g., CodeBuild output is uploaded using the multipart API. fixes aws#4634
In addition to 'PutObject', also match on event names, 'CopyObject' and 'CompleteMultipartUpload'; otherwise the Pipeline does not trigger when files are uploaded using those APIs. E.g., CodeBuild output is uploaded using the multipart API. fixes aws#4634
In addition to 'PutObject', also match on event names, 'CopyObject' and 'CompleteMultipartUpload'; otherwise the Pipeline does not trigger when files are uploaded using those APIs. E.g., CodeBuild output is uploaded using the multipart API. fixes aws#4634
In addition to 'PutObject', also match on event names, 'CopyObject' and 'CompleteMultipartUpload'; otherwise the Pipeline does not trigger when files are uploaded using those APIs. E.g., CodeBuild output is uploaded using the multipart API. fixes aws#4634
Thanks for the research @njlaw . But I don't think we need a new method here. In my opinion, @eladb do you agree? |
Absolutely! |
@skinny85 why did you assign this to me? |
Because this needs to be changed in the S3 library, like (I thought) we agreed to in this comment? |
@eladb the (cc @skinny85) the s3 bucket lib needs to be updated to accommodate the desire of
There are two changes that need to happen to make this happen.
1 Updated onCloudTrailPutObject EventPattern
to
2 Updated onCloudTrailEvent EventPattern
to... something like
This issue blocked me from using |
@joekiller 's post brought something to mind and made me revisit the rules. I had assumed that we would need two separate rules:
However, it appears that the requestParameters should be valid for all three event types, which means that a single rule should work. I'll update my fork and test it to verify it works. Any suggestions for a name for the Bucket.onCloudTrailPutObject method? 'PutObject' implies that it is specific to that event name, but if that's the convention for cdk, I'll leave it and just note in the documentation that it matches on PutObject, CopyObject, and CompleteMultipartUpload. |
In addition to 'PutObject', also match on event names, 'CopyObject' and 'CompleteMultipartUpload'; otherwise the Pipeline does not trigger when files are uploaded using those APIs. E.g., CodeBuild output is uploaded using the multipart API. fixes aws#4634
I think |
In addition to 'PutObject', also match on event names, 'CopyObject' and 'CompleteMultipartUpload'; otherwise the Pipeline does not trigger when files are uploaded using those APIs. E.g., CodeBuild output is uploaded using the multipart API. fixes aws#4634
In addition to 'PutObject', also match on event names, 'CopyObject' and 'CompleteMultipartUpload'; otherwise the Pipeline does not trigger when files are uploaded using those APIs. E.g., CodeBuild output is uploaded using the multipart API. fixes aws#4634
In addition to 'PutObject', onCloudTrailPutObject() should also match on event names 'CopyObject' and 'CompleteMultipartUpload'; otherwise the event does not trigger when files are uploaded using those APIs. E.g., larger files are uploaded using the multipart API. fixes aws#4634
In addition to 'PutObject', onCloudTrailPutObject() should also match on event names 'CopyObject' and 'CompleteMultipartUpload'; otherwise the event does not trigger when files are uploaded using those APIs. E.g., larger files are uploaded using the multipart API. fixes aws#4634
I've gone ahead and created a pull request for this, keeping the method name as PS. I've also learned that I should not use the [Edited to change 'should' to 'should not'] |
Sorry, I'm new to this... I missed the unit tests for |
* fix(s3): rule should match all update events In addition to 'PutObject', onCloudTrailPutObject() should also match on event names 'CopyObject' and 'CompleteMultipartUpload'; otherwise the event does not trigger when files are uploaded using those APIs. E.g., larger files are uploaded using the multipart API. fixes #4634 * added unit tests removed unnecessary integration tests * update expected cfn output for integ * new method for matching object writes * use new method to match write events
The current CloudWatch Event created for CodePipeline S3SourceAction only matches on the event name
PutObject
to trigger the event. However, there are other actions that can update the object in the S3 bucket that should trigger this event. E.g., in the CloudPipeline user guide, the example event rule matches onPutObject
,CopyObject
, andCompleteMultipartUpload
.As a specific example, I have a CodeBuild project (not in a pipeline) that outputs its artifact to S3. It does this using a multipart upload, so the pipeline that uses this as the source never triggers.
Reproduction Steps
Error Log
There is no error message. In the CloudWatch CloudTrail logs, you see the
CompleteMultipartUpload
event, but obviously this does not trigger the Pipeline since the event rule that is generated does not match on it.Environment
Other
I'll submit a pull request for this.
This is 🐛 Bug Report
The text was updated successfully, but these errors were encountered: