Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Push a CNAB Bundle to GCR fails #69

Open
silvin-lubecki opened this issue Sep 4, 2019 · 2 comments
Open

Push a CNAB Bundle to GCR fails #69

silvin-lubecki opened this issue Sep 4, 2019 · 2 comments
Labels
bug Something isn't working

Comments

@silvin-lubecki
Copy link
Collaborator

Pushing a CNAB bundle to gcr.io returns an error:

Error: error while pushing bundle config manifest: unexpected status: 400 Bad Request

After some investigation, we found multiple caveats:

  • The bundle manifest itself had only a config field and a null layer field. This was fixed in Add a layer for the bundle config manifest #64 , adding a dummy layer pointing to the config object itself (it adds duplication)
  • When using external (mostly multi architecture images) images for services, we are potentially mixing different format representations: one service can be a manifest list, another an OCI index, and the CNAB itself be an OCI index too. This mix is not supported by gcr (and maybe other registries too). I think we can't guarantee that every service image will share the same format, so the minimum we can do is to fail if we detect a mix between images. That said, we need to also improve cnab-to-oci to detect which format we should use, depending the one found in the service images, instead of the fallback mechanism (try with OCI Index then Docker Manifest List).
@silvin-lubecki
Copy link
Collaborator Author

From docker/app#562

@silvin-lubecki silvin-lubecki added the bug Something isn't working label Sep 4, 2019
@glyn
Copy link

glyn commented Sep 4, 2019

I'm not sure #64 is a complete fix as I hit the problem when building at master (2770131). Here are steps to reproduce:

  1. Grab this sample bundle.json
  2. Issue: cnab-to-oci --log-level debug push bundle.json -t gcr.io/<your project>/cnab-to-oci-sample
  3. Fails, where <your project> is cf-sandbox-gnormington with:
