Merge pull request #11656 from Luap99/compat-id

compat API: /images/json prefix image id with sha256
This commit is contained in:
OpenShift Merge Robot 2021-09-20 12:34:44 -04:00 committed by GitHub
commit 4cdffd0714
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -183,7 +183,8 @@ func ImageToImageSummary(l *libimage.Image) (*entities.ImageSummary, error) {
}
is := entities.ImageSummary{
ID: l.ID(),
// docker adds sha256: in front of the ID
ID: "sha256:" + l.ID(),
ParentId: imageData.Parent,
RepoTags: imageData.RepoTags,
RepoDigests: imageData.RepoDigests,

View File

@ -32,6 +32,9 @@ class ImageTestCase(APITestCase):
for k in required_keys:
self.assertIn(k, item)
# Id should be prefixed with sha256: (#11645)
self.assertIn("sha256:",item['Id'])
def test_inspect(self):
r = requests.get(self.podman_url + "/v1.40/images/alpine/json")
self.assertEqual(r.status_code, 200, r.text)
@ -59,6 +62,8 @@ class ImageTestCase(APITestCase):
for item in required_keys:
self.assertIn(item, image)
_ = parse(image["Created"])
# Id should be prefixed with sha256: (#11645)
self.assertIn("sha256:",image['Id'])
def test_delete(self):
r = requests.delete(self.podman_url + "/v1.40/images/alpine?force=true")