Skip to content

Commit d553846

Browse files
exposes the already existing -timeout argument of mirror program to the bazel rule declaration (#17)
1 parent 0585f72 commit d553846

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

mirror/defs.bzl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ def _mirror_image_impl(ctx):
5656
"{src_image}": src_image,
5757
"{digest}": digest,
5858
"{dst_image}": dst_without_hash,
59+
"{timeout}": ctx.attr.push_timeout,
5960
},
6061
is_executable = True,
6162
)
@@ -103,6 +104,10 @@ mirror_image_rule = rule(
103104
"dst": attr.string(
104105
doc = "The destination image location, should include the registry and repository. Either dst_prefix or dst_image must be specified.",
105106
),
107+
"push_timeout": attr.string(
108+
doc = "The allowed wait time for image pushes",
109+
default = "30s",
110+
),
106111
"mirror_tool": attr.label(
107112
default = Label("//cmd/mirror"),
108113
executable = True,

mirror/mirror_image.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ function guess_runfiles() {
1212

1313
RUNFILES="${PYTHON_RUNFILES:-$(guess_runfiles)}"
1414

15-
{mirror_tool} -from {src_image} -digest {digest} -to {dst_image}
15+
{mirror_tool} -from {src_image} -digest {digest} -to {dst_image} -timeout {timeout}

mirror/tests/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ mirror_image(
4444
src_image = "localhost:1338/image",
4545
tags = ["manual"], # test should be tagged manual since it requires a running registry
4646
visibility = ["//visibility:public"],
47+
push_timeout = "60s",
4748
)
4849

4950
mirror_image(

0 commit comments

Comments
 (0)