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

(cli): cdk deploy specific-stack should not synthesize all stacks #26421

Closed
Dzhuneyt opened this issue Jul 19, 2023 · 5 comments
Closed

(cli): cdk deploy specific-stack should not synthesize all stacks #26421

Dzhuneyt opened this issue Jul 19, 2023 · 5 comments
Assignees
Labels
@aws-cdk/aws-cloudfront Related to Amazon CloudFront bug This issue is a bug. duplicate This issue is a duplicate. package/tools Related to AWS CDK Tools or CLI response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Comments

@Dzhuneyt
Copy link
Contributor

Describe the bug

When synthesizing or deploying a single stack, CDK synthesizes ALL stacks that are part of the app, regardless of any .addDependency() clauses.

Expected Behavior

I would expect CDK to synthesize only the stack that was requested as well as its direct dependencies.

Current Behavior

CDK synthesizes the whole app, causing a tremendous overhead and bad developer experience.

A typical setup of splitting the stacks by lifecycle:
e.g. Layer 1 - DB stacks, VPC/Networking stacks, Storage stacks
Layer 2 - Compute
Layer 3 - Domains and Certificates and CloudFront related

When working on Layer 2 stuff on a daily basis, one is forced to "wait" for the Layer 1 stacks to be synthesized all the time, considering that they rarely change and I've never requested to deploy them (e.g. I'm only deploying some specific stack from Layer 2).

Reproduction Steps

Create a DB stack
Create an API Gateway stack
Create a stack to hold a bunch of Lambdas
Don't touch the DB or API Gateway stacks
Work on the Lambdas on a daily basis (a typical setup for a lot of companies)
Synthesize and deploy the Lambda stacks
You get a bunch of latency in the whole list of stacks being synthesized

Possible Solution

Propagate the provided stack name to the framework, so CDK can skip the synthesis of skipped stacks

Additional Information/Context

No response

CDK CLI Version

2.43.1 (build c1ebb85)

Framework Version

No response

Node.js Version

18

OS

MacOS

Language

Typescript

Language Version

No response

Other information

No response

@Dzhuneyt Dzhuneyt added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jul 19, 2023
@github-actions github-actions bot added the @aws-cdk/aws-cloudfront Related to Amazon CloudFront label Jul 19, 2023
@Dzhuneyt Dzhuneyt changed the title (cdk): cdk deploy specific-stack should not synthesize all stacks (cli): cdk deploy specific-stack should not synthesize all stacks Jul 19, 2023
@github-actions github-actions bot added the package/tools Related to AWS CDK Tools or CLI label Jul 19, 2023
@khushail
Copy link
Contributor

Hi @Dzhuneyt , thanks for reaching out.
Is this something you are trying to do ?

Skipping synthesis

The cdk deploy command normally synthesizes your app's stacks before deploying to make sure that the deployment reflects the latest version of your app. If you know that you haven't changed your code since your last cdk synth, you can suppress the redundant synthesis step when deploying. To do so, specify your project's cdk.out directory in the --app option.

cdk deploy --app cdk.out StackOne StackTwo

let me know if this doesn't help.

@khushail khushail added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed needs-triage This issue or PR still needs to be triaged. labels Jul 19, 2023
@khushail khushail self-assigned this Jul 19, 2023
@github-actions
Copy link

This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

@github-actions github-actions bot added closing-soon This issue will automatically close in 4 days unless further comments are made. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels Jul 22, 2023
@Dzhuneyt
Copy link
Contributor Author

Dzhuneyt commented Jul 31, 2023

@khushail that's actually a different scenario. What you are describing is:
Skipping synthesis completely and jumping straight to deploy

The issue I describe is:
In a multi-stack environment, synthesize and deploy just specific stack(s) and skip others.

Any chance this issue can be reopened? I missed the time window before GH bot closed it.

@mrgrain mrgrain reopened this Aug 8, 2023
@mrgrain mrgrain added needs-triage This issue or PR still needs to be triaged. and removed response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. labels Aug 8, 2023
@peterwoodworth
Copy link
Contributor

Seems to be a duplicate of this #6743 or this #26589

@peterwoodworth peterwoodworth added duplicate This issue is a duplicate. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed needs-triage This issue or PR still needs to be triaged. labels Aug 9, 2023
@github-actions
Copy link

github-actions bot commented Aug 9, 2023

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-cloudfront Related to Amazon CloudFront bug This issue is a bug. duplicate This issue is a duplicate. package/tools Related to AWS CDK Tools or CLI response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Projects
None yet
Development

No branches or pull requests

4 participants