bazel-skylib icon indicating copy to clipboard operation
bazel-skylib copied to clipboard

copy_file should *never* set `no-remote`

Open ulfjack opened this issue 9 months ago • 5 comments

When build-without-the-bytes is used, forcing no-remote + no-cache is often worse than allowing it to execute remotely. If the file is a source file, then it's better to upload it right away and execute the copy remotely (cached). If the file is an output file, then Bazel has to download the file in order to perform a local copy. Best case scenario, no work is ever done locally, and this breaks that.

It's a better policy to not try to set these at the rule level.

If this needs to be user-configurable on a per-rule basis, it might be viable to create a flag and then set these tags only if the flag is set.

ulfjack avatar Mar 17 '25 23:03 ulfjack

https://github.com/bazelbuild/bazel-skylib/blob/main/rules/private/copy_common.bzl#L18

ulfjack avatar Mar 17 '25 23:03 ulfjack

There also won't be a new CAS entry, so this would virtually be all upside. RBE does support source directories now.

That said, ideally allow_symlink would just be the default and then there wouldn't even be a non-trivial action to run in the first place.

fmeum avatar Mar 18 '25 12:03 fmeum

If I read the code correctly, allow_symlink is the default, except on Windows.

ulfjack avatar Mar 18 '25 14:03 ulfjack

@ulfjack I think that's not true, allow_symlink defaults to False in the copy_file macro and is_windows is only used to decide whether to use a shell script or a bat script.

fmeum avatar Mar 19 '25 11:03 fmeum

You're right. Apparently I misread the code. I agree that it should default to true.

ulfjack avatar Mar 20 '25 09:03 ulfjack