Local Charm Repository

Here is the repository for the Juju charms modified for use in the GARR Federated Cloud.

See the guide on Upgrading OpenStack Juju Charms for details on the process.

Instead of managing patches manually, we rely on the use of Git with multiple remotes. Basically we keep a local modified version under the folder CHARM_NAME and merge it periodically with the official repository, that is added as remote repository.

Cloning from the GARR repository

Get a copy of the charm from the GARR Git:

$ git clone https://git.garr.it/cloud/charm-CHARM_NAME.git CHARM_NAME
Cloning into 'CHARM_NAME'...
remote: Reusing existing pack: 1857, done.
remote: Total 1857 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (1857/1857), 374.35 KiB | 268.00 KiB/s, done.
Resolving deltas: 100% (772/772), done.
Checking connectivity... done.

Making local modifications

Move to the cloned floder and make your changes there:

$ cd CHARM_NAME

After reviewing and testing any changes made lo the local copy of the charm, remember to commit them to the GARR Git repository:

$ git commit -a
$ git push

Upgrading to the latest release

Upgrading to the latest release is done with these steps. Ensure you have a remote to the official GitHub repository:

$ cd CHARM_NAME
$ git remote add github https://github.com/openstack/charm-CHARM_NAME.git
$ git fetch github
warning: no common commits
remote: Counting objects: 4185, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 4185 (delta 0), reused 1 (delta 0), pack-reused 4182
Receiving objects: 100% (4185/4185), 1018.61 KiB | 1.17 MiB/s, done.
Resolving deltas: 100% (2804/2804), done.
From https://github.com/openstack/charm-openstack-dashboard
* [new branch]      master     -> github/master
* [new branch]      stable/16.04 -> github/stable/16.04
* [new branch]      stable/16.07 -> github/stable/16.07
* [new branch]      stable/16.10 -> github/stable/16.10
* [new branch]      stable/17.02 -> github/stable/17.02

Perform a merge with the latest version on GitHub:

$ git merge github/master

Perform instead a merge with a specific branch:

$ git merge github/stable/17.02

and also create a branch:

$ git branch stable/17.02

Note: if the patch does not apply cleanly, you will need to manually resolve any conflicts to reapply the local customizations.

You can use Emacs to resolve the conficts. Go through conflicting files with:

M-x grep -nH -r '<<< HEAD'

and then move to each conflict with ‘C-x`’.

Use these commands to fix conflicts:

M-x smerge-next to move to next conflict.

M-x smerge-previous to move to previous conflict.

M-x smerge-keep-current to keep the version the cursor is on.

M-x smerge-keep-mine to keep your changes.

M-x smerge-keep-other to keep other changes.

M-x smerge-keep-all to keep both

M-x smerge-autocombine or automatically combine conflicts that are near each other.

Remember that you can always undo the changes with C-_ as many times you need.

Commit and push the new version of the charm:

$ git commit -a
$ git push

If you made some changes to the master version that need to go into the stable branch:

$ git checkout stable/17.02
$ git merge master
$ git commit -a
$ git push origin stable/17.02

Then revert to master:

$ git checkout master

Releasing a new version of the charm

To release a new version of the charm to the Juju Charm Store, do:

$ cd CHARM_NAME

Ensure that the code passes the tests:

$ make
$ sudo make test

If there are no errors, proceed to publish it. Ensure you have the charm tools, or else install them with:

$ sudo snap install charm --classic

Now you can publish the charm:

$ make publish