hundreds-father-404
04/12/2021, 9:40 PMhundreds-father-404
04/12/2021, 9:41 PMREAPI does not store the prefix of the output directory into the Tree and Directories therein.I'm not finding why that is the case? I don't see it mentioned in
remote_execution.proto
hundreds-father-404
04/12/2021, 9:49 PMoutput_files
, we store the full path, which complies with the REAPI
action_result.output_files.push({
remexec::OutputFile {
digest: Some(digest.into()),
// Note that this is the full path from the workdir.
path: output_file.to_owned(),
is_executable: file_node.is_executable,
..remexec::OutputFile::default()
}
})
}
// An `OutputFile` is similar to a
// [FileNode][build.bazel.remote.execution.v2.FileNode], but it is used as an
// output in an `ActionResult`. It allows a full file path rather than
// only a name.
message OutputFile {
// The full path of the file relative to the working directory, including the
// filename. The path separator is a forward slash `/`. Since this is a
// relative path, it MUST NOT begin with a leading forward slash.
string path = 1;
fast-nail-55400
04/12/2021, 9:55 PMI’m not finding why that is the case? I don’t see it mentioned inBecause it allows future uses of that Directory proto to mount it anywhere within an input root it wants without being held to the choice for the path to its root made when it was generated.remote_execution.proto
hundreds-father-404
04/12/2021, 10:01 PMmessage OutputDirectory {
// The full path of the directory relative to the working directory. The path
// separator is a forward slash `/`. Since this is a relative path, it MUST
// NOT begin with a leading forward slash. The empty string value is allowed,
// and it denotes the entire working directory.
string path = 1;
fast-nail-55400
04/12/2021, 10:02 PMfast-nail-55400
04/12/2021, 10:03 PMfast-nail-55400
04/12/2021, 10:03 PMfast-nail-55400
04/12/2021, 10:03 PMhundreds-father-404
04/12/2021, 10:06 PM/tmp/process-execution-123
, rather than the literal cwd. This was failing before we set the working_directory
arg.
My point is that I believe from REAPI we should be storing in the remote cache __output/shellcheck/README.md
, not shellcheck/README.md
. And indeed, were we using output_files
instead of output_directories
, we would be storing that full path. output_directories
and output_files
are behaving differently rn.fast-nail-55400
04/12/2021, 10:06 PMThe paths are relative to the working directory of the action execution.https://github.com/bazelbuild/remote-apis/blob/0943dc4e70e1414735a85a3167557392c177ff45/build/bazel/remote/execution/v2/remote_execution.proto#L[…]5
fast-nail-55400
04/12/2021, 10:11 PMMy point is that I believe from REAPI we should be storing in the remote cacheThat is still wrong though. Pants merges all output directories and files into a single “Digest”. REAPI does not do that. The output directories and files are independent. The digest for the root of an output directory is the digest of Directory proto for that output directory itself, not any parent directories in the path., not__output/shellcheck/README.md
shellcheck/README.md
hundreds-father-404
04/12/2021, 10:12 PMThe digest for the root of an output directory is the digest of Directory proto for that output directory itself, not any parent directories in the path.Where is this documented? I'm trying to understand
average-vr-56795
04/12/2021, 10:17 PMhundreds-father-404
04/12/2021, 10:18 PMhundreds-father-404
04/12/2021, 10:20 PMaction_result
.output_directories
.push(remexec::OutputDirectory {
path: String::new(),
tree_digest: Some(tree_digest.into()),
});
}
The tree_digest is accurate, but the path needs to be the output_directory!average-vr-56795
04/12/2021, 10:20 PMfast-nail-55400
04/12/2021, 10:21 PMfast-nail-55400
04/12/2021, 10:22 PMfast-nail-55400
04/12/2021, 10:23 PMhundreds-father-404
04/12/2021, 10:48 PMfast-nail-55400
04/12/2021, 11:48 PMhundreds-father-404
04/12/2021, 11:50 PM-ldebug
logs locally to confirm that remote caching workedfast-nail-55400
04/12/2021, 11:52 PMhundreds-father-404
04/12/2021, 11:54 PM❯ rg 'output_directories' -lg '*.py'
src/python/pants/engine/process.py
src/python/pants/backend/codegen/protobuf/python/rules.py
src/python/pants/backend/python/goals/coverage_py.py
src/python/pants/backend/python/goals/pytest_runner.py
src/python/pants/backend/python/goals/setup_py.py
src/python/pants/backend/python/util_rules/pex_cli.py
src/python/pants/backend/python/util_rules/pex.py
tests/python/pants_test/init/test_plugin_resolver.py
src/python/pants/core/util_rules/archive.py
fast-nail-55400
04/13/2021, 12:00 AMmain
?hundreds-father-404
04/13/2021, 12:02 AMarchive.py
code path in 2.4. It was only us activating Shellcheck that surfaced this bug a few days agofast-nail-55400
04/13/2021, 12:03 AM