Skip to content

Commit

Permalink
patch(build_charm.yaml): Fix support for extended charmcraft.yaml bas…
Browse files Browse the repository at this point in the history
…e format (#146)

https://discourse.charmhub.io/t/charmcraft-bases-provider-support/4713

charmcraft.yaml bases with build-on are a singleton list of one dict,
not a dict

Follow up to #141

Encountered on
https://github.com/canonical/postgresql-k8s-operator/actions/runs/8073677258/job/22057758552?pr=403
  • Loading branch information
carlcsaposs-canonical authored Feb 29, 2024
1 parent 2708226 commit ce489b1
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,10 @@ def get_bases(*, craft_: craft.Craft, yaml_data):
build_on_architectures = platform["build-on"]
elif craft_ is craft.Craft.CHARM:
# https://discourse.charmhub.io/t/charmcraft-bases-provider-support/4713
build_on_architectures = (platform.get("build-on") or platform).get(
"architectures"
)
build_on = platform.get("build-on")
if build_on:
assert isinstance(build_on, list) and len(build_on) == 1
build_on_architectures = (build_on[0] or platform).get("architectures")
if not build_on_architectures:
# Default to X64
arch_for_bases.append(craft.Architecture.X64)
Expand Down

0 comments on commit ce489b1

Please sign in to comment.