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): re-bootstrapping loses previous configuration #10120

Merged
merged 4 commits into from
Sep 2, 2020

Conversation

rix0rrr
Copy link
Contributor

@rix0rrr rix0rrr commented Sep 2, 2020

Various properties of the bootstrapping stack you configured with
switches on the command line would be lost again if you performed
bootstrapping again. This includes:

  • Template parameters such as the qualifier,
    public-access-block-configuration, trust,
    cloudformation-execution-roles.
  • Stack attributes such as termination-protection, tags.

ALSO IN THIS PR

  • In the CLI integ tests, only show the CLI output if the test fails.
    This reduces noise when trying to inspect the causes of a failed test.
  • Some light refactoring (but not too much) of the division of
    responsibilities between BootstrapStack, ToolkitInfo and
    CloudFormationStack.

Fixes #10091.


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

Various properties of the bootstrapping stack you configured with
switches on the command line would be lost again if you performed
bootstrapping again. This includes:

- Template parameters such as the `qualifier`,
  `public-access-block-configuration`, `trust`,
  `cloudformation-execution-roles`.
- Stack attributes such as `termination-protection`, `tags`.

ALSO IN THIS PR

- In the CLI integ tests, only show the CLI output if the test fails.
  This reduces noise when trying to inspect the causes of a failed test.
- Some light refactoring (but not too much) of the division of
  responsibilities between `BootstrapStack`, `ToolkitInfo` and
  `CloudFormationStack`.

Fixes #10091.
@rix0rrr rix0rrr requested a review from a team September 2, 2020 11:54
@rix0rrr rix0rrr self-assigned this Sep 2, 2020
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Sep 2, 2020
@njlynch njlynch added the pr/do-not-merge This PR should not be merged at this time. label Sep 2, 2020
Copy link
Contributor

@njlynch njlynch left a comment

Choose a reason for hiding this comment

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

Looks good. One minor nit, one question/comment.

packages/aws-cdk/lib/api/toolkit-info.ts Outdated Show resolved Hide resolved
Comment on lines +244 to +247
if (argTags === undefined) { return undefined; }
if (argTags.length === 0) { return undefined; }
const nonEmptyTags = argTags.filter(t => t !== '');
if (nonEmptyTags.length === 0) { return []; }
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the input to this function just the input from the cli (cli.ts), or could it also be from an existing stack? I'm trying to wrap my head around if passing the CLI tags through arrayFromYargs would effectively de-dupe this logic.

Copy link
Contributor Author

@rix0rrr rix0rrr Sep 2, 2020

Choose a reason for hiding this comment

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

I know! I wanted to do that originally but the types of doing that don't really work out (string[] vs Tag[] that magically appears out of nowhere and is returned as an any).

It doesn't sit well with me where this parsing is done, but I didn't want to change the existing code too much more because the diff was already growing too large for my tastes.

@rix0rrr rix0rrr removed the pr/do-not-merge This PR should not be merged at this time. label Sep 2, 2020
@mergify
Copy link
Contributor

mergify bot commented Sep 2, 2020

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 Sep 2, 2020

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 4e5829a into master Sep 2, 2020
@mergify mergify bot deleted the huijbers/bootstrap-state branch September 2, 2020 14:54
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 890615c
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

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] Bootstrap always resets existing stack's termination protection to false
3 participants