Charmcraft 3 no longer respects legacy bases architectures
Metadata
Current evaluation
Fixed in 3.1.2. Charmcraft 3 ignored legacy bases architectures, defaulting to amd64. The bug stemmed from metadata generation failing to apply the current build plan to legacy definitions. The update restores correct architecture detection.
Suggested action: —
No scores available.
Issue body
### Bug Description
Building a charm on a non-amd64 architecture using the legacy Charmcraft 2 `bases` notation on Charmcraft 3 ignores the architecture and defaults to amd64 despite building on a different platform.
Example for this is the [postgresql-tes-app](https://github.com/canonical/postgresql-test-app) packing and CI tests passed fine, using a locally packed charm, but both amd64 and arm64 revisions got published as amd64 revisions.
The `manifest.yaml` inside the published arm64 revison (203) is:
```
charmcraft-version: 3.1.1
charmcraft-started-at: '2024-08-02T10:30:16.196847'
bases:
- name: ubuntu
channel: '22.04'
architectures:
- amd64
- name: ubuntu
channel: '22.04'
architectures:
- arm64
analysis:
attributes:
- name: language
result: python
- name: framework
result: operator
```
The packed charm is correctly marked as arm64
### To Reproduce
* Pack postgresql-test-app on arm64
* Publish on charmhub
* Deploy on amd64
### Environment
OS: Ubuntu 22.04 (Github runner)
Charmcraft: 3.1.1
### charmcraft.yaml
```shell
# Copyright 2023 Canonical Ltd.
# See LICENSE file for licensing details.
type: charm
bases:
- name: ubuntu
channel: "22.04"
architectures: [amd64]
- name: ubuntu
channel: "22.04"
architectures: [arm64]
parts:
charm:
override-pull: |
craftctl default
if [[ ! -f requirements.txt ]]
then
echo 'ERROR: Use "tox run -e build" instead of calling "charmcraft pack" directly' >&2
exit 1
fi
charm-strict-dependencies: true
libpq:
build-packages:
- libpq-dev
plugin: dump
source: /usr/lib/
source-type: local
prime:
- lib/
organize:
"*-linux-gnu/libpq.so*": lib/
```
### Relevant log output
```shell
Packing...
Packing charm postgresql-test-app_ubuntu-22.04-arm64.charm
Packed postgresql-test-app_ubuntu-22.04-arm64.charm
build-dev: commands_post[0]> mv requirements.txt requirements-last-build.txt
build-dev: OK (304.68=setup[0.95]+cmd[0.66,303.07,0.00] seconds)
congratulations :) (304.74 seconds)
```
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen3.6-35b-a3b-mtp-q6 | — | — | Fixed in 3.1.2. Charmcraft 3 ignored legacy bases architectures, defaulting to amd64. The bug stemmed from metadata generation failing to apply the current build plan to legacy definitions. The update restores correct architecture detection. | |
| qwen/qwen3.6-35b-a3b | — | — | Charmcraft 3 ignored legacy bases architectures, defaulting to amd64. Metadata generation failed to apply the current build plan to bases. Resolved and fixed in version 3.1.2. | |
| qwen/qwen3.6-35b-a3b | — | — | Fixed in Charmcraft 3.1.2. Legacy bases architectures incorrectly defaulted to amd64 because metadata generation skipped the current build plan. The issue was resolved by correcting this logic. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Charmcraft 3 ignored legacy bases architectures, defaulting to amd64. Root cause was metadata generation failing to apply the current build plan. Fixed and released in version 3.1.2. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Charmcraft 3 ignored legacy bases architectures during packaging, defaulting to amd64. Root cause was metadata generation failing to apply the current build plan. Fixed in version 3.1.2. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1697 Charmcraft 3 breaks charms with multiple run-on architectures | charmcraft | closed | Closed as blocked by an upstream fix in craft-application. Charmcraft 3 incorrectly concatenated multiple run-on architectures into a single invalid string, causing build failures. Resolution awaits the referenced upstream issue. | |
| #1853 Incorrect information in Charmhub for ARM64 variants of a charm | charmcraft | closed | Closed. Manifests incorrectly included all architectures instead of the specific build architecture due to a charmcraft bug. Resolved in charmcraft 3.1.2+; re-packaging charms generates correct manifests. |