File tree Expand file tree Collapse file tree 2 files changed +14
-6
lines changed
Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -165,10 +165,15 @@ exports_files(["image.digest", "digest"])
165165 kwargs = {}
166166
167167 if "PULLER_TIMEOUT" in repository_ctx .os .environ :
168- args += [
169- "-timeout" ,
170- repository_ctx .os .environ .get ("PULLER_TIMEOUT" ),
171- ]
168+ timeout_in_secs = repository_ctx .os .environ ["PULLER_TIMEOUT" ]
169+ if timeout_in_secs .isdigit ():
170+ args += [
171+ "-timeout" ,
172+ timeout_in_secs ,
173+ ]
174+ kwargs ["timeout" ] = int (timeout_in_secs )
175+ else :
176+ fail ("'%s' is invalid value for PULLER_TIMEOUT. Must be an integer." % (timeout_in_secs ))
172177
173178 result = repository_ctx .execute (args , ** kwargs )
174179 if result .return_code :
Original file line number Diff line number Diff line change @@ -25,9 +25,12 @@ function test_puller_timeout() {
2525 # Ensure the puller respects the PULLER_TIMEOUT environment variable. Try
2626 # pulling a large image but set a very low timeout of 1s which should fail if
2727 # the puller is respecting timeouts.
28+ # NOTE: Potential race condition between the Bazel timeout mechanism and the go puller's.
29+ # Could result in test flakes.
30+ # See: https://github.com/bazelbuild/rules_docker/pull/1495#issuecomment-627969114
2831 cd " ${ROOT} "
29- EXPECT_CONTAINS " $( PULLER_TIMEOUT=1 bazel build @large_image_timeout_test//image 2>&1 ) " " i/o timeout "
32+ EXPECT_CONTAINS " $( PULLER_TIMEOUT=1 bazel build @large_image_timeout_test//image 2>&1 ) " " ERROR: Pull command failed: Timed out "
3033 echo " test_puller_timeout PASSED!"
3134}
3235
33- test_puller_timeout
36+ test_puller_timeout
You can’t perform that action at this time.
0 commit comments