aws / aws/aws-cdk-cli

(watch): `cdk watch` should stop after `synth` and not move to `deploy` if more changes are made during `synth`

Open
#1,448 1 comment 1 reaction 0 assignees View on GitHub
effort/medium feature-request p2
Dominant language
TypeScript
Stars
105
Forks
122
Avg merge
1d 17h
Merged PRs (30d)
71

Description

### Describe the feature

If `Change A` is being queued and starts deployment by the `cdk watch` command, a second change (`Change B`) coming in during that deployment process has to wait for the WHOLE synth + deploy cycle to complete, before `Change B` starts to be deployed. We could easily skip the `deploy` step here and implement a killswitch that skips the `deploy` after the `synth` has completed IF there was another change pushed to the queue during the `synth` phase.

### Use Case

Iterating (live development) on a larger CDK project with multiple Stacks and a large number of resources to be synthesized

### Proposed Solution

When the `cdk watch` command is left running in a terminal, and I make a change inside the project, to oversimplify - it goes through a two-step process: `cdk synth` and `cdk deploy`. Let's assume that for a relatively large project with multiple stacks both of these steps take 1 minute each.

When `cdk watch` starts the process, the whole 2 minutes are pretty much non-interruptable and any chance I make within these 2 minutes are queued and will start deployment exactly 2 minutes after the first change. Assuming I queue a second change at the 25 seconds mark, after the first one started the non-interruptable process - I will have to wait at least 35 seconds more for the two-step process to complete, before the second change starts deploying.

My suggested solution is to quickly check after the `cdk synth` if the deployment (second step) is still valid or is now stale and should be skipped (because another change has been queued). This essentially means that the second change that I did in the 25 seconds mark, will have to wait for just 5 more seconds for the `cdk synth` to complete, and `cdk deploy` will be skipped.

### Other Information

_No response_

### Acknowledgements

- [ ] I may be able to implement this feature request
- [ ] This feature might incur a breaking change

### CDK version used

2.122.0 (build 7e77e02)

### Environment details (OS name and version, etc.)

MacOS

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.