Multi-arch OCI image incorrectly uploaded to Charmhub registry
Metadata
Current evaluation
Fixed multi-architecture resource uploads in Charmcraft 2.7 by PR #1462 (commit 566103b8), ensuring complete OCI images reach Charmhub.
Resolution: closed resolved
Reason: The issue was fixed by merged PR canonical/charmcraft#1462, commit 566103b8. It added client-side multi-architecture resource uploads so the full OCI image, rather than only the local amd64 image, is sent to Charmhub.
Evaluated by: mr-cal-bot
No scores available.
Issue body
### Bug Description
`charmcraft upload-resource` with a multi-arch image (e.g. https://github.com/canonical/charmed-postgresql-rock/pkgs/container/charmed-postgresql/208426154?tag=14.11-22.04_edge) uploads the amd64 image (if running charmcraft on amd64 machine) to the Charmhub registry
Context:
https://warthogs.atlassian.net/browse/DPE-4280
https://matrix.to/#/!LhFxJIPEcCacgdMghH:ubuntu.com/$JMmA26BWFkqAKsCJ0tfAx4fpVOSndhej3-CYHwHyBpc?via=ubuntu.com&via=matrix.org
### To Reproduce
1. Release charm with multi-arch image using charmcraft on amd64 machine (using upload-resource with `ghcr.io/canonical/charmed-postgresql:14.11-22.04_edge@sha256:31cf150b4523481202c1ff9b7b5d7f0b36729edad89d61242d8f1eb56b2912c0`)
2. `juju deploy` charm on arm64 machine
3. Inspect juju debug-log
```
ops.pebble.ChangeError: cannot perform the following tasks:
- Start service "postgresql" (cannot start service: fork/exec /usr/bin/patroni: exec format error)
```
Note: if `juju deploy ./postgresql-k8s.charm --resource postgresql-image=ghcr.io/canonical/charmed-postgresql:14.11-22.04_edge@sha256:31cf150b4523481202c1ff9b7b5d7f0b36729edad89d61242d8f1eb56b2912c0` is used on amd64 or arm64, the charm deploys correctly
### Environment
Ubuntu 22.04 amd64
### charmcraft.yaml
```shell
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-dev" instead of calling "charmcraft pack" directly' >&2
exit 1
fi
build-packages:
- libffi-dev
- libssl-dev
- rustc
- cargo
- pkg-config
- libpq-dev
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
ops.pebble.ChangeError: cannot perform the following tasks:
- Start service "postgresql" (cannot start service: fork/exec /usr/bin/patroni: exec format error)
```
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Fixed multi-architecture resource uploads in Charmcraft 2.7 by PR #1462 (commit 566103b8), ensuring complete OCI images reach Charmhub. | |
| stealth/space-bunny-alpha | — | closed resolved | Fixed in Charmcraft 2.7 by #1462 (566103b8), which added multi-architecture resource uploads so complete OCI images reach Charmhub. | |
| stealth/space-bunny-alpha | — | closed resolved | Fixed in Charmcraft 2.7 by #1708: upload-resource now pushes complete multi-arch OCI images rather than only the host architecture. Local-image behavior remains. | |
| stealth/space-bunny-alpha | — | closed resolved | Fixed by merged PR #2037 (commit e84fd122), which made Skopeo copy every architecture of multi-arch OCI images to Charmhub. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Fixed in Charmcraft 2.7. The upload-resource command now correctly pushes full multi-arch OCI images to Charmhub instead of only the host architecture layer. Future versions may require explicit local Docker daemon paths. | |
| qwen/qwen3.6-35b-a3b | — | — | Fixed in charmcraft 2.7. upload-resource now correctly pushes multi-arch OCI images instead of defaulting to the host architecture. Maintainers noted future versions may require explicit local daemon references. | |
| qwen/qwen3.6-35b-a3b | — | — | Fixed in Charmcraft 2.7. The upload-resource command now correctly handles multi-arch OCI images instead of defaulting to amd64. Maintainers noted potential future deprecation of local image uploads in Charmcraft 4. | |
| qwen/qwen3.6-35b-a3b | — | — | Fixed in Charmcraft 2.7. upload-resource now correctly pushes multi-arch OCI images instead of only the host variant. Maintainers may require explicit docker-daemon: paths in Charmcraft 4. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Fixed in Charmcraft 2.7. The upload-resource command now correctly uploads multi-arch OCI images instead of defaulting to the host architecture. Local upload deprecation remains under consideration for a future major release. |
Update history
No update history recorded yet.
Related work
-
Likely Fixed By:
canonical/charmcraft#1462
(confidence 100%)
Merged PR #1462, commit 566103b8, implemented multi-architecture resource uploads and is identified as the fix released in Charmcraft 2.7.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #2020 Unable to deploy charm using multi-arch OCI uploaded with charmcraft 3 | charmcraft | closed | Fixed in canonical/charmcraft#2037 (commit e84fd122): Skopeo now copies multi-architecture OCI resources with --all, preserving every architecture for deployment. | |
| #350 Can't upload oci-image resources from any registry but Docker Hub | charmcraft | closed | Registry restriction was lifted in Charmcraft 1.1 by PR #391 (commit bf2d2c5e), allowing upload-resource to use local images or images from any registry. | |
| #1462 feat: multi-architecture resource uploads | charmcraft | merged | Merged PR #1462 in commit 566103b8, adding client-side multi-architecture resource uploads to Charmhub per ST104. | |
| #839 Upload resources on charmcraft upload when specified as upstream-resource in the metadata file | charmcraft | closed | Feature request to auto-upload OCI resources during `charmcraft upload` was declined by design: maintainer refused to have Charmcraft copy Docker Hub images into Canonical's registry and cited upload inefficiency; user advised to script it using JSON output. | |
| #1953 Charmcraft 3 should still accept image digests for `upload-resource` | charmcraft | open | Maintainer-filed Charmcraft 3 bug remains open: upload-resource still rejects bare OCI digests because Docker lookup returns only image IDs; no resolving change is present. |