Skip to main content

Your submission was sent successfully! Close

Thank you for signing up for our newsletter!
In these regular emails you will find the latest updates from Canonical and upcoming events where you can meet our team.Close

Thank you for contacting our team. We will be in touch shortly.Close

  1. Blog
  2. Article

Tom Haddon
on 15 November 2017

Codetree Collect Info


We recently landed a feature in Codetree that I’m pretty excited about. Codetree is a tool for collecting code from various locations and assembling it in a specific directory structure. It can be used in a standalone fashion, but is also tightly integrated with Mojo, which we use to deploy and manage Juju models.

To install Codetree, just run “sudo snap install codetree --classic“.

As an example, let’s say you want to get a subset of the latest OpenStack charms. You could do so by creating a file called openstack-charms with the following contents:

charms                   @
charms/cinder            git+https://github.com/openstack/charm-cinder;revno=stable/17.08
charms/glance            git+https://github.com/openstack/charm-glance;revno=stable/17.08
charms/hacluster         git+https://github.com/openstack/charm-hacluster;revno=stable/17.08
charms/heat              git+https://github.com/openstack/charm-heat;revno=stable/17.08
charms/keystone          git+https://github.com/openstack/charm-keystone;revno=stable/17.08

You’d then run “codetree openstack-charms” and you’d have the charms assembled in a “charms” directory. So far so good.

But what happens three months from now when you want to upgrade the charms you’ve deployed to a newer version? Or two months from now if you come across a bug in the charms and are not sure exactly what version you deployed and when? Juju strips out any dotfiles and dot directories from charms it deploys, so you won’t be able to use git commands to query where the charms on disk in your deployed OpenStack came from.

This is where the new feature we’ve just added to Codetree comes in. Codetree will now inject a file called “codetree-collect-info.yaml” into any directory it downloads, and this file will then be queryable later to confirm what version you deployed. This can be done in situ on your deployed OpenStack instance. For example:

juju ssh keystone/0 “head -4 /var/lib/juju/agents/unit*/charm/codetree-collect-info.yaml”
collect_date: '2017-11-01 14:32:55.815503'
collect_url: git+https://github.com/openstack/charm-keystone;revno=91490b7daf7511a717f75f62b57fc3f97cc6d740
hashes:
  LICENSE: cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30

Now you can easily see the specific revision the charm was collected from, when it was collected, and the hashes allow you to query if any of the files on disk have been changed.

Our next planned step from here is to add a “charm-report” phase to Mojo to allow us to query this information with one simple command.

Related posts


Amir Abdel Baki
20 September 2024

Life at Canonical: Amy Song shares her experience as a new joiner in Customer Success

Ubuntu Article

As Canonical continues to grow, we have developed a unique onboarding process that enables our new hires to quickly settle and establish themselves in our globally distributed environment.  During your first few weeks your manager will create an onboarding plan to introduce you to the business, your closest stakeholders and colleagues. Yo ...


Serdar Vural
20 September 2024

Canonical and OpenAirInterface to collaborate on open source telecom network infrastructure

5G Article

Canonical is excited to announce that we are collaborating with OpenAirInterface (OAI) to drive the development and promotion of open source software for open radio access networks (Open RAN). Canonical will bring automation in software lifecycle management to OAI’s RAN stack, alongside additional infrastructure capabilities. This will be ...


Benjamin Ryzman
18 September 2024

What is the 5G Edge and Multi-Access Edge Computing?

Ubuntu Telecommunications

Introduction The 5G Edge is revolutionising the telecommunications industry by significantly enhancing network performance, bringing computing power closer to users, and dramatically reducing latency, enabling faster and more efficient services. This advancement is crucial for a variety of applications across different sectors, including ...