1.0.3 • Published 3 years ago

serverless-version-tracker-v2 v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Serverless Version Tracker V2

A serverless plugin for tracking deployed versions of your code. Project forked from https://github.com/danepowell/serverless-version-tracker

Description

This plugin has a super simple function: after you run serverless deploy, it will create a local git tag based on the version specified in the file version.txt (you can configure this file name). This file will contain your development snapshot version (Ex: version=1.0.0-SNAPSHOT). After deploy a new tag named {service-name}-1.0.0 will be created and pushed to your repo. The content of your version.txt file will be updated increasing the minor version (version=1.0.1-SNAPSHOT) and your current branch will be commited and pushed too.

This guarantees that you always know exactly what version of your source code is actually running in the cloud.

In addition, you can take the version of your component from the version.txt file that will be placed inside the packaged component you just deployed. (version=1.0.0)

Table of Contents

Usage requirements

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.

By default, the filename to keep track of versions is named version.txt. You can change the filename setting the versionTrackerFilename custom variable.

Installation instructions

Install the Serverless Framework if you haven't already. Then choose your own adventure to install the plugin.

Install using npm

Install the module using npm:

npm install serverless-version-tracker-v2 --save-dev

Add serverless-version-tracker-v2 to the plugin list of your serverless.yml file:

plugins:
  - serverless-version-tracker-v2

Quick start instructions

  1. Ensure that you have committed all of your changes to Git and you have the version.txt file in the root of your project containing your SNAPSHOT version. The deploy will be aborted if the Git working directory is not clean or if the version.txt file does not exist. This prevents the possibility of deploying uncommitted / untraceable / volatile code.
  2. Run a deploy as normal (i.e. sls deploy --stage production). The plugin will automatically tag your local Git repository with the service name and new version.
  3. The plugin will push the new tag for you.