Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cli): deployments are skipped if stack is in a _failed state #10847

Merged
merged 2 commits into from
Nov 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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