Today we’re releasing the first beta release of Charmcraft 3.0. It’s currently building and will be in the latest/beta and 3.x/beta snap channels soon!
We’ve got a few breaking changes, mostly to align charmcraft with other craft apps like snapcraft and rockcraft. The highlights are:
The prime keyword no longer adds extra files to a charm. If you need this functionality, please use the dump plugin instead.
The bases keyword is deprecated. All bases that were supported in Charmcraft 2.x (Ubuntu LTS up to 22.04, CentOS 7, AlmaLinux 9) still accept these, but new bases will all use the platforms keyword in charmcraft.yaml (details below).
The --bases-index parameter is deprecated. Please start using the new --platform parameter instead
platforms
The good news: Your current charms using the bases keyword should continue to build as expected!
The bad news: If you want to use Ubuntu 24.04 for your charm, you’ll need to change your charm.
The short version: Here’s an example replacement for bases in an Ubuntu 24.04 charm:
This will build and run your charm on Ubuntu 24.04 for amd64. Full documentation is incoming before the final release, but it works roughly the same way as Rockcraft, so you can probably reference their documentation in the meantime.
Please note that this does mean that from Ubuntu 24.04 and on, we don’t support a single charmcraft.yaml building charms for multiple bases.
I have a couple of questions, we are planning the migration from charmcraft-2.x for the OpenStack charms.
This is a single base, how do I declare/define a charmcraft.yaml when the charm’s source code is meant to be used to build charms for 22.04 and 24.04?
With charmcraft-2.x we define a large list of build-on/run-on for each base+arch combintation, see charmcraft.yaml from ovn-central for an example.
The rockcraft docs say:
At the moment Rockcraft will only build for a single architecture, so if provided build-for must be a single string or a list with exactly one element.
That being said, charmcraft is only available in the beta and edge channels today, so things could potentially change, and I’m not in the charmcraft team, I don’t claim authoritative knowledge.
Here’s my config which I feel is probably useful to a whole bunch of charmers, as many charms use libs that use pydantic in turn, and rust is required to build pydantic-core.