@@ -50144,8 +50144,8 @@ const core = __importStar(__nccwpck_require__(7484));
5014450144const client_cloudformation_1 = __nccwpck_require__(3805);
5014550145function waitUntilStackOperationComplete(params, input) {
5014650146 return __awaiter(this, void 0, void 0, function* () {
50147- var _a;
50148- const { client, maxWaitTime, minDelay } = params;
50147+ var _a, _b ;
50148+ const { client, maxWaitTime, minDelay, changeSetId } = params;
5014950149 const startTime = Date.now();
5015050150 while (Date.now() - startTime < maxWaitTime * 1000) {
5015150151 try {
@@ -50173,7 +50173,25 @@ function waitUntilStackOperationComplete(params, input) {
5017350173 status === 'UPDATE_ROLLBACK_FAILED' ||
5017450174 status === 'IMPORT_ROLLBACK_COMPLETE' ||
5017550175 status === 'IMPORT_ROLLBACK_FAILED') {
50176- throw new Error(`Stack operation failed with status: ${status}`);
50176+ // Get failed events using change set ID if available
50177+ let failureReason = `Stack operation failed with status: ${status}`;
50178+ if (changeSetId) {
50179+ try {
50180+ const events = yield client.send(new client_cloudformation_1.DescribeEventsCommand({
50181+ ChangeSetName: changeSetId,
50182+ Filters: { FailedEvents: true }
50183+ }));
50184+ const failedEvents = (_b = events.OperationEvents) === null || _b === void 0 ? void 0 : _b.filter(event => event.ResourceStatusReason);
50185+ if (failedEvents && failedEvents.length > 0) {
50186+ const reasons = failedEvents.map(event => `${event.LogicalResourceId}: ${event.ResourceStatusReason}`).join('; ');
50187+ failureReason += `. Failed resources: ${reasons}`;
50188+ }
50189+ }
50190+ catch (_c) {
50191+ // Ignore errors getting events
50192+ }
50193+ }
50194+ throw new Error(failureReason);
5017750195 }
5017850196 // In-progress states - keep waiting
5017950197 core.info(`Stack still in progress, waiting ${minDelay} seconds...`);
@@ -50313,7 +50331,7 @@ function updateStack(cfn, stack, params, failOnEmptyChangeSet, noExecuteChangeSe
5031350331 StackName: params.StackName
5031450332 }));
5031550333 core.debug('Updating CloudFormation stack');
50316- yield waitUntilStackOperationComplete({ client: cfn, maxWaitTime: 43200, minDelay: 10 }, {
50334+ yield waitUntilStackOperationComplete({ client: cfn, maxWaitTime: 43200, minDelay: 10, changeSetId: params.ChangeSetName }, {
5031750335 StackName: params.StackName
5031850336 });
5031950337 return { stackId: stack.StackId };
0 commit comments