I was trying to update this charm to build for the new 24.04 - which wasn’t supported by the above mentioned charm.
After some major trial and error:s going through the docs. I managed to get it to build for a single base ubuntu@24.04:
name: tiny-bash
type: charm
title: A tiny bash charm.
summary: |
The tiny-bash deploys very fast.
description: |
The tiny-bash charm that use "hooks only" to deploy.
Since its super small and only uses hooks, it deploys very fast
base: ubuntu@24.04
platforms:
amd64:
build-on: amd64
build-for: amd64
config:
options: {}
parts:
tiny-bash:
plugin: dump
source: .
prime:
- LICENSE
- README.md
- copyright
- hooks
- icon.svg
But as soon as I try to add any other bases or anything, I run into various of errors. For example, like this:
name: tiny-bash
type: charm
title: A tiny bash charm.
summary: |
The tiny-bash deploys very fast.
description: |
The tiny-bash charm that use "hooks only" to deploy.
Since its super small and only uses hooks, it deploys very fast
bases:
- build-on:
- name: ubuntu
channel: "24.04"
run-on:
- name: ubuntu
channel: "24.04"
- name: ubuntu
channel: "22.04"
config:
options: {}
parts:
tiny-bash:
plugin: dump
source: .
prime:
- LICENSE
- README.md
- copyright
- hooks
- icon.svg
Bad charmcraft.yaml content:
base requires ‘platforms’ definition: {‘name’: ‘ubuntu’, ‘channel’: ‘24.04’} (in field ‘bases[0]’)
Building on or for Ubuntu 24.04 requires single-base charms. There’s an open issue about support for multi-base charms, but no conclusion yet.
As of right now, the best way to do this is to have two charmcraft.yaml files: One with bases for older Ubuntu versions and a second with base and platforms for noble.
Could you give a specific example of how this would work? This is a blocker for the Observability team currently who are looking to add support for 24.04 to the grafana-agent subordinate charm.
Where would you envisage the two charmcraft.yaml files living, and how would you run charmcraft pack for each? Would you recommend leaving the existing charmcraft.yaml and adding a new directory charmcraft_24.04 with its own charmcraft.yaml and then running charmcraft pack --project-dir=.. to build the charm for 24.04, for instance?