Skip to content

aws-cdk: Asset publishing failure does not stop stack deployments (which results in a runtime failure in CloudFormation) #26048

@iancaffey

Description

@iancaffey

Describe the bug

Failures encountered while publishing assets (e.g. failures when executing the source.executable in a DockerImageAsset) do not stop the CLI from continuing with the stack deployment.

This results in a CloudFormation deployment that eventually fails, due to not being able to find the asset (as it was never published).

Expected Behavior

cdk deploy should not proceed with stack deployments unless all stack assets have published successfully.

Current Behavior

CDK deploy continues normally with the deployment.

For example (these logs are heavily redacted, but hopefully demonstrate the point clearly),

[18:29:06] {stack name}:  build: Building Docker image using command '{docker exe}'
...
//docker executable runs, emitting all its output logs, which clear show failures, and the process exits with a non-zero code (4)
[18:31:06] Reading existing template for stack {stack name}
...
//prompts the user, if making any changes, like any normal deployment
...
{stack id} ({stack name}): deploying... [1/1]

Reproduction Steps

It'd take awhile for me to setup a self-contained replica of the current scenario.

Might be easy to force with a "fake" DockerImageAsset in a simple CDK stack where the asset's source executable just exits immediately with a non-zero exit code.

Possible Solution

Don't continue with the deployment, if any assets fail to publish.

Additional Information/Context

No response

CDK CLI Version

2.83.1 (build 006b542)

Framework Version

No response

Node.js Version

18

OS

Mac OSX

Language

Typescript

Language Version

TypeScript 4.9.5

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions