delete artifact_version fails with 500 'unknown algorithm prefix' for digest-based versions
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 65/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- docker, go
- Lĩnh vực
- backend-api-design, cli
Hướng nghiên cứu
Look at the CLI's delete command for artifact_version, likely in the 'har' plugin code. The bug is in parsing the digest string 'sha256:...' where the colon is mishandled. Start by finding the API endpoint construction and the digest parsing logic. Check how the version segment is split and sent to the backend. The workaround shows the underlying registry API works, so the fix is in the CLI or its backend wrapper. Test by reproducing the error locally with a mock or a test registry.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
harness delete artifact_version <registry/artifact/version> always fails with a 500 when
<version> is a content digest (sha256:...), which is the only version identifier
harness list artifact_version / harness get artifact_version return for Docker artifacts
pushed via docker buildx (no tag-based version lookup is exposed by get/list either —
attempting <registry>/<artifact>/<tag-name> as the version segment 404s instead).
$ harness delete artifact_version "<registry>/<artifact>/sha256:<64-hex-digest>" --level org --org <ORG> --force
API error 500: failed to delete artifact version: failed to parse digest: unknown algorithm prefix "sh"
The error string (unknown algorithm prefix "sh") strongly suggests the backend is
mis-splitting the digest string on its : — "sha256" becomes "sh" plus a leftover
remainder, rather than "sha256" + "<hex>".
This affects any Docker artifact version whose only "version" identifier is a content
digest — i.e. essentially every image pushed via docker buildx build --push without
disable_retag/dockerspec-style extra tags, since harness list artifact_version names
the version by digest, not by tag.
Steps to reproduce
- Push any Docker image to a Harness Artifact Registry (native
har-backed registry,DOCKERpackage type), e.g. viadocker buildx build --pushor a Harness CIBuildAndPushDockerRegistrystep. harness list artifact_version <registry>/<artifact> --level org --org <ORG> --all --format json— confirm the pushed version is listed only by its digest (namefield =sha256:...), with its tag(s) undermetadata.tags.harness get artifact_version "<registry>/<artifact>/sha256:<digest>" --level org --org <ORG>— succeeds, returns the version metadata correctly.harness delete artifact_version "<registry>/<artifact>/sha256:<digest>" --level org --org <ORG> --force— fails with the 500 above.
Debug output (--debug) shows the CLI constructs and sends this request:
DELETE /har/api/v1/registry/<ACCOUNT_ID>/<ORG>/<registry>/+/artifact/<artifact>/+/version/sha256:<digest>?accountIdentifier=<ACCOUNT_ID>&orgIdentifier=<ORG>
→ 500 {"failed to delete artifact version: failed to parse digest: unknown algorithm prefix \"sh\""}
I also tried URL-encoding the colon in the version segment (sha256%3A<digest>) client-side —
same result, since the CLI (or the server) appears to normalize/decode it back to a literal
: before constructing the request.
Expected behavior
harness delete artifact_version should successfully delete a version identified by its
content digest, exactly as returned by harness list artifact_version / accepted by
harness get artifact_version.
Workaround used
Bypassed the CLI/har module entirely and used the standard OCI Distribution / Docker
Registry v2 HTTP API directly against the same registry endpoint:
# 1. Get a delete-scoped bearer token (reusing existing local `docker login` credentials
# for the registry host, read from ~/.docker/config.json)
TOKEN=$(curl -s -u "<user>:<pass>" \
"https://<registry-host>/v2/token?service=harness-artifact-registry&scope=repository:<account>/<registry>/<artifact>:pull,push,delete" \
| jq -r .token)
# 2. Delete the manifest by digest via the standard registry API
curl -X DELETE -H "Authorization: Bearer $TOKEN" \
"https://<registry-host>/v2/<account>/<registry>/<artifact>/manifests/sha256:<digest>"
# -> 202 Accepted
This confirms the underlying registry itself supports manifest deletion by digest just fine —
the bug is specifically in the har CLI plugin's (or its backend API's) request path/digest
handling for the delete artifact_version verb.
Environment
harnessCLI version: 3.6.2harplugin version: 0.9.3 (us-docker.pkg.dev/...— bundled plugin, not separately installed)- OS/Arch: darwin/arm64
- Ngôn ngữ chính
- Go
- Star
- 29
- Fork
- 24
- Merge trung bình
- 1 ngày 9 giờ
- Pull request đã merge (30 ngày)
- 111
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của harness/cli
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 45/100
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
Project submission: SpecWithCodeĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
slavakurilyak/awesome-ai-agents#1137 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Make the HTTP server's keep-alive and headers timeouts configurableCó thể đã có người làm @mattgodbolt đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
compiler-explorer/compiler-explorer#9902 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
ready-for-agent
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
jordansmall/spindrift#7895 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation priority: medium skill: intermediate status: ready for dev
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
hyperledger-labs/fabric-smart-client#2830 ·
Maintainer thường phản hồi trong vòng 1 ngày