canonical / charmcraft

Collaborate, build and publish charmed operators for Kubernetes, Linux and Windows.
Apache License 2.0
66 stars 69 forks source link

charmcraft 3 doesn't support using the expanded value format for the 'base' property #1707

Open lgp171188 opened 3 months ago

lgp171188 commented 3 months ago

Bug Description

The specification for the platform and base unification mentions the expanded format as a way to define base, i.e., instead of specifying it in a short format like ubuntu@24.04, it can also be specified using a yaml dictionary containing the name key with value ubuntu and the channel key with the value 24.04. However, with the base specified in this way, charmcraft errors out.

To Reproduce

Install charmcraft 3.x from the appropriate channel. Run charmcraft pack with a charmcraft.yaml defined in the format mentioned later in this bug report.

Environment

charmcraft: installed from the 3.x/edge channel on Ubuntu 24.04 LTS

charmcraft.yaml

base:
    name: ubuntu
    channel: 24.04
...

Relevant log output

charmcraft internal error: ValidationError(model='CharmcraftBuildPlanner', errors=[{'loc': ('base',), 'msg': 'str type expected', 'type': 'type_error.str'}])
lengau commented 2 months ago

Question for @sergiusens since you wrote the spec for this:

Currently charmcraft only supports the <distro>@<series> base entry. There's one mention in the spec of something like this. Should be remove it from the spec or do we need to implement this too?

And as a follow-up, would this be a good chance in charmcraft to replace channel with series?

sergiusens commented 3 weeks ago

we started with the short form on purpose, we will introduce the longer form once we have definitions on some of the multi-base definitions.

The correct name is still channel, 24.04 is the track in that channel and defaults to stable.