| Type |
Bug
|
| Priority |
Normal
|
| Assignee | |
| Affected Versions |
17.2.0
|
| Labels |
No labels
|
Issue Votes (0)
| Type |
Bug
|
| Priority |
Normal
|
| Assignee | |
| Affected Versions |
17.2.0
|
| Labels |
No labels
|
Version: 16.9.7 and 17.2.0 (the code is unchanged on main at c1899e02c6)
Description
When a manifest is pushed to the built-in container registry (
PUT /v2/<name>/manifests/<reference>), OneDev stores it and answers200 OK. The OCI Distribution Specification requires201 Createdfor this request:The
LocationandDocker-Content-Digestheaders are already present, so only the status code differs. Blob uploads already return201 Createdcorrectly.Impact
Clients that follow the specification treat the response as a failure even though the manifest has been stored. oras exits with status 1 and reports:
oras-go accepts only
201for a manifest push (registry/remote/repository.go). Docker, buildx and containerd accept200, so ordinary image pushes do not show the problem.Cause
server-plugin/server-plugin-pack-container/src/main/java/io/onedev/server/plugin/pack/container/ContainerServlet.java, line 381 in the manifestPUTbranch:Suggested fix
SC_CREATEDis already imported in this file and used for blob uploads.Steps to reproduce
1dev/server:17.2.0) and create a project with package management enabled.POST /v2/<project>/<repo>/blobs/uploads/followed byPUT <location>?digest=sha256:…. Both return201 Created.PUT /v2/<project>/<repo>/manifests/v1withContent-Type: application/vnd.oci.image.manifest.v1+jsonand an image manifest that references the two blobs.200 OK. Expected:201 Created.registry:2) return201 Created.oras push --plain-http <host>/<project>/<repo>:v1 file(oras 1.2.3) fails with the error above, yetGET /v2/<project>/<repo>/manifests/v1returns the manifest.The same result was observed on 16.9.7.