serverless-heaven / serverless-aws-alias

Alias support for Serverless 1.x
MIT License
189 stars 68 forks source link

Do not auto publish a new version on every new alias creation if nothing has changed #142

Open knizami opened 6 years ago

knizami commented 6 years ago

Hello,

It appears that if you create a new alias it will always publish a new version of the lambda function (with the updated environment variable SERVERLESS_ALIAS pointing to new alias) even if nothing has changed in the lambda function. This becomes a problem for real versioning. If the lambda function is a microservice in the release of application v1-1 and nothing has changed in the lambda function since v1-0, I would like to create an alias on the same version of the lambda function, then v1-1 and v1-0 point to the same lambda version and it becomes apparent to anyone looking at the lambda function or working on it that it is used for both releases. However, if we publish a new version every time it then becomes hard to really determine whether a set of application releases are using the same version of the lambda function without potentially going back to the vcs.

If you do a publish-version with the cli or from the console and nothing has changed then it doesn't publish a new version because there is no need to and nothing is new. Is there a way to prevent the plugin from updating the environment variable, which appears to be the only difference that is introduced when an alias is updated with no underlying changes? That way it won't publish a new version and the alias will be associated with the last published version?