Story #3137
closedAs a user, I can view docker image Arch and Size Information through the REST API
100%
Description
As the result of this story it will be possible to see:
- arch and os of each image manifest listed within the manifest list queried trough Pulp API. Information will be added to the ManifestList model.
- size of each blob listed within the image manifest queried trough Pulp API. Information will be added to the Manifest model.
The information ( if available) will be taken from the manifest.json or manifest_list.json file returned from the registry.
Possible example of manifest list representation:
[
{
"updated": "2018-06-22T15:19:30Z",
"repo_id": "ina",
"created": "2018-06-22T15:19:30Z",
"unit_id": "06757e06-1c3c-4c4e-82d7-63fefb184935",
"unit_type_id": "docker_manifest_list",
"_id": {
"$oid": "5b2d1382c46f69d5b7f5258d"
},
"metadata": {
"_storage_path": "/var/lib/pulp/content/units/docker_manifest_list/43/a3683c58bce95e87474617e309bf1182a7a157c8d4616c44a8bf4ccc811e63/sha256:141c253bc4c3fd0a201d32dc1f493bcf3fff003b6df416dea4f41046e0f37d47",
"_id": "06757e06-1c3c-4c4e-82d7-63fefb184935",
"_ns": "units_docker_manifest_list",
"_last_updated": 1529680770,
"amd64_schema_version": 2,
"schema_version": 2,
"manifests": [
{"digest": "sha256:74f634b1bc1bd74535d5209589734efbd44a25f4e2dc96d78784576a3eb5b335",
"os": "linux",
"arch": "arm64"
},
{"digest": "sha256:35e28b647bd4976b7cacfaa32b7b253817d0881d77b6cda731ad46a29d08c2cb",
"os" :"linux",
"arch": "ppc64le"
},
{"digest: "sha256:420befcb0c197618f0252108d553d8a112e291e2a6a75d8a2b4933f511480ea3",
"os": "linux",
"arch": "s390x"
}
],
"downloaded": true,
"pulp_user_metadata": {},
"_content_type_id": "docker_manifest_list",
"amd64_digest": "sha256:74f634b1bc1bd74535d5209589734efbd44a25f4e2dc96d78784576a3eb5b335",
"digest": "sha256:141c253bc4c3fd0a201d32dc1f493bcf3fff003b6df416dea4f41046e0f37d47"
}
}
]
Possible example of image manifest representation:
[
{
"updated": "2018-06-22T15:19:30Z",
"repo_id": "ina",
"created": "2018-06-22T15:19:30Z",
"unit_id": "0c966ae4-320d-43a0-a11c-42b3aa968824",
"unit_type_id": "docker_manifest",
"_id": {
"$oid": "5b2d1382c46f69d5b7f52590"
},
"metadata": {
"_storage_path": "/var/lib/pulp/content/units/docker_manifest/db/a1aa28355611292550bdfe7fcd7bcc793cc85892bffdb1ef1792c466960539/sha256:420befcb0c197618f0252108d553d8a112e291e2a6a75d8a2b4933f511480ea3",
"_ns": "units_docker_manifest",
"_last_updated": 1529680770,
"fs_layers": [
{
"layer_type": "application/vnd.docker.image.rootfs.diff.tar.gzip",
"blob_sum": "sha256:eac115b78508fb249ed57f4e00662f90304fa86496413f393fdc1e2d5d793d83",
"size" : 1234567
}
],
"schema_version": 2,
"downloaded": true,
"pulp_user_metadata": {},
"_content_type_id": "docker_manifest",
"config_layer": "sha256:e6631e66b5519df3fb0ff6e5dc29b168f1d7adb9da3c04092f1894e15c2ca2b3",
"_id": "0c966ae4-320d-43a0-a11c-42b3aa968824",
"digest": "sha256:420befcb0c197618f0252108d553d8a112e291e2a6a75d8a2b4933f511480ea3"
}
},
]
Note because none of the above fields( size, os, arch) are required by the registry API specification, they can be missing from the json file, that means - the values in Pulp are populated based on the availability of those in the json file returned from the registry.
For more information on what is defined on manifest list, image manifest schema2, image manifest schema1 check specs [0][1][2]
[0] https://docs.docker.com/registry/spec/manifest-v2-2/#example-manifest-list
[1] https://docs.docker.com/registry/spec/manifest-v2-2/#example-image-manifest
[2] https://docs.docker.com/registry/spec/manifest-v2-1/#example-manifest
Related issues
Add arch, os field to ManifestList. Add size field to Manifest layers
closes #3137 https://pulp.plan.io/issues/3137