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(events): detailType doesnt allow filtering patterns #30222

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

scub
Copy link
Contributor

@scub scub commented May 15, 2024

Issue # (if applicable)

Closes #30220

Reason for this change

Unable to use content based filtering patterns based on an events detailType using the events.Rule L2 construct without leveraging a trap door

Description of changes

Allow for the usage of content based filtering patterns based on an events detailType

Description of how you validated changes

Overall these are the steps that i've taken:

yarn install
npx lerna run build --scope=aws-cdk-lib
cd packages/aws-cdk-lib
npx yarn test aws-events
npx yarn lint aws-events
npx yarn eslint --fix aws-events/lib/event-pattern.ts aws-events/test/rule.test.ts

# Running integration tests
cd ../../
npx lerna run build --scope=@aws-cdk-testing/framework-integ
cd packages/@aws-cdk-testing/framework-integ
npx yarn integ test/aws-events/test/*.js --update-on-failed

Checklist


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 the beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK label May 15, 2024
@aws-cdk-automation aws-cdk-automation requested a review from a team May 15, 2024 20:30
@github-actions github-actions bot added bug This issue is a bug. p2 labels May 15, 2024
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

@scub
Copy link
Contributor Author

scub commented May 16, 2024

Failing excerpt

API elements with incompatible changes:
err  - IFACE aws-cdk-lib.aws_events.EventPattern: property detailType, Array<Map<string => any> | string> is not assignable to Array<string>, Map<string => any> | string is not assignable to string: type of aws-cdk-lib.aws_codepipeline_actions.ICustomEventRule.eventPattern [weakened:aws-cdk-lib.aws_events.EventPattern]
Some packages seem to have undergone breaking API changes. Please avoid.

[Container] 2024/05/15 20:52:30.121763 Command did not exit successfully /bin/bash ./build.sh --ci exit status 1
[Container] 2024/05/15 20:52:30.125727 Phase complete: BUILD State: FAILED

Based on this I've created some additional tests in the highlighted area above, namely around the use of ICustomEventRule inside of aws-codepipeline-actions.

Additionally i've updated the integration tests for aws-codepipeline-actions/test/integ.pipeline-code-commit-custom-event.ts to include an EventPattern with a content based filter.

The additional steps i've taken are documented below:

cd packages/aws-cdk-lib 
npx yarn test aws-codepipeline-actions
npx yarn lint aws-codepipeline-actions

cd ../../
npx lerna run build --scope=@aws-cdk-testing/framework-integ
cd packages/@aws-cdk-testing/framework-integ
npx yarn integ test/aws-codepipeline-actions/test/*.js --update-on-failed

There doesn't appear to be any regressions from this change in aws-codepipeline-actions based on the available unit or integration tests. Though we still fail during the CodeBuild run, specifically during ./scripts/check-api-compatibility.sh when the following is executed:

npx jsii-diff --keys --ignore-file ./allowed-breaking-changes.txt /tmp/compat-check/node_modules/aws-cdk-lib ./packages/aws-cdk-lib

Admittedly I am at a bit of a loss as to best way to proceed, I don't seem to be able to find this limitation in the CloudFormation or CodeCommit documentation [0][1]. Any help is appreciated, thanks!

[0] https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-rule.html#cfn-events-rule-eventpattern
[1] https://docs.aws.amazon.com/codecommit/latest/userguide/monitoring-events.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK bug This issue is a bug. p2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(events): Unable to use content based filtering patterns in detailType
3 participants