fix: make oci_tarball work with disjoint output root #614
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.
A while back we changed oci_tarball for performance reasons, and we introduced two different ways to load tarball into the daemon, one where one run
bazel run :tarball_target
orbazel build :tarball_target --output_groups=tarball && docker load -i tarball.path
or directly get the output in DAG.So in order to support all these cases we introduced some hacks like using
--cd
option to cd back into the execroot and strip the paths using<ctx.bin_dir.path>
.Unfortunately this did not work for cases where bindir of oci_tarball and oci_image is disjoint, eg oci_image is transitioned but oci_tarball isn't simply because the assumption that everything is in the same
bazel-bin/cfg/bin
did not hold true in cases above.This PR fixes it by making eveything relative to execroot, which the case for action version by default, by introducing some execroot detection code copied from rules_js.