Charmcraft 3.0 in the beta channel

Happy Pi Day folks!

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!

New Features

Breaking changes!

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:

base: ubuntu@24.04
build-base: ubuntu@24.04  # Optional
platforms:
  amd64:

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.

Feedback

As usual, please feel free to file bug reports or open PRs.

1 Like

Hi,

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.

does this limitation apply for charmcraft too?.

Thanks,

1 Like