A serverless plugin for tracking deployed versions of your code.
This plugin has a super simple function: after you run serverless deploy
, it will create a local git tag based on the version of the Lambda function that you just deployed. For instance, if your function is named foo-production-index
and a deploy creates Lambda version 56, this plugin will automatically create a local git tag foo-production-index-56
.
This guarantees that you always know exactly what version of your source code is actually running in the cloud.
By default, this plugin only runs for deployments to the production stage. If you'd like to customize this behavior, you can set the versionTrackerStages
custom variable.
Install the Serverless Framework if you haven't already. Then choose your own adventure to install the plugin.
serverless plugin install --name serverless-version-tracker
Install the module using npm:
npm install serverless-version-tracker --save-dev
Add serverless-version-tracker
to the plugin list of your serverless.yml
file:
plugins:
- serverless-version-tracker
- Ensure that you have committed all of your changes to Git. The deploy will be aborted if the Git working directory is not clean. This prevents the possibility of deploying uncommitted / untraceable / volatile code.
- Run a deploy as normal (i.e.
sls deploy --stage production
). The plugin will automatically tag your local Git repository with the Lambda function name and new version. - Make sure to push the new tag to your remote repository (the plugin won't do this for you).