Package: leverage
Leverage CLILeverage CLI is the tool used to manage and interact with any Leverage project.It transparently handles the most complex and error prone tasks that arise from working with a state-of-the-art infrastructure definition like our Leverage Reference Architecture. Leverage CLI uses a dockerized approach to encapsulate the tools needed to perform such tasks and to free the user from having to deal with the configuration and management of said tools.
Provides the means to interact with your Leverage project and allows you to define custom tasks to run.Reviewing and implementing theBinbash Leverage Landing Zone for AWSwould be a very good place to start!DocumentationFor installation instructions and all documentation regarding Leverage CLI, please refer tothis page.Note for migration from previous versionsIf you come from Leverage CLI version <1.8.0 and want to install Leverage CLI version >= 1.8.0 keep into account the following.Thebuild.envfile format has changed. As an example, this is the old format:# Project settings
PROJECT=bb

# General
MFA_ENABLED=false

# Terraform
TERRAFORM_IMAGE_NAME=binbash/terraform-awscli-slim
TERRAFORM_IMAGE_TAG=1.1.9New version example:# Project settings
PROJECT=bb

# General
MFA_ENABLED=false

# Terraform
TERRAFORM_IMAGE_TAG=1.2.7-0.1.0So, if you have created a project with version <1.8.0 and want to use it with version >=1.8.0 you should:remove TERRAFORM_IMAGE_NAME lineupdate TERRAFORM_IMAGE_TAG from this form '9.9.9' to this one '9.9.9-9.9.9'.For the second item you can check the versionhere.Setting up development environmentFirst, you should create a virtual environment and install all the required dependencies by running:pipenv install --dev.NOTE: If you don't havepipenvin your system, you can check the following documentation:https://pipenv.pypa.io/en/latest/#install-pipenv-todayNow, go to the directory that you will be using for running the local version of the CLI (it needs to be directory outside the CLI's source code) and install the CLI as an editable package inside this new virtual environment:pipenv install -e /path/to/cli-source-code.After that shell into the virtual environment viapipenv shellto start using the CLI in dev mode. This way, theleveragecommand on your virtual environment will be executed from the project folder, using it as the source.Now all the changes to the project will be immediately reflected on the command.Pre-commit hooksIn order to run black automatically on every commit, you should installpre-commitfirst:https://pre-commit.com/#installationAnd then the hooks:pre-commit installRunning TestsTo run unit tests, pytest is the tool of choice, and the required dependencies are available in the correspondingdev-requirements.txt.Integration tests are implemented usingbats. Bear in mind that bats tests are meant to be run in a throwaway environment since they perform filesystem manipulations and installation and removal of packages, and the cleanup may not be completely thorough. As such, is highly recommended to run these tests using de docker image.ManuallyUnit tests:pip3install-rdev-requirements.txt
python3-mpytestIntegration tests:bats-rtests/batsUsing docker imageA Docker image suitable for running all tests can be crafted by runningmake build-image. After crafting the image all tests can be executed.To run all tests, runmake tests. Alternativelymake test-unitormake test-intfor unit or integration tests respectively.Release ProcessOn every PR, a Github Action workflow is triggered to create/update a release draft.The version number is determined by the labels of those PRs (major, minor, fix).The release draft has to be manually published. This allows for any number of PR (features, fixes) to make the cut.Once a release is published, another workflow is triggered to create and push the package to PyPi.Release Candidate ProcessThere is an Action called "Test Build Package and Push".This Action can be called manually on any branch specifying the version to release to test.The version is a Release Candidate following the Semver: e.g. if the next release is 1.2.3, the test version should be 1.2.3-rc.1The package will be published toPyPi.Contributors/ContributingLeverage CLI was initially based on Pynt:https://github.com/rags/pyntLicenseLeverage CLI is licensed underMIT licenseBinBash Inc