Redmine-operator docs - Development

This page serves to provide instructions on how to setup, change, and publish an update for the redmine-operator charm.

Initial Setup

Clone the repository

$ git clone https://git.launchpad.net/~thogarre/+git/redmine-operator
$ cd redmine-operator
$ git branch -b <descriptive-branch-name>

Create and activate a virtual environment to install the requirements:

$ source venv/bin/activate                                                                                                                                                                                          
$ pip install -r requirements-dev.txt       

Make changes as needed before deploying

# make changes as needed                                                                                                                                                                                       
$ charmcraft build   # for more information, see https://juju.is/docs/sdk/publishing and https://juju.is/docs/sdk/resources                                                                                                                                                                                       
$ juju deploy ./redmine-operator.charm # to use a custom docker hub image, append  "--resource redmine-image=redmine:x"
# if iterating between deployments, use:
$ juju remove-application redmine-operator  # make sure to be in the right juju model                                                                                                                          

Testing

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

$ ./run_tests

Debugging

Create a bash session to inspect the redmine container with:

$ kubectl exec --stdin --tty redmine-0 -n <namespace> -c redmine -- /bin/bash                                                                                                                                       

Publishing and Releasing a new version

See Juju | Publishing and Juju | Resources for additional documentation. As a short summary:

$ charmcraft login
$ charmcraft pack
$ chamcraft upload
# if a new resource has to be uploaded, such as the redmine image:
$ charmcraft upload-resource --image redmine:4.2 redmine-operator redmine-image
# get the image revision number from the output
$ charmcraft release redmine-operator --revision=$charm_revision --channel=$channel --resource=redmine-image:$image_revision
# be sure to also git commit/code review/push to the upstream source so the changes are in version control

If a new version of the OCI image is added as a resource, make sure to update the documentation so this new image can be mapped to the specific charm revision.