Skip to content

Commit

Permalink
fix(cli): deployments are skipped if stack is in a _failed state (#10847
Browse files Browse the repository at this point in the history
)

fixes #10784


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
eswets authored Nov 9, 2020
1 parent 37a149b commit 4887ba6
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/aws-cdk/lib/api/deploy-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,12 @@ async function canSkipDeploy(
return false;
}

// Existing stack is in a failed state
if (cloudFormationStack.stackStatus.isFailure) {
debug(`${deployName}: stack is in a failure state`);
return false;
}

// We can skip deploy
return true;
}
Expand Down
19 changes: 19 additions & 0 deletions packages/aws-cdk/test/api/deploy-stack.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,25 @@ test('deploy not skipped if template did not change but one tag removed', async
expect(cfnMocks.getTemplate).toHaveBeenCalledWith({ StackName: 'withouterrors', TemplateStage: 'Original' });
});

test('deploy is not skipped if stack is in a _FAILED state', async () => {
// GIVEN
givenStackExists({
StackStatus: 'DELETE_FAILED',
});

// WHEN
await deployStack({
stack: FAKE_STACK,
sdk,
sdkProvider,
resolvedEnvironment: mockResolvedEnvironment(),
usePreviousParameters: true,
}).catch(() => {});

// THEN
expect(cfnMocks.createChangeSet).toHaveBeenCalled();
});

test('existing stack in UPDATE_ROLLBACK_COMPLETE state can be updated', async () => {
// GIVEN
givenStackExists(
Expand Down

0 comments on commit 4887ba6

Please sign in to comment.