Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mlin committed Dec 30, 2020
1 parent 9346c50 commit 0757636
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 8 additions & 6 deletions WDL/runtime/task_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -614,13 +614,15 @@ def resolve_tag(
client.images.pull(image_tag)
image_attrs = client.images.get(image_tag).attrs
except docker.errors.ImageNotFound:
raise Error.RuntimeError("docker image not found: " + image_tag)
raise Error.RuntimeError("docker image not found: " + image_tag) from None
image_log = {"tag": image_tag, "id": image_attrs["Id"]}
if image_tag not in image_attrs.get("RepoDigests", []):
# resolve mutable tag to precise RepoDigest, to ensure identical image will be used
# across a multi-node swarm
image_tag = image_attrs["RepoDigests"][0]
image_log["resolvedRepoDigest"] = image_tag
# resolve mutable tag to immutable RepoDigest if possible, to ensure identical image will
# be used across a multi-node swarm
image_digest = bool(image_attrs.get("RepoDigests"))
if image_digest and image_tag not in image_attrs["RepoDigests"]:
image_digest = image_attrs["RepoDigests"][0]
image_tag = image_digest
image_log["RepoDigest"] = image_digest
logger.notice(_("docker image", **image_log)) # pyre-fixme
return image_tag

Expand Down
2 changes: 1 addition & 1 deletion tests/test_4taskrun.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def test_docker(self):
docker: "nonexistent:202407"
}
}
""", expected_exception=RuntimeError)
""", expected_exception=WDL.Error.RuntimeError)

# issue #232
outputs = self._test_task(R"""
Expand Down

0 comments on commit 0757636

Please sign in to comment.