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

(cli): build+publish all assets used for all selected stacks before deploying any stacks #21511

Closed
1 of 2 tasks
misterjoshua opened this issue Aug 8, 2022 · 1 comment · Fixed by #21513
Closed
1 of 2 tasks
Labels
@aws-cdk/assets Related to the @aws-cdk/assets package effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p1 package/tools Related to AWS CDK Tools or CLI

Comments

@misterjoshua
Copy link
Contributor

misterjoshua commented Aug 8, 2022

Describe the feature

The AWS CDK should support building and publishing all relevant assets from all selected stacks before it deploys anything.

Use Case

When deploying more than one stack at a time, and when these stacks contain docker image assets, docker build can happen after you've already deployed a few stacks. But, docker build can fail for many reasons, including unexpected rate limiting. When this happens, the CDK will deploy some stacks but not all. The CDK could prevent this failure state if it built and published all relevant assets before it deployed anything with CloudFormation.

Proposed Solution

Publishing could be performed before

for (const stack of stacks.stackArtifacts) {
.

Most of the code needed is already in CloudFormationDeployments.publishStackAssets:

private async publishStackAssets(stack: cxapi.CloudFormationStackArtifact, toolkitInfo: ToolkitInfo) {

Other Information

I've opened a PR with the relevant changes to enable this behaviour. #21513

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

CDK version used

2.35.0

Environment details (OS name and version, etc.)

Linux

@misterjoshua misterjoshua added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Aug 8, 2022
@github-actions github-actions bot added the @aws-cdk/assets Related to the @aws-cdk/assets package label Aug 8, 2022
@misterjoshua misterjoshua changed the title (cdk-assets): build+publish all assets used for all selected stacks before deploying any stacks (cli): build+publish all assets used for all selected stacks before deploying any stacks Aug 8, 2022
@github-actions github-actions bot added the package/tools Related to AWS CDK Tools or CLI label Aug 8, 2022
@rix0rrr rix0rrr added effort/small Small work item – less than a day of effort p2 and removed needs-triage This issue or PR still needs to be triaged. labels Aug 10, 2022
@rix0rrr rix0rrr removed their assignment Aug 10, 2022
@otaviomacedo otaviomacedo removed their assignment Aug 10, 2022
@kaizencc kaizencc added p1 and removed p2 labels Aug 15, 2022
@mergify mergify bot closed this as completed in #21513 Aug 19, 2022
mergify bot pushed a commit that referenced this issue Aug 19, 2022
Changes the CDK CLI to build assets before deploying any stacks. This allows the CDK CLI to catch docker build errors, such as from rate limiting, before any stacks are deployed. Moving asset builds this early prevents these build failures from interrupting multi-stack deployments part way through. 

Fixes #21511

----

### All Submissions:

* [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)

### Adding new Unconventional Dependencies:

* [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies)

### New Features

* [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
	* [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

josephedward pushed a commit to josephedward/aws-cdk that referenced this issue Aug 30, 2022
Changes the CDK CLI to build assets before deploying any stacks. This allows the CDK CLI to catch docker build errors, such as from rate limiting, before any stacks are deployed. Moving asset builds this early prevents these build failures from interrupting multi-stack deployments part way through. 

Fixes aws#21511

----

### All Submissions:

* [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)

### Adding new Unconventional Dependencies:

* [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies)

### New Features

* [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
	* [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?

*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
@aws-cdk/assets Related to the @aws-cdk/assets package effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p1 package/tools Related to AWS CDK Tools or CLI
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants