Skip to main content

Binbash Leverage Command-Line tool.

Project description

Binbash

Leverage CLI

Leverage 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.

Documentation

For installation instructions and all documentation regarding Leverage CLI, please refer to this page.

Note for migration from previous versions

If you come from Leverage CLI version <1.8.0 and want to install Leverage CLI version >= 1.8.0 keep into account the following.

The build.env file 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.9

New version example:

# Project settings
PROJECT=bb

# General
MFA_ENABLED=false

# Terraform
TERRAFORM_IMAGE_TAG=1.2.7-0.1.0

So, 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 line
  • update 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 version here.

Setting up development environment

First, you should create a virtual environment and install all the required dependencies by running: pipenv install --dev.

NOTE: If you don't have pipenv in your system, you can check the following documentation: https://pipenv.pypa.io/en/latest/#install-pipenv-today

Now, 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 via pipenv shell to start using the CLI in dev mode. This way, the leverage command 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 hooks

In order to run black automatically on every commit, you should install pre-commit first:

https://pre-commit.com/#installation

And then the hooks:

pre-commit install

Running Tests

To run unit tests, pytest is the tool of choice, and the required dependencies are available in the corresponding dev-requirements.txt.

Integration tests are implemented using bats. 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.

Manually

Unit tests:

pip3 install -r dev-requirements.txt
python3 -m pytest

Integration tests:

bats -r tests/bats

Using docker image

A Docker image suitable for running all tests can be crafted by running make build-image. After crafting the image all tests can be executed.

To run all tests, run make tests. Alternatively make test-unit or make test-int for unit or integration tests respectively.

Release Process

  • On 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 Process

  • There 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.1
  • The package will be published to PyPi.

Contributors/Contributing

License

Leverage CLI is licensed under MIT licenseBinBash Inc

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

leverage-1.10.4rc5.tar.gz (48.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

leverage-1.10.4rc5-py3-none-any.whl (51.4 kB view details)

Uploaded Python 3

File details

Details for the file leverage-1.10.4rc5.tar.gz.

File metadata

  • Download URL: leverage-1.10.4rc5.tar.gz
  • Upload date:
  • Size: 48.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/6.6.0 pkginfo/1.9.6 requests/2.30.0 requests-toolbelt/1.0.0 tqdm/4.65.0 CPython/3.8.18

File hashes

Hashes for leverage-1.10.4rc5.tar.gz
Algorithm Hash digest
SHA256 d6f2f0629ef083f9fdd1cfa6e90c3eb3591931046d532e872c43ab09190fa700
MD5 5a9b26a9eae3b3b2aa805427bed7a853
BLAKE2b-256 0f91218bf4bd271c63a0c0bd852c96574324214981e50a5c1fa75d74fa856c82

See more details on using hashes here.

File details

Details for the file leverage-1.10.4rc5-py3-none-any.whl.

File metadata

  • Download URL: leverage-1.10.4rc5-py3-none-any.whl
  • Upload date:
  • Size: 51.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/6.6.0 pkginfo/1.9.6 requests/2.30.0 requests-toolbelt/1.0.0 tqdm/4.65.0 CPython/3.8.18

File hashes

Hashes for leverage-1.10.4rc5-py3-none-any.whl
Algorithm Hash digest
SHA256 ed4e89ceffd9c4b4a3feb720650ee1a0ff900ef5bc92d03820a93eed2b917e1b
MD5 101fcf6d85dfb18b56f88fa365e08084
BLAKE2b-256 e5e2e7004a29d7f158b911ea2d89d9e1da18b62135c7a8ceff3bb72fd1290798

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page