bryanjswift / ssmenv

Manage environment variables with AWS SSM.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Environment Management via AWS SSM

This monorepo contains a CLI tool and a node library intended to ease management of environment variable sharing across development teams by storing the variables and values in the AWS SSM Parameter Store.

ssmenv

ssmenv is the node library underpinning the CLI tool. It provides a wrapper around the AWS SDK in order to treat the contents of the Parameter Store at a specific Path similar to how dotenv treats an environment file.

ssmenv-cli

ssmenv-cli is the command line tool (built on top of [oclif][oclif]) which provides a simpler interface for varlues which will be recognized as environment variables by the ssmenv library.

Development

Lerna is used to bootstrap ssmenv into ssmenv-cli so the local version of ssmenv can be used in development of ssmenv-cli. The versions of ssmenv and ssmenv-cli are kept in sync for the sake of simplicity. CircleCI is using lerna to publish git tags to NPM.

During feature development it is important to modify the CHANGELOG for the appropriate package. The CHANGELOG.md files are written using Keep A Changelog style changelogs.

Yarn workspaces are used to manage dependencies across the packages. In order to set up for development execute yarn from the top level or 'workspace root' (that is the directory containing the packages directory).

Prerequisite Software

Tests

Tests are executed using jest. The root project has a test script used to execute the tests in watch mode. By default this only executes tests that have been modified since the last commit.

yarn test

Releases

Releases are prepared manually on the master branch. After any changes have been merged:

  1. The version of each package is updated via yarn.
  2. The CHANGELOG of each package is updated to indicate the new version.
  3. A commit indicating the new version number is written (it includes the package.json, README.md and CHANGELOG.md changes from the previous actions.
  4. A signed and annotated git tag is created for the new version. The tag comment should include the changes from CHANGELOG.md from all packages.

An example of how this could work from the command line is given below:

# Update package version
export SSMENV_NEXT_VERSION=1.2.3
for p in `ls packages`; do
  pushd "packages/${p}"
  yarn version --new-version=${SSMENV_NEXT_VERSION}
  popd
done
# Update version in CHANGELOG header
# Review contents of the commit
git commit -m "v${SSMENV_NEXT_VERSION}"
git tag -a -s "v${SSMENV_NEXT_VERSION}"

Pushing the tag will trigger a CircleCI build that includes release jobs. The release jobs perform the work of publishing the packages to NPM.

About

Manage environment variables with AWS SSM.


Languages

Language:TypeScript 98.2%Language:Shell 1.7%Language:JavaScript 0.1%Language:Batchfile 0.0%