Skip to content

Commit 983607f

Browse files
committed
Fix the docker image name generation
make sure all the parts that constitute the generated docker image name are escaped, otherwise the docker building process can fail (with a rather hard to understand error). Before this fix, the `provider.content_id` was not escaped.
1 parent a0606f2 commit 983607f

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

repo2docker/app.py

100755100644
Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -401,20 +401,19 @@ def fetch(self, url, ref, checkout_path):
401401
self.log.info(log_line, extra=dict(phase="fetching"))
402402

403403
if not self.output_image_spec:
404-
self.output_image_spec = (
405-
"r2d" + escapism.escape(self.repo, escape_char="-").lower()
406-
)
404+
image_spec = "r2d" + self.repo
407405
# if we are building from a subdirectory include that in the
408406
# image name so we can tell builds from different sub-directories
409407
# apart.
410408
if self.subdir:
411-
self.output_image_spec += escapism.escape(
412-
self.subdir, escape_char="-"
413-
).lower()
409+
image_spec += self.subdir
414410
if picked_content_provider.content_id is not None:
415-
self.output_image_spec += picked_content_provider.content_id
411+
image_spec += picked_content_provider.content_id
416412
else:
417-
self.output_image_spec += str(int(time.time()))
413+
image_spec += str(int(time.time()))
414+
self.output_image_spec = escapism.escape(
415+
image_spec, escape_char="-"
416+
).lower()
418417

419418
def json_excepthook(self, etype, evalue, traceback):
420419
"""Called on an uncaught exception when using json logging

0 commit comments

Comments
 (0)