question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

(pipelines): Allow re-generating CloudFormation changeset after failure

See original GitHub issue

As of today, I couldn’t find a way to re-run an application stage deployment if application of the CloudFormation changeset failed. We can kick off the pipeline again by committing a dummy/no-op commit to the repository, but this creates unnecessary cruft in the SCM history.

Use Case

Consider a CloudFormation template that could not apply for some reason. In my case, it was because of a naming conflict with another CloudFormation stack that needed to be destroyed.

The CodePipeline user interface looks like this after the failure:

Screen_Shot_2020-12-10_at_10_20_02_AM

So, I took a look at the failure and noticed the naming conflict. I went and destroyed the other CDK stack and wanted to re-run the deployment. However, when I clicked the “Retry” button in the UI, the “Deploy” stage failed with this error message:

ChangeSet [PipelineChange] does not exist (Service: AmazonCloudFormation; Status Code: 404; Error Code: ChangeSetNotFound; Request ID: <redacted>)

Indeed, in the CloudFormation user interface, the changeset was not present:

Screen Shot 2020-12-10 at 10 06 59 AM

The problem appears to be because there’s no way to retry an entire stage in CodePipeline, including steps that previously succeeded. According to the aws cli docs (aws codepipeline retry-stage-execution help):

--retry-mode (string)
  The scope of the retry attempt. Currently, the only supported  value
  is FAILED_ACTIONS.

  Possible values:

  o FAILED_ACTIONS

Because I didn’t have a way to rerun the .Prepare step (which produces the changeset), I was kind of stuck and had to revert to pushing a no-op commit to force the step to re-run.

Proposed Solution

Since this appears to be a CodePipeline limitation, maybe a custom “step” is needed? Like maybe an SNS topic or something to kick off the deployment again? Or maybe a better solution would be to +1 feature requests on the CodePipeline side to allow “Retry (including succeeded)” behavior?

Other

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

This is a 🚀 Feature Request

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:9
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

11reactions
openwebsolnscommented, Nov 16, 2021

This is still a problem. If you have a large pipeline, “releasing a change” would require deploying through all the previous stages before you can retry the failed stage. Is there a creative workaround by which we can “replay” a changeset with the same name (PipelineChange) so that the CodePipeline retry works? Does CDK provide the ability to just create the changeset?

10reactions
fab-mindflowcommented, Dec 7, 2021

Indeed, we also have a large CDK deployment and this forces us to build everything again and again. Any workaround?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Stack failure options - AWS CloudFormation
By specifying stack failure options, you can troubleshoot resources in a CREATE_FAILED or UPDATE_FAILED status. You can provision failure options for all stack ......
Read more >
Prevent CloudFormation Change Sets from piling up
The aws cloudformation deploy command creates or updates the stack example . The option --no-fail-on-empty-changeset makes sure the command does ...
Read more >
Creating stacks using change sets - Amazon CloudFormation
When CloudFormation completes successfully creating the change set, it sets the change set status to CREATE_COMPLETE , and its execution status is AVAILABLE...
Read more >
AWS CloudFormation -Update Rollback Failed -How to Rectify ...
1. Open the AWS CloudFormation console. · 2. From the navigation pane, choose Stacks. · 3. From the Stack name column, select the...
Read more >
5 Ways to Prevent Accidentally Deleting Your CloudFormation ...
1. Review the Changeset · go to your CloudFormation console and select the stack that you want to update · click the Stack...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found