Skip to content

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

@misterjoshua

Description

@misterjoshua

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/assetsRelated to the @aws-cdk/assets packageeffort/smallSmall work item – less than a day of effortfeature-requestA feature should be added or improved.p1package/toolsRelated to AWS CDK Tools or CLI

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions