Introducing `jhack charm vinfo`

If you are like me, developing lots of charms and charm libs, you’ll often find yourself wondering: what version of this library is this specific charm actually using?

The only way to check that is to shell a find|grep into the unit and find out. Or is it?

Welcome jhack charm vinfo.

Get it from the Snap Store

Let’s deploy zinc-k8s and run jhack charm vinfo zinc-k8s

You’ll see:

But wouldn’t it be even nicer if you could see at a glance which of these libraries are out of date, out of sync, or up to date? You’d have to charmcraft list-lib [charm owner of the lib]

or simply run jhack charm vinfo -o zinc-k8s and enjoy the beautiful colourfulness of:

which shows that most of those libraries are several minor (or major!) versions behind.

Unit-level targeting

If you’re like me, you sometimes deploy several units of a charm and then hack on them individually, hot-swapping library versions, pushing to a unit some library code that it wasn’t packed with. If that is the case, and you want to be sure that the version information comes from a specific unit, you can simply target it explicitly. The command will work the same: so jhack charm vinfo zinc-k8s/3 will gather the version information from that specific unit.

Todos and future work:

  • overview of the charm lib versions in use by the whole model (or multiple apps).
  • “true” workload version: container image version, etc… for all resources.
  • machine charm support
5 Likes