DEBU[0000] Fixing up bundle gcr.io/cf-sandbox-gnormington/cnab-to-oci-sample
DEBU[0000] Fixing image glyn/cnab-to-oci-sample-cnab:e923b473656ef515302cd8daf8d734e07ea0a1ac
Starting to copy image glyn/cnab-to-oci-sample-cnab:e923b473656ef515302cd8daf8d734e07ea0a1ac...
Completed image glyn/cnab-to-oci-sample-cnab:e923b473656ef515302cd8daf8d734e07ea0a1ac copy
DEBU[0003] Fixing image hello-world@sha256:92c7f9c92844bbbb5d0a101b22f7c2a7949e40f8ea90c8b3bc396879d95e899a
Starting to copy image hello-world@sha256:92c7f9c92844bbbb5d0a101b22f7c2a7949e40f8ea90c8b3bc396879d95e899a...
Completed image hello-world@sha256:92c7f9c92844bbbb5d0a101b22f7c2a7949e40f8ea90c8b3bc396879d95e899a copy
DEBU[0004] Bundle fixed
DEBU[0004] Pushing CNAB Bundle gcr.io/cf-sandbox-gnormington/cnab-to-oci-sample
DEBU[0004] Pushing CNAB Bundle Config
DEBU[0004] Trying to push CNAB Bundle Config
DEBU[0004] CNAB Bundle Config Descriptor
DEBU[0004] {
  "mediaType": "application/vnd.cnab.config.v1+json",
  "digest": "sha256:99bb324f7d14e36aa9871920df164d04956e51e5d5b5e44c4d1dc36324200e11",
  "size": 100
}
DEBU[0004] Trying to push CNAB Bundle Config Manifest
DEBU[0004] CNAB Bundle Config Manifest Descriptor
DEBU[0004] {
  "mediaType": "application/vnd.oci.image.manifest.v1+json",
  "digest": "sha256:88c71a3786a9fd8801f09985e4e5142a316f32864a70513f1cf88c186b424026",
  "size": 188
}
DEBU[0005] Failed to push CNAB Bundle Config Manifest, trying with a fallback method
DEBU[0005] Trying to push CNAB Bundle Config
DEBU[0005] CNAB Bundle Config Descriptor
DEBU[0005] {
  "mediaType": "application/vnd.oci.image.config.v1+json",
  "digest": "sha256:99bb324f7d14e36aa9871920df164d04956e51e5d5b5e44c4d1dc36324200e11",
  "size": 100
}
DEBU[0005] Trying to push CNAB Bundle Config Manifest
DEBU[0005] CNAB Bundle Config Manifest Descriptor
DEBU[0005] {
  "mediaType": "application/vnd.oci.image.manifest.v1+json",
  "digest": "sha256:fd7309a61ab1cb5ff783f78801b5edc667b836f95b56a5a4755051b1550fbbab",
  "size": 193
}
DEBU[0006] Failed to push CNAB Bundle Config Manifest, trying with a fallback method
DEBU[0006] Trying to push CNAB Bundle Config
DEBU[0006] CNAB Bundle Config Descriptor
DEBU[0006] {
  "mediaType": "application/vnd.docker.container.image.v1+json",
  "digest": "sha256:99bb324f7d14e36aa9871920df164d04956e51e5d5b5e44c4d1dc36324200e11",
  "size": 100
}
DEBU[0006] Trying to push CNAB Bundle Config Manifest
DEBU[0006] CNAB Bundle Config Manifest Descriptor
DEBU[0006] {
  "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
  "digest": "sha256:c12e12dd0993fcd5826668f14b4fec9215c8f12a20c956ea40f8e0c39d8b836c",
  "size": 520
}
DEBU[0006] CNAB Bundle Config pushed
DEBU[0006] Pushing CNAB Index
DEBU[0006] Trying to push OCI Index
DEBU[0006] {"schemaVersion":2,"manifests":[{"mediaType":"application/vnd.docker.distribution.manifest.v2+json","digest":"sha256:c12e12dd0993fcd5826668f14b4fec9215c8f12a20c956ea40f8e0c39d8b836c","size":520,"annotations":{"io.cnab.manifest.type":"config"}},{"mediaType":"application/vnd.docker.distribution.manifest.v2+json","digest":"sha256:65747a4dd330a0062b4288f8d500cd96dbcb140f7086548557504ad63c9fa6e2","size":1364,"annotations":{"io.cnab.manifest.type":"invocation"}},{"mediaType":"application/vnd.docker.distribution.manifest.v2+json","digest":"sha256:92c7f9c92844bbbb5d0a101b22f7c2a7949e40f8ea90c8b3bc396879d95e899a","size":524,"annotations":{"io.cnab.component.name":"simple-image","io.cnab.manifest.type":"component"}}],"annotations":{"io.cnab.runtime_version":"v1.0.0-WD","org.opencontainers.artifactType":"application/vnd.cnab.manifest.v1","org.opencontainers.image.authors":"[{\"name\":\"Glyn Normington\"}]","org.opencontainers.image.description":"","org.opencontainers.image.title":"cnab-to-oci-sample","org.opencontainers.image.version":"0.1.0"}}
DEBU[0006] OCI Index Descriptor
DEBU[0006] {
  "mediaType": "application/vnd.oci.image.index.v1+json",
  "digest": "sha256:0cbc68985d57a86c4a36a00fa2b766b3f47b0f93ba98924a14b1a467a001201d",
  "size": 1049
}
DEBU[0006] Unable to push OCI Index: unexpected status: 400 Bad Request
DEBU[0006] Trying to push Index with Manifest list as fallback
DEBU[0006] {"schemaVersion":2,"manifests":[{"mediaType":"application/vnd.docker.distribution.manifest.v2+json","digest":"sha256:c12e12dd0993fcd5826668f14b4fec9215c8f12a20c956ea40f8e0c39d8b836c","size":520,"annotations":{"io.cnab.manifest.type":"config"}},{"mediaType":"application/vnd.docker.distribution.manifest.v2+json","digest":"sha256:65747a4dd330a0062b4288f8d500cd96dbcb140f7086548557504ad63c9fa6e2","size":1364,"annotations":{"io.cnab.manifest.type":"invocation"}},{"mediaType":"application/vnd.docker.distribution.manifest.v2+json","digest":"sha256:92c7f9c92844bbbb5d0a101b22f7c2a7949e40f8ea90c8b3bc396879d95e899a","size":524,"annotations":{"io.cnab.component.name":"simple-image","io.cnab.manifest.type":"component"}}],"annotations":{"io.cnab.runtime_version":"v1.0.0-WD","org.opencontainers.artifactType":"application/vnd.cnab.manifest.v1","org.opencontainers.image.authors":"[{\"name\":\"Glyn Normington\"}]","org.opencontainers.image.description":"","org.opencontainers.image.title":"cnab-to-oci-sample","org.opencontainers.image.version":"0.1.0"},"mediaType":"application/vnd.docker.distribution.manifest.list.v2+json"}
DEBU[0006] Manifest list Descriptor
DEBU[0006] {
  "mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
  "digest": "sha256:d84e8186a3cac7f71d0fc7c84e4a28dbf2a7bb4bc802fe881f6666bdb274c644",
  "size": 1121
}
DEBU[0007] Unable to push Index with Manifest list: unexpected status: 400 Bad Request
Error: unexpected status: 400 Bad Request

However, it works when pushing to docker hub. But, when I tried to copy the bundle from docker hub to GCR, I got the following error which may give a clue to the problem:

copy failed: failed to write image gcr.io/cf-sandbox-gnormington/cnab-to-oci-master-copied: failed to write image index gcr.io/cf-sandbox-gnormington/cnab-to-oci-master-copied: MANIFEST_INVALID: Failed to parse manifest for request "/v2/cf-sandbox-gnormington/cnab-to-oci-master-copied/manifests/sha256:fd7309a61ab1cb5ff783f78801b5edc667b836f95b56a5a4755051b1550fbbab": Manifest is missing required field "layers".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants