aws / aws-cdk

The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code
https://aws.amazon.com/cdk
Apache License 2.0
11.47k stars 3.83k forks source link

aws_codepipeline: Rollbacks for CodePipelines #30083

Open jaydm26 opened 3 months ago

jaydm26 commented 3 months ago

Describe the feature

AWS introduced Rollbacks for Stages in CodePipeline. This feature currently seems to be missing in CodePipelines.

https://docs.aws.amazon.com/codepipeline/latest/userguide/stage-rollback.html

Use Case

This feature would allow me to enable automatic rollbacks upon failure directly through CDK instead of manually updating the pipeline to rollback the stage upon failure.

Proposed Solution

# pipeline: codepipeline.Pipeline

pipeline.add_stage(
  placement=None, 
  stage_name, 
  actions=None, 
  transition_disabled_reason=None, 
  transition_to_enabled=None,
  auto_rollback = True # Boolean that determines if the stage should be rolled back upon failure
)

I think there needs to be changes in the L1 object as well, but I am not well-versed with CDK to know the exact changes.

Other Information

No response

Acknowledgements

CDK version used

2.140.0

Environment details (OS name and version, etc.)

MacOS Sonoma 14.4.1, Python 3.11.7

go-to-k commented 3 months ago

I would like to address this issue.

However, the CodePipeline API has this feature, but CloudFormation does not yet. So we are waiting for the CloudFormation property. (However, the user guide already describes the feature on CloudFormation...)

jaydm26 commented 3 months ago

Do we have a timeline on by when CloudFormation will be updated? Otherwise, I am happy to raise an issue with https://github.com/cdklabs/awscdk-service-spec

khushail commented 3 months ago

Hi @jaydm26 ,thanks for requesting this feature. As correctly mentioned by @go-to-k , this is not currently provided by cloudformation. However you could add this feature to Cloudformation coverage roadmap and help in prioritizing this by upvotes.

go-to-k commented 2 months ago

The property (OnFailure) appears to have been added to CloudFormation and to L1. I will start on my PR.

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-stagedeclaration.html

https://github.com/aws/aws-cdk/pull/30182