Support runfiles root_symlinks in images#2250
Open
wolfd wants to merge 1 commit intobazelbuild:masterfrom
Open
Support runfiles root_symlinks in images#2250wolfd wants to merge 1 commit intobazelbuild:masterfrom
wolfd wants to merge 1 commit intobazelbuild:masterfrom
Conversation
Fixes symlink support and adds root_symlink support. Previously I was seeing that symlinks (regardless of whether the target file existed in runfiles.file), did not point to the correct location in the image. For that reason, we use `_final_file_path` instead of `layer_file_path`. This seems to work, but I am not sure if I'm missing a use-case here. The overall method we take here is to create real files where the [root_]symlink is declared if the target `File` is not seen in `file_map`. This PR also adds some extra test functionality to check that symlinks point at the expected location.
wolfd
commented
Apr 21, 2023
| symlinks.update({ | ||
| (_reference_dir(ctx) + "/" + s.path): layer_file_path(ctx, s.target_file) | ||
| for s in _default_symlinks(dep).to_list() | ||
| if hasattr(s, "path") # "path" and "target_file" are exposed to starlark since bazel 0.21.0. |
Author
There was a problem hiding this comment.
I figure that 0.21.0 is not worth worrying about anymore?
Author
|
For what it's worth, using Regardless, this PR can be used to make layers with or without the target file existing in the same runfiles object. Just thought I'd mention it. |
|
This Pull Request has been automatically marked as stale because it has not had any activity for 180 days. It will be closed if no further activity occurs in 30 days. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes symlink support and adds root_symlink support.
PR Checklist
Please check if your PR fulfills the following requirements:
^ I'm not aware of docs that mention what specifically happens to runfiles.
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Previously I was seeing that
runfiles.symlinks(regardless of whether the target file existed inrunfiles.files), did not point to the correct location in the image (they were broken).Additionally,
root_symlinkswere entirely ignored.Issue Number: N/A
What is the new behavior?
The overall method we take here is to create real files where the [root_]symlink is declared if the target
Fileis not seen infile_map.We now use
_final_file_pathinstead oflayer_file_path. This seems to work, but I am not sure if I'm missing a use-case here.This PR also adds some extra test functionality to check that symlinks point at the expected location.
Does this PR introduce a breaking change?
I don't think that the previous behavior is considered working, and I'm having trouble imagining a case where that broken behavior would be desired.
Other information