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

fix(cli): 'deploy' and 'diff' silently does nothing when given unknown stack name #16073

Merged
merged 3 commits into from
Aug 18, 2021
Merged

fix(cli): 'deploy' and 'diff' silently does nothing when given unknown stack name #16073

merged 3 commits into from
Aug 18, 2021

Conversation

kaizencc
Copy link
Contributor

@kaizencc kaizencc commented Aug 16, 2021

Currently, cdk deploy and cdk diff on stacks that do not exist return no output on the command line. This PR introduces a descriptive error message for those cases so it is easier to understand what happened.

Leaving the idea of fuzzy matching for stack name suggestions to a (potential) future PR, I can open a new issue for that if this one goes through.

For the linter, I'm not sure if anything of value can be added to the readme so I'm wondering if this would be a candidate for exemption.

closes #15866 while adding the same idea to diff as well as deploy.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@gitpod-io
Copy link

gitpod-io bot commented Aug 16, 2021

@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Aug 16, 2021
@kaizencc kaizencc requested a review from rix0rrr August 16, 2021 21:33
@kaizencc kaizencc self-assigned this Aug 16, 2021
@rix0rrr rix0rrr added the pr/do-not-merge This PR should not be merged at this time. label Aug 18, 2021
Copy link
Contributor

@rix0rrr rix0rrr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Provisional approval, if you do a small refactor.

Also, about the subject line of the PR: this will go into the CHANGELOG, so think about how a customer reading the CHANGELOG will think about this change.

I would classify it as a bugfix, and if it's a bugfix we generally describe the issue that we fixed. So I would name it something like:

fix(cli): silently does nothing when given unknown stack name

Or something to that effect.

@@ -435,7 +435,11 @@ export class CdkToolkit {
/**
* Validate the stacks for errors and warnings according to the CLI's current settings
*/
private async validateStacks(stacks: StackCollection) {
private async validateStacks(stacks: StackCollection, stackNames: string[]) {
if (stacks.stackCount == 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with this check, but I think it should not be part of this function. Validating that there are stacks is not what this function is doing (it's checking stack metadata).

How about adding a new function?

function validateStacksSelected(stacks: StackCollection, stackNames: string[]);

Or something?

@kaizencc kaizencc changed the title feat(cli): send error message when attempting to deploy/diff on stacks that do not exist fix(cli): 'deploy' and 'diff' silently does nothing when given unknown stack name Aug 18, 2021
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject89A8053A-LhjRyN9kxr8o
  • Commit ID: 76a219a
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@kaizencc kaizencc removed the pr/do-not-merge This PR should not be merged at this time. label Aug 18, 2021
@mergify mergify bot merged commit f35b032 into aws:master Aug 18, 2021
@mergify
Copy link
Contributor

mergify bot commented Aug 18, 2021

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

kaizencc added a commit that referenced this pull request Aug 18, 2021
mergify bot pushed a commit that referenced this pull request Aug 19, 2021
…nown stack name (#16125)

Broke integration tests when `synth`ing without providing a stack name

reverts #16073
smguggen pushed a commit to smguggen/aws-cdk that referenced this pull request Aug 24, 2021
…n stack name (aws#16073)

Currently, `cdk deploy` and `cdk diff` on stacks that do not exist return no output on the command line. This PR introduces a descriptive error message for those cases so it is easier to understand what happened.

Leaving the idea of fuzzy matching for stack name suggestions to a (potential) future PR, I can open a new issue for that if this one goes through.

For the linter, I'm not sure if anything of value can be added to the readme so I'm wondering if this would be a candidate for exemption.

closes aws#15866 while adding the same idea to `diff` as well as `deploy`.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
smguggen pushed a commit to smguggen/aws-cdk that referenced this pull request Aug 24, 2021
…nown stack name (aws#16125)

Broke integration tests when `synth`ing without providing a stack name

reverts aws#16073
hollanddd pushed a commit to hollanddd/aws-cdk that referenced this pull request Aug 26, 2021
…n stack name (aws#16073)

Currently, `cdk deploy` and `cdk diff` on stacks that do not exist return no output on the command line. This PR introduces a descriptive error message for those cases so it is easier to understand what happened.

Leaving the idea of fuzzy matching for stack name suggestions to a (potential) future PR, I can open a new issue for that if this one goes through.

For the linter, I'm not sure if anything of value can be added to the readme so I'm wondering if this would be a candidate for exemption.

closes aws#15866 while adding the same idea to `diff` as well as `deploy`.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
hollanddd pushed a commit to hollanddd/aws-cdk that referenced this pull request Aug 26, 2021
…nown stack name (aws#16125)

Broke integration tests when `synth`ing without providing a stack name

reverts aws#16073
TikiTDO pushed a commit to TikiTDO/aws-cdk that referenced this pull request Sep 6, 2021
…n stack name (aws#16073)

Currently, `cdk deploy` and `cdk diff` on stacks that do not exist return no output on the command line. This PR introduces a descriptive error message for those cases so it is easier to understand what happened.

Leaving the idea of fuzzy matching for stack name suggestions to a (potential) future PR, I can open a new issue for that if this one goes through.

For the linter, I'm not sure if anything of value can be added to the readme so I'm wondering if this would be a candidate for exemption.

closes aws#15866 while adding the same idea to `diff` as well as `deploy`.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
TikiTDO pushed a commit to TikiTDO/aws-cdk that referenced this pull request Sep 6, 2021
…nown stack name (aws#16125)

Broke integration tests when `synth`ing without providing a stack name

reverts aws#16073
david-doyle-as24 pushed a commit to david-doyle-as24/aws-cdk that referenced this pull request Sep 7, 2021
…n stack name (aws#16073)

Currently, `cdk deploy` and `cdk diff` on stacks that do not exist return no output on the command line. This PR introduces a descriptive error message for those cases so it is easier to understand what happened.

Leaving the idea of fuzzy matching for stack name suggestions to a (potential) future PR, I can open a new issue for that if this one goes through.

For the linter, I'm not sure if anything of value can be added to the readme so I'm wondering if this would be a candidate for exemption.

closes aws#15866 while adding the same idea to `diff` as well as `deploy`.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
david-doyle-as24 pushed a commit to david-doyle-as24/aws-cdk that referenced this pull request Sep 7, 2021
…nown stack name (aws#16125)

Broke integration tests when `synth`ing without providing a stack name

reverts aws#16073
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution/core This is a PR that came from AWS.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CLI: give an error message and return 1 when trying to deploy a non-existent stack
3 participants