Skip to content

Commit a4475de

Browse files
committed
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: google/containerregistry#66
1 parent c9065d1 commit a4475de

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

container/pull.bzl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ container_import(
8080
if "PULLER_TIMEOUT" in repository_ctx.os.environ:
8181
kwargs["timeout"] = int(repository_ctx.os.environ.get("PULLER_TIMEOUT"))
8282

83+
if repository_ctx.attr.print_progress:
84+
kwargs["quiet"] = False
85+
args += ["--print-progress"]
86+
8387
result = repository_ctx.execute(args, **kwargs)
8488
if result.return_code:
8589
fail("Pull command failed: %s (%s)" % (result.stderr, " ".join(args)))
@@ -90,6 +94,7 @@ container_pull = repository_rule(
9094
"repository": attr.string(mandatory = True),
9195
"digest": attr.string(),
9296
"tag": attr.string(default = "latest"),
97+
"print_progress": attr.bool(),
9398
"_puller": attr.label(
9499
executable = True,
95100
default = Label("@puller//file:downloaded"),

0 commit comments

Comments
 (0)