From 393f8f011f5093a1d8a3c777928533b41c1fc887 Mon Sep 17 00:00:00 2001 From: Rico Huijbers Date: Tue, 20 Jun 2023 12:40:11 -0400 Subject: [PATCH] fix(cli): deployment continues if ECR asset fails to build or publish Fixes #26048, fixes #25827. --- packages/aws-cdk/lib/api/deployments.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/aws-cdk/lib/api/deployments.ts b/packages/aws-cdk/lib/api/deployments.ts index 4a71367d9ecbc..a375bf25c4f65 100644 --- a/packages/aws-cdk/lib/api/deployments.ts +++ b/packages/aws-cdk/lib/api/deployments.ts @@ -589,6 +589,9 @@ export class Deployments { const publisher = this.cachedPublisher(assetManifest, stackEnv, options.stackName); await publisher.buildEntry(asset); + if (publisher.hasFailures) { + throw new Error(`Failed to build asset ${asset.id}`); + } } /** @@ -601,6 +604,9 @@ export class Deployments { // No need to validate anymore, we already did that during build const publisher = this.cachedPublisher(assetManifest, stackEnv, options.stackName); await publisher.publishEntry(asset); + if (publisher.hasFailures) { + throw new Error(`Failed to publish asset ${asset.id}`); + } } /**