Open
Description
Describe the bug
We use rules_oci Bazel rules to build an OCI image. oci_image delegates to crane by invoking the following commands:
++ external/oci_crane_windows_amd64/crane.exe registry serve --disk=bazel-out/x64_windows-fastbuild/bin/my-project/app-oci-image/blobs --address=localhost:0
++ external/oci_crane_windows_amd64/crane.exe push bazel-out/x64_windows-fastbuild/bin/external/zulu_openjdk_17_single/layout 127.0.0.1:5126/layout:latest
2024/05/08 22:10:47 pushed blob: sha256:4493837effea9d438f4e65387c2590376c9b8f9e67a5a4fc3a09b71c13a27454
2024/05/08 22:10:47 pushed blob: sha256:299e78871a1cc210673f2e2dded580ca4ef6c03d3c2fd21ea876ac425ac89d24
2024/05/08 22:10:47 pushed blob: sha256:96526aa774ef0126ad0fe9e9a95764c5fc37f409ab9e97021e7b47a5d82bf6fa
2024/05/08 22:10:47 pushed blob: sha256:808b0c9c38bef5adc6d2a46ff90e81fdb2e8f5b10a5c30edf5e7b3ddcc40ae8c
2024/05/08 22:10:47 127.0.0.1:5126/layout:latest: digest: sha256:4be37c87d550ce8a5aa3f3088843686e9f138112d397a434d7be081a1221b776 size: 949
++ external/oci_crane_windows_amd64/crane.exe --verbose mutate 127.0.0.1:5126/layout@sha256:4be37c87d550ce8a5aa3f3088843686e9f138112d397a434d7be081a1221b776 --append=bazel-out/x64_windows-fastbuild/bin/my-project/app-tar.tar --entrypoint=java,-jar,Application.jar
(...)
2024/05/08 22:10:51 --> PUT http://127.0.0.1:5126/v2/layout/blobs/uploads/3249378995400909334?digest=sha256%3A0401ae60059d7270e280bdd6da0d3b91afcf5b34be7871d39c2af02534b9257b [body redacted: omitting binary blobs from logs]
2024/05/08 22:10:51 PUT /v2/layout/blobs/uploads/3249378995400909334?digest=sha256%3A0401ae60059d7270e280bdd6da0d3b91afcf5b34be7871d39c2af02534b9257b HTTP/1.1
Host: 127.0.0.1:5126
User-Agent: crane.exe/0.18.0 go-containerregistry/0.18.0
Content-Length: 0
Content-Type: application/octet-stream
Accept-Encoding: gzip
2024/05/08 22:10:52 <-- 201 http://127.0.0.1:5126/v2/layout/blobs/uploads/3249378995400909334?digest=sha256%3A0401ae60059d7270e280bdd6da0d3b91afcf5b34be7871d39c2af02534b9257b (1.0634894s) [body redacted: omitting binary blobs from logs]
2024/05/08 22:10:52 HTTP/1.1 201 Created
Content-Length: 0
Date: Wed, 08 May 2024 20:10:52 GMT
Docker-Content-Digest: sha256:0401ae60059d7270e280bdd6da0d3b91afcf5b34be7871d39c2af02534b9257b
2024/05/08 22:10:52 pushed blob: sha256:0401ae60059d7270e280bdd6da0d3b91afcf5b34be7871d39c2af02534b9257b
2024/05/08 22:10:52 --> PUT http://127.0.0.1:5126/v2/layout/manifests/sha256:4d47a76f3f8000bb48a75f6b3d9109c05ddf1b2ee5b2f43a399f8cead7cef211
2024/05/08 22:10:52 PUT /v2/layout/manifests/sha256:4d47a76f3f8000bb48a75f6b3d9109c05ddf1b2ee5b2f43a399f8cead7cef211 HTTP/1.1
Host: 127.0.0.1:5126
User-Agent: crane.exe/0.18.0 go-containerregistry/0.18.0
Content-Length: 921
Content-Type: application/vnd.docker.distribution.manifest.v2+json
Accept-Encoding: gzip
{"schemaVersion":2,"mediaType":"application/vnd.docker.distribution.manifest.v2+json","config":{"mediaType":"application/vnd.docker.container.image.v1+json","size":3108,"digest":"sha256:8f29baa7207585c1c03df3f6245511450518407dab1f51e06716e63e66a29388"},"layers":[{"mediaType":"application/vnd.docker.image.rootfs.diff.tar.gzip","size":3401967,"digest":"sha256:96526aa774ef0126ad0fe9e9a95764c5fc37f409ab9e97021e7b47a5d82bf6fa"},{"mediaType":"application/vnd.docker.image.rootfs.diff.tar.gzip","size":148202573,"digest":"sha256:808b0c9c38bef5adc6d2a46ff90e81fdb2e8f5b10a5c30edf5e7b3ddcc40ae8c"},{"mediaType":"application/vnd.docker.image.rootfs.diff.tar.gzip","size":1402,"digest":"sha256:4493837effea9d438f4e65387c2590376c9b8f9e67a5a4fc3a09b71c13a27454"},{"mediaType":"application/vnd.docker.image.rootfs.diff.tar.gzip","size":204855955,"digest":"sha256:0401ae60059d7270e280bdd6da0d3b91afcf5b34be7871d39c2af02534b9257b"}]}
2024/05/08 22:10:52 <-- 201 http://127.0.0.1:5126/v2/layout/manifests/sha256:4d47a76f3f8000bb48a75f6b3d9109c05ddf1b2ee5b2f43a399f8cead7cef211 (436.6┬Ás)
2024/05/08 22:10:52 HTTP/1.1 201 Created
Content-Length: 0
Date: Wed, 08 May 2024 20:10:52 GMT
Docker-Content-Digest: sha256:4d47a76f3f8000bb48a75f6b3d9109c05ddf1b2ee5b2f43a399f8cead7cef211
2024/05/08 22:10:52 127.0.0.1:5126/layout@sha256:4d47a76f3f8000bb48a75f6b3d9109c05ddf1b2ee5b2f43a399f8cead7cef211: digest: sha256:4d47a76f3f8000bb48a75f6b3d9109c05ddf1b2ee5b2f43a399f8cead7cef211 size: 921
+ REF=127.0.0.1:5126/layout@sha256:4d47a76f3f8000bb48a75f6b3d9109c05ddf1b2ee5b2f43a399f8cead7cef211
+ '[' 0 -ne 0 ']'
+ external/oci_crane_windows_amd64/crane.exe pull 127.0.0.1:5126/layout@sha256:4d47a76f3f8000bb48a75f6b3d9109c05ddf1b2ee5b2f43a399f8cead7cef211 ./bazel-out/x64_windows-fastbuild/bin/myproject/app-oci-image --format=oci --annotate-ref
+ mv bazel-out/x64_windows-fastbuild/bin/myproject/app-oci-image/index.json bazel-out/x64_windows-fastbuild/bin/myproject/app-oci-image/temp.json
+ external/jq_windows_amd64/jq.exe --arg ref 127.0.0.1:5126/layout@sha256:4d47a76f3f8000bb48a75f6b3d9109c05ddf1b2ee5b2f43a399f8cead7cef211 '.manifests |= map(select(.annotations["org.opencontainers.image.ref.name"] == $ref)) | del(.manifests[0].annotations)' bazel-out/x64_windows-fastbuild/bin/myproject/app-oci-image/temp.json
+ rm bazel-out/x64_windows-fastbuild/bin/myproject/app-oci-image/temp.json
+ external/oci_crane_windows_amd64/crane.exe layout gc ./bazel-out/x64_windows-fastbuild/bin/myproject/app-oci-image
Error: cannot parse hash: "sha256\\0401ae60059d7270e280bdd6da0d3b91afcf5b34be7871d39c2af02534b9257b"
--./bazel-out/x64_windows-fastbuild/bin/myproject/app-oci-image
|-- oci-layout
|-- index.json
|--blobs
|--sha256
|--4d47a76f3f8000bb48a75f6b3d9109c05ddf1b2ee5b2f43a399f8cead7cef211
|--8f29baa7207585c1c03df3f6245511450518407dab1f51e06716e63e66a29388
|--299e78871a1cc210673f2e2dded580ca4ef6c03d3c2fd21ea876ac425ac89d24
|--0401ae60059d7270e280bdd6da0d3b91afcf5b34be7871d39c2af02534b9257b
|--808b0c9c38bef5adc6d2a46ff90e81fdb2e8f5b10a5c30edf5e7b3ddcc40ae8c
|--96526aa774ef0126ad0fe9e9a95764c5fc37f409ab9e97021e7b47a5d82bf6fa
|--4493837effea9d438f4e65387c2590376c9b8f9e67a5a4fc3a09b71c13a27454
oci-layout
{
"imageLayoutVersion": "1.0.0"
}
index.json
{
"schemaVersion": 2,
"mediaType": "application/vnd.oci.image.index.v1+json",
"manifests": [
{
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"size": 921,
"digest": "sha256:4d47a76f3f8000bb48a75f6b3d9109c05ddf1b2ee5b2f43a399f8cead7cef211"
}
]
}
Looks like at some point crane uses Windows path separator "\" instead of ":".
Additional context
0.18.0