Skip to content

Commit

Permalink
Removing "sha256:" prefix in hash values returned by docker's runner …
Browse files Browse the repository at this point in the history
…inspect command. (mlcommons#318)
  • Loading branch information
sergey-serebryakov committed Jul 24, 2023
1 parent 3b3fffc commit daccf94
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion runners/mlcube_docker/mlcube_docker/docker_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,4 +376,7 @@ def inspect(self, force: bool = False) -> t.Dict:
f"Unexpected output from `{' '.join(docker_inspect_cmd)}`. Expected a list of dicts of length 1."
)

return {"hash": image_info[0].get("Id", None)}
image_id: str = image_info[0].get("Id", None)
if image_id and image_id.startswith("sha256:"):
image_id = image_id[7:]
return {"hash": image_id}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class TestDockerRunner(TestCase):
def _check_inspect_output(self, info: t.Dict) -> None:
self.assertIsInstance(info, dict)
self.assertIn("hash", info)
self.assertTrue(info["hash"].startswith("sha256:"))
self.assertFalse(info["hash"].startswith("sha256:"))

@staticmethod
def noop(*args, **kwargs) -> None:
Expand Down

0 comments on commit daccf94

Please sign in to comment.