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

fix(ecr): incorrect format for rule pattern #29243

Merged
merged 5 commits into from
May 3, 2024
Merged

fix(ecr): incorrect format for rule pattern #29243

merged 5 commits into from
May 3, 2024

Conversation

msambol
Copy link
Contributor

@msambol msambol commented Feb 24, 2024

Closes #29225.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@github-actions github-actions bot added star-contributor [Pilot] contributed between 25-49 PRs to the CDK bug This issue is a bug. effort/medium Medium work item – several days of effort p2 labels Feb 24, 2024
@aws-cdk-automation aws-cdk-automation requested a review from a team February 24, 2024 20:01
@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Feb 24, 2024
Copy link
Contributor

@lpizzinidev lpizzinidev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me 👍

@aws-cdk-automation aws-cdk-automation added pr/needs-maintainer-review This PR needs a review from a Core Team Member and removed pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. labels Mar 30, 2024
@scanlonp
Copy link
Contributor

Hey @msambol, just checking if this PR is ready to go, or the rule pattern is still giving you problems with the trigger on the Lambda.

No worries if not, just wanted to check in.

@msambol
Copy link
Contributor Author

msambol commented Apr 11, 2024

Hey @msambol, just checking if this PR is ready to go, or the rule pattern is still giving you problems with the trigger on the Lambda.

No worries if not, just wanted to check in.

The trigger isn't being created but I think we should address that in a separate PR.

@scanlonp
Copy link
Contributor

Maybe I am missing some context. I see from the issue that the rule never matched. Does that mean the lambda trigger was never created, even before this PR?

@msambol
Copy link
Contributor Author

msambol commented Apr 11, 2024

Let me test it out again. When I first worked on this, it didn't. I'll follow up.

@msambol
Copy link
Contributor Author

msambol commented Apr 12, 2024

@scanlonp I just redeployed my integration test again. The EventBridge rule gets created, but the trigger on the Lambda does not get created. Once I manually add the trigger, I can get the Lambda to fire.

@shikha372 shikha372 self-assigned this Apr 18, 2024
@shikha372
Copy link
Contributor

shikha372 commented Apr 22, 2024

@msambol Thank you for your contribution, would like to understand this issue better before reviewing , in the reference docs, resources[] field is not empty always eg. I see it is required for event type Event for a pull through cache action or Event for a completed image scan (basic scanning) .. how are we handling these cases ? let me know if my understanding is not correct

@msambol
Copy link
Contributor Author

msambol commented Apr 22, 2024

@msambol Thank you for your contribution, would like to understand this issue better before reviewing , in the reference docs, resources[] field is not empty always eg. I see it is required for event type Event for a pull through cache action or Event for a completed image scan (basic scanning) .. how are we handling these cases ? let me know if my understanding is not correct

In those cases, we always have detail.repository-name and we can match on those. See here for event pattern matching.

@shikha372
Copy link
Contributor

shikha372 commented Apr 24, 2024

Thank you @msambol , would also like to confirm if there are no issues with lambda trigger when we define the rule using eventbridge rule, I would also test at my end to understand the lambda trigger problem to see we are not impacting any existing functionality for the targets with this change.

@shikha372
Copy link
Contributor

shikha372 commented May 3, 2024

hey @msambol  ,
had a chance to reproduce this today, curious to know is there any specific reason to use bind here? I tried with the following code to register lambda function

const myLambdaHandler = new lambda.Function( stack, 'test', {
  runtime: lambda.Runtime.PYTHON_3_12,
  code: lambda.Code.fromInline('# dummy func'),
  handler: 'index.handler',
});

repoOnEvent.onEvent('OnEventTargetLambda', {
  target: new LambdaFunction(myLambdaHandler),
});

@msambol
Copy link
Contributor Author

msambol commented May 3, 2024

@shikha372 It was so long ago I'm not sure why I did that 🤦🏼‍♂️ Fixed per your recommendation—thanks!

@shikha372
Copy link
Contributor

shikha372 commented May 3, 2024

@shikha372 It was so long ago I'm not sure why I did that 🤦🏼‍♂️ Fixed per your recommendation—thanks!

Thanks, to confirm just ran the integration tests on my local and I can see the lambda trigger too with details as a filter

@msambol
Copy link
Contributor Author

msambol commented May 3, 2024

@shikha372 It was so long ago I'm not sure why I did that 🤦🏼‍♂️ Fixed per your recommendation—thanks!

Thanks, to confirm just ran the integration tests on my local and I can see the lambda trigger too with details as a filter

I see it as well: e457942. Thanks!

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: e9ea30c
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

Copy link
Contributor

mergify bot commented May 3, 2024

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit fff9cf6 into aws:main May 3, 2024
10 checks passed
@aws-cdk-automation aws-cdk-automation removed the pr/needs-maintainer-review This PR needs a review from a Core Team Member label May 4, 2024
@msambol msambol deleted the 29225 branch May 4, 2024 00:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. effort/medium Medium work item – several days of effort p2 star-contributor [Pilot] contributed between 25-49 PRs to the CDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(aws-ecr): ECR EventBridge rule has incorrect event pattern
5 participants