← Back to issue list

Charmcraft 3 should still accept image digests for `upload-resource`

View original Github issue

Metadata

Project
charmcraft
Number
#1953
Type
issue
State
open
Author
lengau
Labels
—
Created
Updated
Closed
—

Current evaluation

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.

Suggested action: keep open

Reason: The checked-out implementation still routes --image through ImageService.get_maybe_id_from_docker, which calls docker.images.get(name) and returns image.id; it has no RepoDigests or images.list matching, so a bare sha256: value reaches the "Unknown OCI image reference" path. The report provides an exact invocation and concrete implementation direction, while git history shows no subsequent digest-resolution fix and the only recent comment is an automated ticket notice.

Evaluated by: mr-cal-bot

Impact: 55 Quick Win: 31 Complexity: 38 Confidence: 92 Actionability: 90

Issue body

### Bug Description Charmcraft 3 doesn't accept digests, just image IDs, when uploading a resource. Solution: Reimplement [this method](https://github.com/canonical/charmcraft/blob/c13f20ae65b6a4d3657dcdd30b2f606ccae86163/charmcraft/commands/store/registry.py#L314-L342) on the ImageService. It can use Docker's [images.list()](https://docker-py.readthedocs.io/en/stable/images.html#docker.models.images.ImageCollection.list) method and find the digest under `image.attrs["RepoDigests"]`. Note that these digests are in `<name>@<hash-algo>:<hash>` form, so you'll need to check if it matches a regex something like `".+@([a-z0-9]+:)?{digest}"` (so it works with just the hash or algo:hash). ### To Reproduce See: https://discourse.charmhub.io/t/publish-your-charm-on-charmhub/12281/6?u=lengau ### Environment n/a ### charmcraft.yaml ```yaml n/a ``` ### Relevant log output ```shell $ charmcraft upload-resource loki-worker-k8s loki-image --image=sha256:583ddc10f52bb4fe4806baa05ecbaa2a3246238f1423bd2a6c35b02fd87b446c Unknown OCI image reference. Recommended resolution: Pass a valid container transport string. Full execution log: '/home/jose/.local/state/charmcraft/log/charmcraft-20240801-171905.784405.log' ```

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha
Impact: 55
Quick Win: 31
Complexity: 38
Confidence: 92
Actionability: 90
keep 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.
qwen/qwen3.6-35b-a3b
Impact: 60
Quick Win: 34
Complexity: 30
Confidence: 85
Actionability: 80
keep open Charmcraft 3 rejects image digests in `upload-resource --image` because `get_maybe_id_from_docker` only resolves by name/tag, not digest. Issue remains open with no fix implemented.
qwen/qwen3.8-27b
Impact: 50
Quick Win: 35
Staleness: 55
Complexity: 30
Confidence: 72
Support Request: 0
needs triage Charmcraft 3 `upload-resource` rejects bare image digests (e.g. sha256:…) that charmcraft 2 accepted; the ImageService lacks a digest-based lookup via RepoDigests. Unlabeled, no maintainer response, only a bot Jira-sync comment.
qwen/qwen3.6-35b-a3b
Staleness: 85
Complexity: 20
Confidence: 90
Support Request: 10
needs triage Charmcraft 3 rejects image digests for upload-resource, only accepting image IDs. Provides a code fix using Docker's image list API. Currently unlabelled and awaiting maintainer triage after over a year.
qwen3.6-35b-a3b-mtp-q6
Staleness: 85
Complexity: 30
Confidence: 75
Support Request: 10
needs triage Charmcraft 3 rejects image digests for upload-resource, only accepting image IDs. Requires reimplementing digest resolution in ImageService. Currently unlabelled with no maintainer response.
qwen3.6-35b-a3b-mtp-q6
Staleness: 90
Complexity: 45
Confidence: 75
Support Request: 10
needs triage Charmcraft 3 rejects image digests for upload-resource, only accepting image IDs. The report includes reproduction steps and a proposed fix but lacks labels and maintainer response after over a year.

Update history

No update history recorded yet.

Related work

  • Related To: charmcraft#906 (confidence 70%)

    Historical upload-resource image-argument issue; it provides context for Charmcraft 3's skopeo migration but is not a resolving fix for #1953.

Related issues

Issue Project State Summary Similarity
#444 unable to upload oci-image resource from dockerhub using image digest charmcraft closed Closed by maintainer facundobatista as superseded: charmcraft 1.1.1 (in candidate at the time) reworked OCI uploads to push images from the local machine and always reference them by digest, so the reported remote-digest limitation no longer applied.
77%
#906 `charmcraft upload-resource` 2.1.0 removes ability to pass tagged image names to `--image` argument charmcraft closed Tagged-name support was not restored; affected teams migrated to digests. Charmcraft 3.1.0 later replaced legacy image handling with skopeo uploads in #1696.
75%
#871 Support both image id and digest when uploading oci-image resources (CRAFT-1324). charmcraft merged Merged in canonical/charmcraft#871 via commit cefabea2, adding OCI image ID and digest support, faster local-ID handling, clearer missing-image errors, and resolution of #853.
73%
#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.
72%
#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.
71%
#1685 Multi-arch OCI image incorrectly uploaded to Charmhub registry charmcraft closed Fixed multi-architecture resource uploads in Charmcraft 2.7 by PR #1462 (commit 566103b8), ensuring complete OCI images reach Charmhub.
71%