Skip to content

Conversation

@rix0rrr
Copy link
Contributor

@rix0rrr rix0rrr commented Mar 27, 2020

Sorry for another monster commit :(

If desired I will try to send some effort next week trying to split it.

Commit Message

More CLI refactorings in preparation for "convention mode" deployments.

  • Move remaining routines from cdk.ts (the main() function) into the CdkToolkit class so that the implementation of all CLI functionality lives in the same place.
  • ISDK now can be interrogated about its "current" account/region (which are different from the SdkProviders "default" account/region).
  • Split AppStacks into 2 distinct classes: CloudExecutable, responsible for producing a CloudAssembly, which contains routines for operating upon the cloud assembly (selecting stacks, processing error messages).
  • Get rid of many repeated low-level CloudFormation DescribeStacks (et. al.) API calls by folding them into a CloudFormationStack object which contains (and can be interrogated about) the state of a deployed stack.
  • CloudFormation parameters: treat parameters as a map of string->string for as long as possible, translating only to API objects at the very last moment. This simplifies functions dealing with CloudFormation parameters all-around.
  • Get rid of the premature abstraction of class CloudFormationTarget implements IDeploymentTarget, demote it to a simple CloudFormation helper class called CloudFormationDeployments (its responsibilities are pretty weak right now and it could probably be removed, but for now I didn't do that).
  • Turn loadToolkitInfo into ToolkitInfo.lookup() which is a nice idiom we should be using in more places.

End Commit Message


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

More CLI refactorings in preparation for "convention mode" deployments.

* Move remaining routines from `cdk.ts` (the `main()` function) into the `CdkToolkit` class so that the implementation of all CLI functionality lives in the same place.
* `ISDK` now can be interrogated about its "current" account/region (which are different from the `SdkProvider`s "default" account/region).
* Split `AppStacks` into 2 distinct classes: `CloudExecutable`, responsible for producing a `CloudAssembly`, which contains routines for operating upon the cloud assembly (selecting stacks, processing error messages).
* Get rid of many repeated low-level CloudFormation `DescribeStacks` (et. al.) API calls by folding them into a `CloudFormationStack` object which contains (and can be interrogated about) the state of a deployed stack.
* CloudFormation parameters: treat parameters as a map of string->string for as long as possible, translating only to API objects at the very last moment. This simplifies functions dealing with CloudFormation parameters all-around.
* Get rid of the premature abstraction of `class CloudFormationTarget implements IDeploymentTarget`, demote it to a simple CloudFormation helper class called `CloudFormationDeployments` (its responsibilities are pretty weak right now and it could probably be removed, but for now I didn't do that).
* Turn `loadToolkitInfo` into `ToolkitInfo.lookup()` which is a nice idiom we should be using in more places.
@rix0rrr rix0rrr requested review from eladb, shivlaks and skinny85 March 27, 2020 16:20
@rix0rrr rix0rrr self-assigned this Mar 27, 2020
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Mar 27, 2020
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

@rix0rrr rix0rrr requested a review from NetaNir March 30, 2020 13:06
@skinny85 skinny85 added the pr/do-not-merge This PR should not be merged at this time. label Mar 31, 2020
Copy link
Contributor

@skinny85 skinny85 left a comment

Choose a reason for hiding this comment

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

I am OK with this. I don't feel like I have enough knowledge of this part of the codebase to comment much on the specifics.

I've added the 'do not automatically merge' label to give the other reviewers a chance to chime in.

Copy link
Contributor

@shivlaks shivlaks 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 to me... a few minor things and some questions around things you've touched but not necessarily changed :)

@rix0rrr rix0rrr requested a review from shivlaks April 2, 2020 14:34
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: ab7c1a9
  • Result: FAILED
  • Build Logs (available for 30 days)

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

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

Copy link
Contributor

@shivlaks shivlaks left a comment

Choose a reason for hiding this comment

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

I'm good with this round of refactoring. Apologies in advance as you'll likely have to merge in the stack outputs changes :)

@rix0rrr
Copy link
Contributor Author

rix0rrr commented Apr 3, 2020

The build timed out :(

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 4cce3fc
  • Result: FAILED
  • Build Logs (available for 30 days)

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

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

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

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

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 963a77b
  • 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 3, 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).

1 similar comment
@mergify
Copy link
Contributor

mergify bot commented Apr 3, 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 95ab44b into master Apr 3, 2020
@mergify mergify bot deleted the huijbers/refactor-cli branch April 3, 2020 11:58
rix0rrr added a commit that referenced this pull request May 5, 2020
The automatic parameter reuse which was introduced in #7041 has been
causing issues for some people who use Default Values to classify
between CI/CD deployments and CLI deployments (value supplied=CI/CD,
value default=CLI).

Introduce a switch to turn it off.
mergify bot pushed a commit that referenced this pull request May 6, 2020
The automatic parameter reuse which was introduced in #7041 has been
causing issues for some people who use Default Values to classify
between CI/CD deployments and CLI deployments (value supplied=CI/CD,
value default=CLI).

Introduce a switch to turn it off.
karupanerura pushed a commit to karupanerura/aws-cdk that referenced this pull request May 7, 2020
The automatic parameter reuse which was introduced in aws#7041 has been
causing issues for some people who use Default Values to classify
between CI/CD deployments and CLI deployments (value supplied=CI/CD,
value default=CLI).

Introduce a switch to turn it off.
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.

4 participants