Configuration of AWS function version backlog (version history)
#3,831 建立於 2017年6月22日
倉庫指標
- Star
- (46,915 star)
- PR 合併指標
- (平均合併 1天 15小時) (30 天內合併 34 個 PR)
描述
This is a Feature Proposal
Description
Currently the function versions deployed by Serverless will be retained forever. For some use cases it is good to have some old versions available (e.g. blue/green deplyoment), but keeping every version will clutter the version history.
As there are as many different uses as there are different users, it would be great if the version backlog could be configured at everyone's will. Currently the versioning can only be disabled completely by setting versionFunctions to false.
This discussion originated in Gitter, so I'll put the snippets together, that should compose a good starting point for a discussion or even provides a feasible solution.
Proposal
We could extend the semantics of the versionFunctions property and add an additional property to specify the size of the version backlog (in case the user wants to keep versions).
versionFunctions: false | 'delete' | 'retain'
retainVersions: number (defaults to all)
The versionFunctions values would mean the following:
false: Disable versioning, exactly the same as now when set to false
delete: Delete old versions (tech. set DeletionPolicy to Delete in the CF AWS::Lambda::Version resource). CF manages the deletion.
retain: Retain old versions (tech. set DeletionPolicy to Retain as it is now). SLS manages the version retention. If the retainVersions property is set to a positive integer, that amount of old versions will be kept. If not set, no versions will be deleted at all.
retain must be the default if not specified, because that matches the current behavior and won't lead to breaking changes.
Samples
Retain the 5 last versions:
versionFunctions: 'retain'
retainVersions: 5
Keep no versions:
versionFunctions: 'delete'
Keep all versions:
<nothing set> (backwards compatible)
or (explicitly)
versionFunctions: 'retain'