-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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(scheduler-targets-alpha): create a role per target instead of singleton schedule target role #31895
Conversation
23306b4
to
8e5659a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.
A comment requesting an exemption should contain the text Exemption Request
. Additionally, if clarification is needed add Clarification Request
to a comment.
bd4cfc4
to
e8f20c4
Compare
e8f20c4
to
564ae30
Compare
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
@@ -38,8 +39,8 @@ const message = integ.assertions.awsApiCall('SQS', 'receiveMessage', { | |||
// Verifies that expected message is received from the queue | |||
message.assertAtPath( | |||
'Messages.0.Body', | |||
ExpectedResult.exact(payload), | |||
ExpectedResult.stringLikeRegexp(payload), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I ran this test with exact
it would fail the assertion. From logs:
INFO Testing equality between "test" and "{\"$Exact\":\"test\"}"
INFO Assertion Failed:
{
"failed": true,
"assertion": "{\"status\":\"fail\",\"message\":\"!! Expected type object but received string\\n\\\"test\\\"\"}"
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the logs, it sounds like the message in the queue is the text test
, as expected. I wonder if the assertion logic is correct. Can you verify if the message in the queue is indeed test
(without quotes)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After looking into this further, I believe ExpectedResult.exact
is not fully implemented (code).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thank you
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). |
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). |
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). |
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). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
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). |
Comments on closed issues and PRs are hard for our team to see. |
Issue # (if applicable)
Tracking #31785.
Reason for this change
The current logic for creating a schedule target execution role uses a hash on the
targetArn
to determine if there is an existing role in the stack. Currently if thetargetArn
contains token values (e.g. intrinsic functions),stack.resolve(targetArn).toString()
is used to convert the tokenized ARN into a string. However this always results in[object Object]
which then gets hashed, meaning the same role is used for any target where the ARN passed in is not a pure string. This does not follow principle of least privilege, and a singleton role used across multiple different targets/target types can be confusing for the customer to manage.Description of changes
JSON.stringify()
instead of.toString()
to produce unique hash (and thus create new role) per target.Description of how you validated changes
Updated unit tests and integration tests
Checklist
BREAKING CHANGE: Schedule Target will reuse role if target is re-used across schedules. This change triggered replacement of existing roles for Schedule as logical ID of the roles are changed.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license