-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
feat(codepipeline): use a special bootstrapless synthesizer for cross-region support Stacks #8091
feat(codepipeline): use a special bootstrapless synthesizer for cross-region support Stacks #8091
Conversation
Hey Rico, this is a draft of the solution to #8082 . I'm putting it as a draft, as I have 2 remaining questions:
{
"version": "0.0.0",
"files": {
"4a751a2697187d165e0f7e6be2e8b8ae26fd67588a03cc3d88b673618201c552": {
"source": {
"path": "CrossRegionAndAccountCfnPipelineStack-support-eu-central-1.template.json",
"packaging": "file"
},
"destinations": {
"828671620168-eu-central-1": {
"bucketName": "cdk-hnb659fds-assets-828671620168-us-west-2",
"objectKey": "4a751a2697187d165e0f7e6be2e8b8ae26fd67588a03cc3d88b673618201c552",
"region": "eu-central-1",
"assumeRoleArn": "arn:${AWS::Partition}:iam::828671620168:role/cdk-hnb659fds-publishing-role-828671620168-us-west-2"
}
}
}
},
"dockerImages": {}
} is correct (the bucket is
|
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
In fact I think a custom subclass might make more sense. For example, this stack needs to be deployable without a bucket in the target location (as you already noted), so it definitely can't support assets. So I'm thinking of a subclass that'll throw when addFileAsset or addDockerAsset are called. I did write that in the original ticket, though only in passing:
Not supporting assets also means that is should also not "upload its own template" the way the default synthesizer does. It can be like the legacy synthesizer in that way, and basically not do anything special there -- the CLI will ultimately deploy the template. Another restriction we could encode into the synthesizer is, since we know it needs to be deployable without a bootstrap environment, the template itself needs to be <40k (or whatever the size limit is again), so that it goes into one CFN call. Maybe the specific subclass needs to be a |
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.
See el above-o
That's exactly why I wanted to post this quickly as a draft, this is great Rico! I'm not sure about this part though:
I wonder why you want to put it in |
50d903f
to
4eb2637
Compare
@rix0rrr submitted a new version. The result that I now see (with my manual test) is: "CrossRegionAndAccountCfnPipelineStack-support-eu-central-1": {
"type": "aws:cloudformation:stack",
"environment": "aws://828671620168/eu-central-1",
"properties": {
"templateFile": "CrossRegionAndAccountCfnPipelineStack-support-eu-central-1.template.json",
"assumeRoleArn": "arn:${AWS::Partition}:iam::828671620168:role/cdk-hnb659fds-deploy-role-828671620168-us-west-2",
"cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::828671620168:role/cdk-hnb659fds-cfn-exec-role-828671620168-us-west-2",
"requiresBootstrapStackVersion": 1
},
}, And there is no Let me know if this version makes sense, and if "yes", I'll add unit tests for it. |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Yep, I believe that looks good. |
packages/@aws-cdk/core/lib/stack-synthesizers/default-synthesizer.ts
Outdated
Show resolved
Hide resolved
packages/@aws-cdk/core/lib/stack-synthesizers/default-synthesizer.ts
Outdated
Show resolved
Hide resolved
packages/@aws-cdk/core/lib/stack-synthesizers/default-synthesizer.ts
Outdated
Show resolved
Hide resolved
packages/@aws-cdk/core/lib/stack-synthesizers/default-synthesizer.ts
Outdated
Show resolved
Hide resolved
public synthesizeStackArtifacts(session: ISynthesisSession): void { | ||
assertBound(this.stack); | ||
|
||
// do _not_ treat the template as an asset, |
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.
Probably worth doing a size check on the template here as well.
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.
Can we do it as a quick follow-up to this issue? <bats eyelashes>
@@ -71,6 +71,8 @@ export interface CrossRegionSupportStackProps { | |||
* @example '012345678901' | |||
*/ | |||
readonly account: string; | |||
|
|||
readonly synthesizer: cdk.IStackSynthesizer | undefined; |
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.
Using a ?
is the more usual way we express that.
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.
Yes, but I actually wanted to make the synthesizer
a required property.
I don't think it matters much, this is all private to the codepipeline
module anyway.
…-region support Stacks Fixes aws#8082
4eb2637
to
0c3c530
Compare
@rix0rrr included your comments, and added a unit test. This is now ready to graduate from a draft PR. Let me know if you have any more comments! |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
*/ | ||
export interface BootstraplessSynthesizerProps { | ||
/** The deploy Role ARN to use. */ | ||
readonly deployRoleArn: string; |
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.
I think make these optional and you've got yourself an approved!
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). |
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). |
Fixes #8082
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license