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: better indicate why a deployment couldn't be hotswapped #22784

Assignees
Labels
effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2 package/tools Related to AWS CDK Tools or CLI

Comments

@echeung-amzn
Copy link

Describe the feature

When attempting a hotswap deployment, it can fail to do so and fallback to a full deployment with a message like:

Could not perform a hotswap deployment, as the stack <YourStackName> contains non-Asset changes
Falling back to doing a full deployment

However, it does not actually indicate what the non-Asset changes are that are preventing a hotswap deployment from working. It can be quite challenging to grok through a stack to narrow down what the issue is.

Since there's already logic to find the non-hotswappable changes, it'd be nice if the CLI either outputted the list of resource by default, or behind a flag.

Use Case

I'd love to use a hotswap deployment to save time when testing changes in a Lambda function's code assets. Having it fallback to full deployments every time introduces a frustrating amount of churn in the development cycle.

Proposed Solution

Perhaps behind a verbose logging flag, be able to list out the non-hotswappable changes when a hotswap deployment is attempted but fails.

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.46.0

Environment details (OS name and version, etc.)

macOS 12.6 but not relevant

@echeung-amzn echeung-amzn added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Nov 4, 2022
@github-actions github-actions bot added the package/tools Related to AWS CDK Tools or CLI label Nov 4, 2022
@peterwoodworth
Copy link
Contributor

We will throw this when we detect a change in the template that is one of

  1. the removal or addition of a resource to the template
  2. a resource had its type changed

If you encounter this error and then run cdk diff you should be able to find one of these quickly. But you're not wrong that we could be printing this information anyway.

I am marking this issue as p2, which means that we are unable to work on this immediately.

We use +1s to help prioritize our work, and are happy to revaluate this issue based on community feedback. You can reach out to the cdk.dev community on Slack to solicit support for reprioritization.

Check out our contributing guide if you're interested in contributing yourself - there's a low chance the team will be able to address this soon but we'd be happy to review a PR 🙂

@peterwoodworth peterwoodworth added p2 effort/small Small work item – less than a day of effort and removed needs-triage This issue or PR still needs to be triaged. labels Nov 4, 2022
@rix0rrr rix0rrr assigned comcalvi and unassigned rix0rrr Jan 5, 2023
@rix0rrr
Copy link
Contributor

rix0rrr commented Jan 5, 2023

@comcalvi is working on something that may also address this, assigning and cc'ing for visibility.

@mergify mergify bot closed this as completed in #23653 Feb 8, 2023
mergify bot pushed a commit that referenced this issue Feb 8, 2023
…fall back if necessary (#23653)

Changes the behavior of `--hotswap` to ignore all non-hotswappable changes and hotswap what it can. This works at two levels: changes to non-hotswappable resources are ignored, as well as non-hotswappable changes to hotswappable resources (eg `Tags` on a Lambda Function).

In addition, non-hotswappable changes are now logged; the logical ID, rejected changes, resource type, and reason why the changes were rejected are all provided for each non-hotswappable change.

At some point, support for tags of lambda functions was added. This either broke or simply never worked, and so this PR removes all logic to handle Tags.

The existing behavior of `--hotswap` can be used in `--hotswap-fallback`. It is preserved and unmodified by this change.

Closes #22784, #21773, #21556, #23640.

----

### All Submissions:

* [x] Have you followed the guidelines in our [Contributing guide?](https:/aws/aws-cdk/blob/main/CONTRIBUTING.md)

### Adding new Construct Runtime Dependencies:

* [ ] This PR adds new construct runtime dependencies following the process described [here](https:/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-construct-runtime-dependencies)

### New Features

* [ ] Have you added the new feature to an [integration test](https:/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
	* [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@github-actions
Copy link

github-actions bot commented Feb 8, 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