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

feat(cli): directly deploy stacks in nested assemblies #14379

Merged
merged 7 commits into from
Apr 29, 2021
Merged

feat(cli): directly deploy stacks in nested assemblies #14379

merged 7 commits into from
Apr 29, 2021

Conversation

otaviomacedo
Copy link
Contributor

This change allows users to address stacks located in nested assemblies, which is the common use case when dealing with pipelines. For example, suppose we have only two stacks, stack1 and stack1/foo/bar, and the second one is in a sub-assembly. The table below shows the behavior of the CLI before and after:

Subcommand Pattern Matched stacks (before) Matched stacks (after)
deploy, destroy, diff, synth ε stack1 stack1
list ε stack1 stack1, stack1/foo/bar
metadata ε
any *, --all stack1 stack1
any ** stack1 stack1, stack1/foo/bar
any stack1/** stack1/foo/bar
any stack1 stack1 stack1
any stack1/foo/bar stack1/foo/bar

where:
ε = empty string (no parameters)
∅ = empty results/error


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 Apr 26, 2021

@github-actions github-actions bot added the package/tools Related to AWS CDK Tools or CLI label Apr 26, 2021
@otaviomacedo otaviomacedo requested a review from rix0rrr April 28, 2021 11:49
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.

I like it!

Two questions:

  • What will the old vs new behavior be of something like:
const app = new App();
const parent = new Construct(app, 'Parent');
const stack = new Stack(parent, 'Stack');

I.e, what if a stack is not at the top-level? Are identifiers people used to use going to have changed? Is it worth pattern matching on either the hierarchical ID or the artifact ID to maintain old behavior there?

And will:

$ cdk deploy --all

Select only top-level stacks, or also stacks from the nested cloud assemblies? If it's the latter, I'm wondering if that behavior change is going to be be dangerous. I will 100% guarantee you that someone, somewhere, has written scripts that rely on the old behavior :(.

EDIT: I guess you answered that already in the README. I just don't see how it works, but maybe it just didn't need a change at all...

@otaviomacedo
Copy link
Contributor Author

what if a stack is not at the top-level? Are identifiers people used to use going to have changed? Is it worth pattern matching on either the hierarchical ID or the artifact ID to maintain old behavior there?

Addressed in the latest commit.

EDIT: I guess you answered that already in the README. I just don't see how it works, but maybe it just didn't need a change at all...

--all and * are synonyms. In minimatch, the pattern * matches "foo" but not "foo/bar", which, in our case, means only top level stacks.

@rix0rrr rix0rrr changed the title feat(cli): Support for addressing stacks in nested assemblies feat(cli): directly deploy stacks in nested assemblies Apr 29, 2021
@mergify
Copy link
Contributor

mergify bot commented Apr 29, 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).

@mergify
Copy link
Contributor

mergify bot commented Apr 29, 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).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

@mergify
Copy link
Contributor

mergify bot commented Apr 29, 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).

@mergify mergify bot merged commit 5a6fa7f into aws:master Apr 29, 2021
john-tipper pushed a commit to john-tipper/aws-cdk that referenced this pull request May 10, 2021
This change allows users to address stacks located in nested assemblies, which is the common use case when dealing with pipelines. For example, suppose we have only two stacks, `stack1` and `stack1/foo/bar`, and the second one is in a sub-assembly. The table below shows the behavior of the CLI before and after:

| **Subcommand**               | **Pattern**    | **Matched stacks (before)** | **Matched stacks (after)** |
|------------------------------|----------------|-----------------------------|----------------------------|
| deploy, destroy, diff, synth | ε              | stack1                      | stack1                     |
| list                         | ε              | stack1                      | stack1, stack1/foo/bar     |
| metadata                     | ε              | ∅                           | ∅                          |
| _any_                        | *, --all       | stack1                      | stack1                     |
| _any_                        | **             | stack1                      | stack1, stack1/foo/bar     |
| _any_                        | stack1/**      | ∅                           | stack1/foo/bar             |
| _any_                        | stack1         | stack1                      | stack1                     |
| _any_                        | stack1/foo/bar | ∅                           | stack1/foo/bar             |

where:
ε = empty string (no parameters)
∅ = empty results/error

----

*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
This change allows users to address stacks located in nested assemblies, which is the common use case when dealing with pipelines. For example, suppose we have only two stacks, `stack1` and `stack1/foo/bar`, and the second one is in a sub-assembly. The table below shows the behavior of the CLI before and after:

| **Subcommand**               | **Pattern**    | **Matched stacks (before)** | **Matched stacks (after)** |
|------------------------------|----------------|-----------------------------|----------------------------|
| deploy, destroy, diff, synth | ε              | stack1                      | stack1                     |
| list                         | ε              | stack1                      | stack1, stack1/foo/bar     |
| metadata                     | ε              | ∅                           | ∅                          |
| _any_                        | *, --all       | stack1                      | stack1                     |
| _any_                        | **             | stack1                      | stack1, stack1/foo/bar     |
| _any_                        | stack1/**      | ∅                           | stack1/foo/bar             |
| _any_                        | stack1         | stack1                      | stack1                     |
| _any_                        | stack1/foo/bar | ∅                           | stack1/foo/bar             |

where:
ε = empty string (no parameters)
∅ = empty results/error

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
njlynch added a commit that referenced this pull request Nov 1, 2021
…semblies

Since #14379, `cdk ls` has outputted friendlier stack names for nested
assemblies (e.g., with pipelines). However, `cdk ls --long` still outputs the
less-friendly stack IDs.
mergify bot pushed a commit that referenced this pull request Nov 2, 2021
…semblies (#17263)

Since #14379, `cdk ls` has outputted friendlier stack names for nested
assemblies (e.g., with pipelines). However, `cdk ls --long` still outputs the
less-friendly stack IDs.

----

*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 Feb 21, 2022
…semblies (aws#17263)

Since aws#14379, `cdk ls` has outputted friendlier stack names for nested
assemblies (e.g., with pipelines). However, `cdk ls --long` still outputs the
less-friendly stack IDs.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package/tools Related to AWS CDK Tools or CLI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants