bazel-contrib / rules_oci

Bazel rules for building OCI containers
Apache License 2.0
281 stars 147 forks source link

oci_push to gcr.io with image_index fails aas image index child manifest not supported #241

Closed Geethree closed 3 months ago

Geethree commented 1 year ago

As discussed in slack, here is a minimum reproduction of the issue. https://github.com/Geethree/rules_oci_gcr_push/tree/g3/gcr-image-index-failure

The failure in question

geethree@masterblaster:~/playground/rules_oci_gcr_push$ bazel run //:push -- --repository gcr.io/personal-gcp-project/g3-test
INFO: Analyzed target //:push (28 packages loaded, 392 targets configured).
INFO: Found 1 target...
Target //:push up-to-date:
  bazel-bin/push_push.sh
INFO: Elapsed time: 1.903s, Critical Path: 0.21s
INFO: 7 processes: 6 internal, 1 linux-sandbox.
INFO: Build completed successfully, 7 total actions
INFO: Running command line: bazel-bin/push_push.sh --repository gcr.io/personal-gcp-project/g3-test
2023/05/11 13:11:40 existing blob: sha256:c6f4d1a13b699c8490910fd4fd6c7056b90fd0da3077e4f29b4bd27bf0bae6cd
2023/05/11 13:11:40 existing blob: sha256:e8614d09b7bebabd9d8a450f44e88a8807c98a438a2ddd63146865286b132d1b
2023/05/11 13:11:41 pushed blob: sha256:ab94487e5e8764b4be172ac0d2fb41cdd17b481b014a5f540eca6ab0410db2bb
2023/05/11 13:11:42 pushed blob: sha256:8c65566936b18490d283704ee7d39f70c9a01fc11139393c3e1f34a1b8161ac3
2023/05/11 13:11:42 gcr.io/personal-gcp-project/g3-test@sha256:411e55d4b8787159e8c459b8f22c274a38e3e7dbd3eb7c11994e9727d2e2c863: digest: sha256:411e55d4b8787159e8c459b8f22c274a38e3e7dbd3eb7c11994e9727d2e2c863 size: 754
Error: PUT https://gcr.io/v2/personal-gcp-project/g3-test/manifests/sha256:135c523296c64083449a518ea3283b6cacfdfd60497a9fe658d4b2ab26e52b3d: MANIFEST_INVALID: Failed to parse manifest for request "/v2/personal-gcp-project/g3-test/manifests/sha256:135c523296c64083449a518ea3283b6cacfdfd60497a9fe658d4b2ab26e52b3d": Image index child manifest not supported: application/vnd.docker.distribution.manifest.v2+json.

I notice that I see this failure when pushing an oci_image_index -> gcr.io, and this isn't the case when I push the oci_image

josephglanville commented 1 year ago

This isn't a bug. GCR doesn't support this and is essentially deprecated, see https://cloud.google.com/artifact-registry/docs/transition/gcr-on-ar

AR correctly supports OCI manifests.

Geethree commented 1 year ago

That makes sense. We can probably throw a helpful error then.

thesayyn commented 9 months ago

That makes sense. We can probably throw a helpful error then.

Can you file an issue in google/go-containerregistry repository?

thesayyn commented 3 months ago

This is duplicate of https://github.com/bazel-contrib/rules_oci/issues/530