Skip to content

Commit

Permalink
Add support for print_progress to container_pull
Browse files Browse the repository at this point in the history
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:
google/containerregistry#66
  • Loading branch information
scele committed Oct 4, 2018
1 parent c9065d1 commit a4475de
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions container/pull.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand All @@ -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"),
Expand Down

0 comments on commit a4475de

Please sign in to comment.