Skip to content
This repository has been archived by the owner on Oct 2, 2023. It is now read-only.

Commit

Permalink
Add timeout for attr for dockerfile_image.
Browse files Browse the repository at this point in the history
Some build take longer than 10 minutes since this doesn't use the docker
cache so larger images can be slow.
  • Loading branch information
charlesoconor committed Mar 7, 2023
1 parent 1d7b0d8 commit 7653ba3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion contrib/dockerfile_build.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def _impl(repository_ctx):
if repository_ctx.attr.target:
command.extend(["--target", repository_ctx.attr.target])

build_result = repository_ctx.execute(command)
build_result = repository_ctx.execute(command, timeout = repository_ctx.attr.timeout)
if build_result.return_code:
fail("docker build command failed: {} ({})".format(
build_result.stderr,
Expand Down Expand Up @@ -126,6 +126,10 @@ dockerfile_image = repository_rule(
"target": attr.string(
doc = "Specify which intermediate stage to finish at, passed to `--target`.",
),
"timeout": attr.int(
doc = "Timeout for the build action (in seconds, default 600 seconds)",
default = 600,
),
},
implementation = _impl,
)

0 comments on commit 7653ba3

Please sign in to comment.