bazelbuild / rules_docker

Rules for building and handling Docker images with Bazel

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

What is causing duplicate builds of same target in Bazel? using the container_image rule

ZhangYing3314 opened this issue · comments

`bazel build ...
$TEST_TMPDIR defined: output root default is '/usr1/bazel_cache' and max_idle_secs default is '15'.
Starting local Bazel server and connecting to it...
(10:08:30) WARNING: Option 'remote_local_fallback_strategy' is deprecated
(10:08:30) INFO: Current date is 2022-11-17
(10:08:36) INFO: Analyzed 9 targets (103 packages loaded, 9668 targets configured).
(10:08:36) INFO: Found 9 targets...
(10:08:59) [63 / 82] 4 actions running
    install; 23s processwrapper-sandbox
    install; 22s processwrapper-sandbox
    Executing genrule //MSToolBox:soprun; 18s processwrapper-sandbox
    Executing genrule //MSToolBox:soprun; 18s processwrapper-sandbox
`

This “soprun ” has been build twice in parallel, I tryed "bazel cquery" and found there has more than one bazel configuration in this chain, like 'buildimage(4829efa)->soprun(4829efa) && buildimage(ffba5d6)->soprun(ffba5d6)',the root cause seems to be a container_image target.

Any ideas/tips how to fix this? Thanks a lot

`bazel build ...
$TEST_TMPDIR defined: output root default is '/usr1/bazel_cache' and max_idle_secs default is '15'.
Starting local Bazel server and connecting to it...
(10:08:30) WARNING: Option 'remote_local_fallback_strategy' is deprecated
(10:08:30) INFO: Current date is 2022-11-17
(10:08:36) INFO: Analyzed 9 targets (103 packages loaded, 9668 targets configured).
(10:08:36) INFO: Found 9 targets...
(10:08:59) [63 / 82] 4 actions running
    install; 23s processwrapper-sandbox
    install; 22s processwrapper-sandbox
    Executing genrule //MSToolBox:soprun; 18s processwrapper-sandbox
    Executing genrule //MSToolBox:soprun; 18s processwrapper-sandbox
`

This “soprun ” has been build twice in parallel, I tryed "bazel cquery" and found there has more than one bazel configuration in this chain, like 'buildimage(4829efa)->soprun(4829efa) && buildimage(ffba5d6)->soprun(ffba5d6)',the root cause seems to be a container_image target.

Any ideas/tips how to fix this? Thanks a lot

For anyone who finds this issue in the future: What fixed this for us was setting build --@io_bazel_rules_docker//transitions:enable=false in .bazelrc and applying this patch to rules_docker.