Skip to content

divio/divio-cli

Repository files navigation

Divio CLI - Command-line interface to the Divio Cloud

PyPI Version PyPI Downloads Wheel Support License

Installing

pip install divio-cli

⚠️ For Windows users: Make sure you have added Python to PATH during installation, otherwise you must add it manually for the divio-cli commands to function properly.

Using the CLI

See Divio developer handbook: How to use the Divio command-line interface

Support for docker-compose 1 and 2

The CLI supports version 1 (docker-compose) and version 2 (docker compose) of the command invocation and is using the new version 2 by default.

You can opt-in to still use the old version 1 command by updating your CLI global settings in ~/.aldryn and add a new setting called docker-compose with the value ["docker-compose"]:

{"update_check_timestamp": 1234567890, "docker-compose": ["docker-compose"]}

Testing

The test suite is split into two categories: unit tests and integration tests. Unit tests run completely locally, so no previous setup is required. Integration tests run against the actual Divio infrastructure, so setup of a Divio project is required. In order to run the test suite, you have to have GNU Make and GNU Bash on your system. The integration tests also require Docker Compose.

Both test categories take optional arguments like TOX_ARGS and PYTEST_ARGS:

make test TOX_ARGS="-e python.11" PYTEST_ARGS="-s"

To clear all local state run:

make clean

Unit tests

These do not require external communication and can be run with the following command:

make test

Integration tests

These do require a more involved setup and will trigger actions on a real project. It is recommended to use a project on control.dev.aldryn.net because it requires no control panel running locally, and is what the CI pipeline does.

The CI uses ci-test-project-do-not-delete project. DO NOT USE THIS PROJECT FOR YOUR LOCAL TESTING! The project is reserved for CI testing. Create your own project and replicate the CI project configuration.

To run the integration test suite, run:

make test_integration

The first run will fail, but will create an empty .env file. Configure your test project there. You can take a look at the variables tab in the CI Settings as a starting point.

Linting

To run the linter, run the following command:

make lint

Creating a release

  1. Checkout a new branch for the new version - release-X.X.X
  2. Update the changelog.
  3. Merge the branch (after approval).
  4. Tag master with the release number X.X.X and git push origin <tagname>

The pipeline will then take care of the release.