diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-02-21 12:08:34 +0100 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-02-27 14:35:44 +0100 |
commit | 1394c3d9016373ef727feac9d1aed514e1f89f53 (patch) | |
tree | 8a1e0071a9233b6bc68990c58481db3b0fc1597a /src/other_tools/root_maps/fpath_git_map.cpp | |
parent | 4500ab06bc8891aa1ba6cf00f1437fe466315624 (diff) | |
download | justbuild-1394c3d9016373ef727feac9d1aed514e1f89f53.tar.gz |
just-mr: Correct handling of remotes with respect to compatibility mode
In order to set up roots, just-mr is able to interrogate, if given,
serve and/or remote-execution endpoints. However, just-mr operates
only with Git hashes, i.e., with a native mode CAS.
This commit ensures the correct interactions occur between just-mr
and the provided endpoints not only in native mode, but also in
comaptible mode, where a serve endpoint might be present even if
one cannot make use of its associated remote-exection endpoint.
The user always gets informed if any incompatibilities are
detected.
Diffstat (limited to 'src/other_tools/root_maps/fpath_git_map.cpp')
-rw-r--r-- | src/other_tools/root_maps/fpath_git_map.cpp | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/src/other_tools/root_maps/fpath_git_map.cpp b/src/other_tools/root_maps/fpath_git_map.cpp index bb6b5a83..9fb6858d 100644 --- a/src/other_tools/root_maps/fpath_git_map.cpp +++ b/src/other_tools/root_maps/fpath_git_map.cpp @@ -40,19 +40,34 @@ void CheckServeAndSetRoot( FilePathGitMap::SetterPtr const& ws_setter, FilePathGitMap::LoggerPtr const& logger) { // if serve endpoint is given, try to ensure it has this tree available to - // be able to build against it + // be able to build against it. If root is not absent, do not fail if we + // don't have a suitable remote endpoint, but warn user nonetheless. if (serve_api_exists) { auto has_tree = CheckServeHasAbsentRoot(tree_id, logger); if (not has_tree) { return; // fatal } if (not *has_tree) { - if (not EnsureAbsentRootOnServe(tree_id, - repo_root, - *remote_api, - logger, - /*no_sync_is_fatal=*/absent)) { - return; // fatal + // only enforce root setup on the serve endpoint if root is absent + if (not remote_api) { + (*logger)( + fmt::format("Missing or incompatible remote-execution " + "endpoint needed to sync workspace root {} " + "with the serve endpoint.", + tree_id), + /*fatal=*/absent); + if (absent) { + return; + } + } + else { + if (not EnsureAbsentRootOnServe(tree_id, + repo_root, + *remote_api, + logger, + /*no_sync_is_fatal=*/absent)) { + return; // fatal + } } } } @@ -60,7 +75,7 @@ void CheckServeAndSetRoot( if (absent) { // give warning (*logger)(fmt::format("Workspace root {} marked absent but no " - "serve endpoint provided.", + "suitable serve endpoint provided.", tree_id), /*fatal=*/false); } |