-
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(pipelines): undeployable due to dependency cycle #18686
Conversation
We happily generate templates with dependency cycles. Those would be undeployable in CloudFormation, so we should make it impossible that templates like these pass unit test validation. We could make it a separate assertion method (`Template.fromStack().assertNoCycles()`), but the only thing that will do is give you an opportunity to forget to put the test in. Instead, we just check it by default for every generated template.
@@ -1084,6 +1084,25 @@ describe('Template', () => { | |||
expect(Object.keys(result).length).toEqual(0); | |||
}); | |||
}); | |||
|
|||
test('throws when given a templat with cyclic dependencies', () => { |
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.
*template
// Don't know why this was added in the first place, but I'm disabling it for now and if | ||
// no complaints come from this, we're probably safe to remove it altogether. | ||
// attachment.node.addDependency(this); | ||
Array.isArray(attachment); |
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.
It prevents an "unused variable" error :)
Thank you for contributing! Your pull request will be updated from master 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 master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
/** | ||
* Check a template for cyclic dependencies | ||
* | ||
* This will make sure that we don't happily validate templates | ||
* in unit tests that wouldn't deploy to CloudFormation anyway. | ||
*/ | ||
export function checkTemplateForCyclicDependencies(template: Template): void { |
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.
So cool! 🎉
A dependency cycle was inadvertently introduced to CDK Pipelines in aws#18492. Fix that dependency cycle, and also one in Cognito IdentityPools. Add facilities to the `assertions` library to automatically detect this in the future, to stop errors like this from slipping in. We could make it a separate assertion method (`Template.fromStack().assertNoCycles()`), but the only thing that will do is give you an opportunity to forget to put the test in. Instead, we just check it by default for every generated template. Fixes aws#18673. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
A dependency cycle was inadvertently introduced to CDK Pipelines in #18492.
Fix that dependency cycle, and also one in Cognito IdentityPools.
Add facilities to the
assertions
library to automatically detect this in the future,to stop errors like this from slipping in.
We could make it a separate assertion method
(
Template.fromStack().assertNoCycles()
), but the only thing that willdo is give you an opportunity to forget to put the test in.
Instead, we just check it by default for every generated template.
Fixes #18673.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license