Skip to content

Commit

Permalink
fix(aws-cdk): don't skip deployment if stack is in a _failed state
Browse files Browse the repository at this point in the history
fixes #10784
  • Loading branch information
Erik Swets committed Oct 14, 2020
1 parent 2cb8e22 commit 400daeb
Show file tree
Hide file tree
Showing 2 changed files with 27 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
21 changes: 21 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,27 @@ 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
givenTemplateIs(FAKE_STACK.template);
givenStackExists({
StackStatus: 'DELETE_FAILED',
});

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

// THEN
expect(err).toEqual(Error('The stack named withouterrors failed to deploy: DELETE_FAILED'));
});

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

0 comments on commit 400daeb

Please sign in to comment.