Skip to content

Latest commit

 

History

History
99 lines (77 loc) · 2.96 KB

CONTRIBUTING.md

File metadata and controls

99 lines (77 loc) · 2.96 KB

Development guide

You will need to have Python 3 and Charmcraft installed.

sudo snap install charmcraft --classic

Setting up the environment

Create and activate a virtualenv with the development requirements:

virtualenv -p python3 venv
source venv/bin/activate
pip install -r requirements-dev.txt

Testing

The Python operator framework includes a very nice harness for testing operator behaviour without full deployment. Just run_tests:

./run_tests

Deploying

Before you deploy your modified controller charm, you will need to pack it using Charmcraft:

$ charmcraft pack
...
Charms packed:
    juju-controller_[...].charm

If deploying on LXD, you can bootstrap Juju using the --controller-charm-path flag, and providing the path to your packed charm.

$ juju bootstrap lxd c --controller-charm-path=[path/to/packed/charm]

If deploying on k8s, you need to upload the charm to Charmhub first. Register a new charm name for testing:

$ charmcraft register [new-name]

and upload the modified charm under this name:

$ charmcraft upload *.charm --name [new-name] --release latest/stable
Revision 1 of [new-name] created
Revision released to latest/stable

Then, you can bootstrap a new k8s controller, providing the Charmhub name and channel:

$ juju bootstrap microk8s c \
--controller-charm-path=[new-name]
--controller-charm-channel=latest/stable

Releasing

This PR includes a workflow which will automatically release new versions of the charm to the relevant edge channel.

After QA'ing an edge release, you can promote it to the stable channel by getting the revision number and running charmcraft release:

$ juju info juju-controller
...
3.1/edge:          44  2023-10-19  (44)  10MB

$ charmcraft release juju-controller --revision 44 --channel 3.1/stable
Revision 44 of charm 'juju-controller' released to 3.1/stable

Manual release

These instructions are kept around mostly for interest/reference.

To release a new version of the controller charm, first pack the charm as above:

$ charmcraft pack
...
Charms packed:
    juju-controller_[...].charm

Then, upload under the name juju-controller:

$ charmcraft upload *.charm --name juju-controller
Revision [XX] of 'juju-controller' created

Finally, release it to the relevant channels. Along with a latest track, we maintain a track for every minor version of Juju, e.g. 3.0, 3.1, etc.

$ charmcraft release juju-controller --revision [XX] --channel latest/stable --channel 3.0/stable
Revision [XX] of charm 'juju-controller' released to latest/stable, 3.0/stable

You can also do the upload and release in a single step if you'd like:

$ charmcraft upload *.charm --name juju-controller --release latest/stable --release 3.0/stable
Revision [XX] of 'juju-controller' created
Revision [XX] of charm 'juju-controller' released to latest/stable, 3.0/stable