canonical / charmcraft

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

Charmcraft 3 breaks charms with multiple run-on architectures #1697

Open lengau opened 3 weeks ago

lengau commented 3 weeks ago

Bug Description

For Jammy and below, charms with multiple run-on get the message Architecture 'amd64-arm64-ppc64el-s390x' is not supported. (or similar)

To Reproduce

  1. git clone https://opendev.org/openstack/charm-nova-compute.git
  2. charmcraft pack (with charmcraft 3)

Environment

Linux charmcraft 3

charmcraft.yaml

type: charm

parts:
  charm:
    plugin: dump
    source: .
    prime:
      - actions/*
      - charmhelpers/*
      - files/*
      - hooks/*
      - lib/*
      - templates/*
      - actions.yaml
      - config.yaml
      - copyright
      - hardening.yaml
      - icon.svg
      - LICENSE
      - Makefile
      - metadata.yaml
      - README.md

bases:
  - build-on:
      - name: ubuntu
        channel: "22.04"
        architectures:
          - amd64
    run-on:
      - name: ubuntu
        channel: "22.04"
        architectures: [amd64, s390x, ppc64el, arm64]

Relevant log output

2024-06-10 14:08:02.305 Starting charmcraft, version 3.0.0.post46+ga44c03e
2024-06-10 14:08:02.305 Log verbosity level set to BRIEF
2024-06-10 14:08:02.305 Configuring application...
2024-06-10 14:08:02.305 Preparing application...
2024-06-10 14:08:02.306 Build plan: platform=None, build_for=None
2024-06-10 14:08:02.307 Loading project file '/home/lengau/Work/Code/charm-nova-compute/charmcraft.yaml'
2024-06-10 14:08:02.309 Warning: use of 'prime' in a charm part is deprecated and no longer works, see https://juju.is/docs/sdk/include-extra-files-in-a-charm
2024-06-10 14:08:02.339 Architecture 'amd64-arm64-ppc64el-s390x' is not supported.
2024-06-10 14:08:02.340 Traceback (most recent call last):
2024-06-10 14:08:02.340   File "/snap/charmcraft/3838/lib/python3.10/site-packages/craft_application/application.py", line 508, in run
2024-06-10 14:08:02.340     self.services.project = self.get_project(
2024-06-10 14:08:02.340   File "/snap/charmcraft/3838/lib/python3.10/site-packages/craft_application/application.py", line 303, in get_project
2024-06-10 14:08:02.340     yaml_data = self._transform_project_yaml(yaml_data, build_on, build_for)
2024-06-10 14:08:02.340   File "/snap/charmcraft/3838/lib/python3.10/site-packages/craft_application/application.py", line 601, in _transform_project_yaml
2024-06-10 14:08:02.340     self._expand_environment(yaml_data=yaml_data, build_for=build_for)
2024-06-10 14:08:02.340   File "/snap/charmcraft/3838/lib/python3.10/site-packages/craft_application/application.py", line 629, in _expand_environment
2024-06-10 14:08:02.340     info = craft_parts.ProjectInfo(
2024-06-10 14:08:02.340   File "/snap/charmcraft/3838/lib/python3.10/site-packages/craft_parts/infos.py", line 99, in __init__
2024-06-10 14:08:02.340     self._set_machine(arch)
2024-06-10 14:08:02.340   File "/snap/charmcraft/3838/lib/python3.10/site-packages/craft_parts/infos.py", line 333, in _set_machine
2024-06-10 14:08:02.340     raise errors.InvalidArchitecture(arch)
2024-06-10 14:08:02.340 craft_parts.errors.InvalidArchitecture: Architecture 'amd64-arm64-ppc64el-s390x' is not supported.
2024-06-10 14:08:02.340 Make sure the architecture name is correct.
2024-06-10 14:08:02.340 Recommended resolution: Make sure the architecture name is correct.
2024-06-10 14:08:02.340 Full execution log: '/home/lengau/.local/state/charmcraft/log/charmcraft-20240610-140802.305265.log'
jadonn commented 3 weeks ago

This bug is causing charm builds for OpenStack charms to fail. I have builds on charmcraft 3.x latest/edge failing with this error:

2024-06-13 07:40:46.146506 | focal-medium | Architecture 'amd64-arm64-ppc64el-s390x' is not supported.

This started happening sometime between charmcraft snap version 3.0.0.post46+ga44c03e revision 3838 and version 3.0.0.post51+gfb8680e revision 3937. Here is a successful CI test run on 3.0.0.post46+ga44c03e and here is a failed CI test run on 3.0.0.post51+gfb8680e.

I can also confirm this is still happening when I try to build this Vault charm locally using version version 3.0.0.post52+gbcb1903.

If it helps, here is the charmcraft.yaml file for the affected charm.