Skip to content

Commit

Permalink
task runtime: add default ":latest" tag to docker image if none prese…
Browse files Browse the repository at this point in the history
…nt (#246)

see also issue #232
  • Loading branch information
mlin committed Oct 1, 2019
1 parent 469658f commit 03db644
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
language: cpp
language: python
dist: bionic
services:
- docker

script:
- |
set -ex -o pipefail
set -exo pipefail
make docker
docker run --env TRAVIS_JOB_ID=${TRAVIS_JOB_ID} --env TRAVIS_BRANCH=${TRAVIS_BRANCH} \
-v /var/run/docker.sock:/var/run/docker.sock -v /tmp:/tmp \
Expand Down
3 changes: 3 additions & 0 deletions WDL/runtime/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,9 @@ def _run(self, logger: logging.Logger, command: str) -> int:
stderr_file = os.path.join(self.host_dir, "stderr.txt")
pygtail = Pygtail(stderr_file, full_lines=True)
pygtail_exn = False
if ":" not in self.image_tag:
# seems we need to do this explicitly under some configurations -- issue #232
self.image_tag += ":latest"
try:
# run container
logger.info("docker starting image {}".format(self.image_tag))
Expand Down
17 changes: 17 additions & 0 deletions tests/test_4taskrun.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,23 @@ def test_docker(self):
}
""", expected_exception=docker.errors.ImageNotFound)

# issue #232
outputs = self._test_task(R"""
version 1.0
task hello {
command <<<
cat /etc/issue
>>>
output {
String issue = read_string(stdout())
}
runtime {
docker: "frolvlad/alpine-bash"
}
}
""")
self.assertTrue("Alpine Linux" in outputs["issue"])

@log_capture()
def test_logging_std_err(self, capture):
self._test_task(R"""
Expand Down

0 comments on commit 03db644

Please sign in to comment.