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/content_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/content_git_map.cpp')
-rw-r--r-- | src/other_tools/root_maps/content_git_map.cpp | 38 |
1 files changed, 14 insertions, 24 deletions
diff --git a/src/other_tools/root_maps/content_git_map.cpp b/src/other_tools/root_maps/content_git_map.cpp index e5b6b83e..67e61606 100644 --- a/src/other_tools/root_maps/content_git_map.cpp +++ b/src/other_tools/root_maps/content_git_map.cpp @@ -58,7 +58,6 @@ void EnsureRootAsAbsent( ArchiveRepoInfo const& key, bool serve_api_exists, std::optional<gsl::not_null<IExecutionApi*>> const& remote_api, - bool is_on_remote, bool is_cache_hit, ContentGitMap::SetterPtr const& ws_setter, ContentGitMap::LoggerPtr const& logger) { @@ -102,22 +101,22 @@ void EnsureRootAsAbsent( /*fatal=*/true); return; } - if (not is_on_remote and not remote_api) { - (*logger)(fmt::format("Missing remote-execution endpoint " - "needed to sync workspace root {} " - "with the serve endpoint.", - tree_id), - /*fatal=*/true); + 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=*/true); return; } // the tree is known locally, so we can upload it to remote CAS // for the serve endpoint to retrieve it and set up the root - if (not EnsureAbsentRootOnServe( - tree_id, - StorageConfig::GitRoot(), - is_on_remote ? std::nullopt : remote_api, - logger, - /*no_sync_is_fatal=*/true)) { + if (not EnsureAbsentRootOnServe(tree_id, + StorageConfig::GitRoot(), + *remote_api, + logger, + /*no_sync_is_fatal=*/true)) { return; } } @@ -125,8 +124,8 @@ void EnsureRootAsAbsent( } else { // give warning - (*logger)(fmt::format("Workspace root {} marked absent but no serve " - "endpoint provided.", + (*logger)(fmt::format("Workspace root {} marked absent but no suitable " + "serve endpoint provided.", tree_id), /*fatal=*/false); } @@ -147,7 +146,6 @@ void ResolveContentTree( bool is_absent, bool serve_api_exists, std::optional<gsl::not_null<IExecutionApi*>> const& remote_api, - bool is_on_remote, gsl::not_null<ResolveSymlinksMap*> const& resolve_symlinks_map, gsl::not_null<TaskSystem*> const& ts, ContentGitMap::SetterPtr const& ws_setter, @@ -173,7 +171,6 @@ void ResolveContentTree( key, serve_api_exists, remote_api, - is_on_remote, is_cache_hit, ws_setter, logger); @@ -202,7 +199,6 @@ void ResolveContentTree( is_absent, serve_api_exists, remote_api, - is_on_remote, ws_setter, logger](auto const& hashes) { if (not hashes[0]) { @@ -242,7 +238,6 @@ void ResolveContentTree( key, serve_api_exists, remote_api, - is_on_remote, is_cache_hit, ws_setter, logger); @@ -274,7 +269,6 @@ void ResolveContentTree( key, serve_api_exists, remote_api, - is_on_remote, is_cache_hit, ws_setter, logger); @@ -300,7 +294,6 @@ void WriteIdFileAndSetWSRoot( bool is_absent, bool serve_api_exists, std::optional<gsl::not_null<IExecutionApi*>> const& remote_api, - bool is_on_remote, gsl::not_null<ResolveSymlinksMap*> const& resolve_symlinks_map, gsl::not_null<TaskSystem*> const& ts, ContentGitMap::SetterPtr const& setter, @@ -343,7 +336,6 @@ void WriteIdFileAndSetWSRoot( is_absent, serve_api_exists, remote_api, - is_on_remote, resolve_symlinks_map, ts, setter, @@ -423,7 +415,6 @@ void ExtractAndImportToGit( is_absent, serve_api_exists, remote_api, - false, /*is_on_remote*/ resolve_symlinks_map, ts, setter, @@ -539,7 +530,6 @@ auto CreateContentGitMap( /*is_absent = */ (key.absent and not fetch_absent), serve_api_exists, remote_api, - /*is_on_remote = */ false, resolve_symlinks_map, ts, setter, |