From a4475de4015d1f63b0fee17006f28d6524b45275 Mon Sep 17 00:00:00 2001 From: Lauri Peltonen Date: Tue, 20 Feb 2018 14:45:42 +0200 Subject: [PATCH] Add support for print_progress to container_pull Add minimal prints to indicate puller progress if container_pull has print_progress=True attribute. The intention is that the pull operation would provide some feedback to the user, instead of bazel getting seemingly stuck for 10 minutes when pulling an image that is many gigabytes in size. Pending pull request to upstream puller.par is here: https://github.com/google/containerregistry/pull/66 --- container/pull.bzl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/container/pull.bzl b/container/pull.bzl index 72c11d6d0..9ddf0a2fc 100644 --- a/container/pull.bzl +++ b/container/pull.bzl @@ -80,6 +80,10 @@ container_import( if "PULLER_TIMEOUT" in repository_ctx.os.environ: kwargs["timeout"] = int(repository_ctx.os.environ.get("PULLER_TIMEOUT")) + if repository_ctx.attr.print_progress: + kwargs["quiet"] = False + args += ["--print-progress"] + result = repository_ctx.execute(args, **kwargs) if result.return_code: fail("Pull command failed: %s (%s)" % (result.stderr, " ".join(args))) @@ -90,6 +94,7 @@ container_pull = repository_rule( "repository": attr.string(mandatory = True), "digest": attr.string(), "tag": attr.string(default = "latest"), + "print_progress": attr.bool(), "_puller": attr.label( executable = True, default = Label("@puller//file:downloaded"),