Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BuildBarn always resolves symlinks to origin files #104

Closed
castler opened this issue Jul 5, 2022 · 9 comments
Closed

BuildBarn always resolves symlinks to origin files #104

castler opened this issue Jul 5, 2022 · 9 comments

Comments

@castler
Copy link

castler commented Jul 5, 2022

Our build is relying on the fact that symlinked files are actual symlinks.
It turns out that, using Remote Execution, a file that is symlinked via https://bazel.build/rules/lib/actions#declare_symlink is not an actual symlink, but the file itself.

Apparently there is a Bazel flag (https://bazel.build/reference/command-line-reference#flag--incompatible_remote_symlinks), which is enabled by default, that should ensure exactly this. Following this flag we find bazelbuild/bazel#6631, which describes the needed feature is already implemented by Bazel.

A small repository with a reproduction of the issue can be found here: https://github.com/castler/buildbarn_bazel_symlink_issue_repro

The BuildBarn worker was using the native buildDirectories.

@EdSchouten
Copy link
Member

Have you inspected the action through bb_browser? If it shows up as a file there instead of a symlink, then there is little that we can do on the Buildbarn side. Buildbarn tries to literally set up things the way it's provided by Bazel.

@castler
Copy link
Author

castler commented Jul 5, 2022

Thanks for the super quick answer!

I did not check with bb_browser yet, but tried to reproduce with another Remote Execution provider (EngFlow) which did not lead to this case.
Thats why I assumed Bazel is doing its part alright.

Edit: Apparently I did something wrong during my initiale reproduction with our RBE providers. This issue is persistent over different providers, thus indicating (as mentioned farther below) that this is a Bazel issue.

@EdSchouten
Copy link
Member

Maybe EngFlow always adds an additional level of symlinks to input roots? Then it would coincidentally work there.

@castler
Copy link
Author

castler commented Jul 5, 2022

ACK.

I will double check the action tomorrow with bb_browser

@castler
Copy link
Author

castler commented Jul 7, 2022

So I was somehow unable to really figure out how to operate bb-browser for actions.
I have no clue where to get the necessary hash and byte size for the actions, can you help me on this?

I used the BEP to finde the hash and byte size for the "symlink artifact". When I visit this in bb-browser
I am presented directly the file not any symlink.

@moroten
Copy link
Contributor

moroten commented Jul 7, 2022

I usually look in the bb-scheduler UI within a minute after the action finishes. Alternatively, I alter the action to exit with a non-zero exit code, to get Bazel to display a link to bb-browser.

@EdSchouten
Copy link
Member

Bazel master recently added this flag, which may also be of use:
bazelbuild/bazel#15557
By the looks of it, calling Bazel with that flag will cause it to print the bb-browser URL for every action it runs.

@castler
Copy link
Author

castler commented Jul 7, 2022

Thanks, that helped a lot!

So basically the first thing I see is that apparently the "symlink action" is not executed remotely and indeed the input artifact for the next action is then directly the file. I am trying to figure out now if I have to change something on the config, to make the symlinking also happening remotely.

@EdSchouten
Copy link
Member

Awesome! Then let me close this issue on this end, because any changes in this area should most likely be done on the Bazel side. Thanks for reaching out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants