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): cdk deploy --method=direct is faster #22079

Merged
merged 6 commits into from
Sep 22, 2022
Merged

Conversation

rix0rrr
Copy link
Contributor

@rix0rrr rix0rrr commented Sep 16, 2022

CloudFormation changeset creation may take up a significant amount of time in a deployment, and isn't necessary anymore since the AUTO_EXPAND capability has been added.

Add a new command-line option, cdk deploy --method=direct which skips changeset creation and provides faster deployments (6-15 seconds, dependending on the complexity of the change set).

This comes at the expense of being able to provide progress information, since we won't know how many resources will need to be updated anymore before we start.

This feature is opt-in until we can establish that it's safe and desirable in all cases, but it can be made the default for your shell by putting:

export CDK_METHOD=direct

In your shell initialization script.


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

CloudFormation changeset creation may take up a significant amount of
time in a deployment, and isn't necessary anymore since the
`AUTO_EXPAND` capability has been added.

Add a new command-line option, `cdk deploy --method=direct` which
skips changeset creation and provides faster deployments (6-15 seconds,
dependending on the complexity of the change set).

This comes at the expense of being able to provide progress information,
since we won't know how many resources will need to be updated anymore
before we start.

This feature is opt-in until we can establish that it's safe and
desirable in all cases, but it can be made the default for your shell
by putting:

```
export CDK_METHOD=direct
```

In your shell initialization script.
@rix0rrr rix0rrr requested a review from a team September 16, 2022 15:27
@rix0rrr rix0rrr self-assigned this Sep 16, 2022
@gitpod-io
Copy link

gitpod-io bot commented Sep 16, 2022

@github-actions github-actions bot added the p2 label Sep 16, 2022
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Sep 16, 2022
@aws-cdk-automation aws-cdk-automation requested a review from a team September 16, 2022 15:27
Copy link
Contributor

@corymhall corymhall left a comment

Choose a reason for hiding this comment

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

Looks pretty cool!

This feature is opt-in until we can establish that it's safe and desirable in all cases, but it can be made the default for your shell by putting:
export CDK_METHOD=direct
In your shell initialization script.

You mention this in the PR description, but I don't see it implemented anywhere. Can you update the description if this was dropped?

Just for my own benefit I'm curious what changed with AUTO_EXPAND (CAPABILITY_AUTO_EXPAND?) that made this possible?

@corymhall corymhall added the pr/do-not-merge This PR should not be merged at this time. label Sep 21, 2022
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

The Pull Request Linter fails with the following errors:

❌ Features must contain a change to an integration test file and the resulting snapshot.

PRs must pass status checks before we can provide a meaningful review.

@rix0rrr rix0rrr added the pr-linter/exempt-integ-test The PR linter will not require integ test changes label Sep 21, 2022
@rix0rrr
Copy link
Contributor Author

rix0rrr commented Sep 21, 2022

You mention this in the PR description, but I don't see it implemented anywhere. Can you update the description if this was dropped?

yargs implements this for us

Just for my own benefit I'm curious what changed with AUTO_EXPAND (CAPABILITY_AUTO_EXPAND?) that made this possible?

Apparently (according to James) it was always possible.

@github-actions github-actions bot dismissed their stale review September 21, 2022 19:10

Pull Request updated. Dissmissing previous PRLinter Review.

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

mergify bot commented Sep 22, 2022

Thank you for contributing! Your pull request will be updated from main 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: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 3c95954
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@mergify mergify bot merged commit dd6ead4 into main Sep 22, 2022
@mergify mergify bot deleted the huijbers/direct-deploy branch September 22, 2022 10:19
@mergify
Copy link
Contributor

mergify bot commented Sep 22, 2022

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@corymhall
Copy link
Contributor

yargs implements this for us

🤯

@alexpulver
Copy link
Contributor

@rix0rrr @corymhall looking at CreateStack documentation, CAPABILITY_AUTO_EXPAND is only relevant for templates containing macros (e.g. AWS::Include and AWS::Serverless transforms) and templates that contain macros and nested stacks. The pull request description sounds like CAPABILITY_AUTO_EXPAND is the reason to use the direct option. My understanding it is the enabler for the direct option.

Do I understand correctly that his pull request is not as much about CAPABILITY_AUTO_EXPAND as it is about the ability to skip the creation of the change set? Meaning that the AWS CDK Toolkit will always acknowledge CAPABILITY_AUTO_EXPAND when using direct option, to cover for the aforementioned use cases that require it. Is that correct?

homakk pushed a commit to homakk/aws-cdk that referenced this pull request Dec 1, 2022
CloudFormation changeset creation may take up a significant amount of time in a deployment, and isn't necessary anymore since the `AUTO_EXPAND` capability has been added.

Add a new command-line option, `cdk deploy --method=direct` which skips changeset creation and provides faster deployments (6-15 seconds, dependending on the complexity of the change set).

This comes at the expense of being able to provide progress information, since we won't know how many resources will need to be updated anymore before we start.

This feature is opt-in until we can establish that it's safe and desirable in all cases, but it can be made the default for your shell by putting:

```
export CDK_METHOD=direct
```

In your shell initialization script.

----

*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
contribution/core This is a PR that came from AWS. p2 pr-linter/exempt-integ-test The PR linter will not require integ test changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants