aws-extensions-for-dotnet-cli icon indicating copy to clipboard operation
aws-extensions-for-dotnet-cli copied to clipboard

Rollback and Prune previous versions

Open zaus opened this issue 9 months ago • 3 comments

Describe the feature

This may be more a pertinent to using SAM template's AutoPublishAlias or SemanticVersion rather than dotnet CLI, but deployment creates several artifacts in the S3 deployment bucket and never removes them. It's not clear how to get back to a previous version (either via CLI or in Console, as no changeset history is listed?), and I've only seen suggestions for manually cleaning up old stuff or awkward lifecycle policies or installing random 1stparty or 3rdparty plugins to do it for you.

The Serverless Framework's prune plugin handles this for the Lambda versioning, and I think it already cleans up old deployment artifacts?

Use Case

  • Clearing old micro-version/minor changes from test attempts
  • Reverting deployment with breaking change

Proposed Solution

Specifying a major/minor version number in template and remembering to update it when you want an explicit version, or deploying with an --autoversion flag; either should save separate changesets (is that how you're supposed to do it with Cloudformation Stacks?). Then:

dotnet lambda rollback-stack --v <EXACT_VERSION_NUMBER>

or

dotnet lambda rollback-stack --v "-<number of versions back"

or

dotnet lambda rollback-stack # just to previous version

To get back to the indicated version.

Also, specifying something like --retainVersions 5 to keep the last 5 deployments for rollback.

Other Information

No response

Acknowledgements

  • [ ] I may be able to implement this feature request
  • [ ] This feature might incur a breaking change

Targeted .NET platform

Any

CLI extension version

Package Id Version Commands

amazon.lambda.testtool-3.1 0.10.0 dotnet-lambda-test-tool-3.1 amazon.lambda.tools 5.10.4 dotnet-lambda dotnet-xscgen 2.0.662 xscgen

Environment details (OS name and version, etc.)

Windows

zaus avatar May 06 '24 18:05 zaus

I'll also just settle for guidance if this is something that can be accomplished "natively"

zaus avatar May 06 '24 18:05 zaus

Unsure if this is something that is available in .NET CLI Extensions tooling. Needs review with the team.

ashishdhingra avatar May 07 '24 17:05 ashishdhingra

I guess I shouldn't keep my hopes up if this is so old... https://github.com/aws/aws-sam-cli/issues/1654

zaus avatar May 07 '24 17:05 zaus