diff options
-rw-r--r-- | src/other_tools/just_mr/fetch.cpp | 86 | ||||
-rw-r--r-- | src/other_tools/just_mr/setup.cpp | 166 | ||||
-rw-r--r-- | src/other_tools/ops_maps/git_tree_fetch_map.cpp | 5 | ||||
-rw-r--r-- | src/other_tools/root_maps/commit_git_map.cpp | 9 | ||||
-rw-r--r-- | src/other_tools/root_maps/content_git_map.cpp | 38 | ||||
-rw-r--r-- | src/other_tools/root_maps/distdir_git_map.cpp | 71 | ||||
-rw-r--r-- | src/other_tools/root_maps/fpath_git_map.cpp | 31 | ||||
-rw-r--r-- | src/other_tools/root_maps/root_utils.hpp | 2 | ||||
-rw-r--r-- | src/other_tools/root_maps/tree_id_git_map.cpp | 11 |
9 files changed, 256 insertions, 163 deletions
diff --git a/src/other_tools/just_mr/fetch.cpp b/src/other_tools/just_mr/fetch.cpp index a47b02cf..81709f05 100644 --- a/src/other_tools/just_mr/fetch.cpp +++ b/src/other_tools/just_mr/fetch.cpp @@ -452,56 +452,86 @@ auto MultiRepoFetch(std::shared_ptr<Configuration> const& config, nr_a != 0 and nr_gt != 0 ? " and " : "", nr_gt != 0 ? str_gt : std::string()); - // setup the APIs for archive fetches + // setup the APIs for archive fetches; only happens if in native mode auto remote_api = JustMR::Utils::GetRemoteApi(common_args.remote_execution_address, common_args.remote_serve_address, auth_args); IExecutionApi::Ptr local_api{std::make_unique<LocalApi>()}; + bool remote_compatible{common_args.compatible == true}; - // setup the API for serving trees of Git repos or archives + // setup the API for serving roots auto serve_api_exists = JustMR::Utils::SetupServeApi( common_args.remote_serve_address, auth_args); + // check configuration of the serve endpoint provided + if (serve_api_exists) { + // check the compatibility mode of the serve endpoint + auto compatible = ServeApi::IsCompatible(); + if (not compatible) { + Logger::Log(LogLevel::Warning, + "Checking compatibility configuration of the provided " + "serve endpoint failed. Serve endpoint ignored."); + serve_api_exists = false; + } + if (*compatible != remote_compatible) { + Logger::Log( + LogLevel::Warning, + "Provided serve endpoint operates in a different compatibility " + "mode than stated. Serve endpoint ignored."); + serve_api_exists = false; + } + // if we have a remote endpoint explicitly given by the user, it must + // match what the serve endpoint expects + if (remote_api and common_args.remote_execution_address and + not ServeApi::CheckServeRemoteExecution()) { + return kExitFetchError; // this check logs error on failure + } + } + // create async maps auto crit_git_op_ptr = std::make_shared<CriticalGitOpGuard>(); auto critical_git_op_map = CreateCriticalGitOpMap(crit_git_op_ptr); - auto content_cas_map = CreateContentCASMap( - common_args.just_mr_paths, - common_args.alternative_mirrors, - common_args.ca_info, - &critical_git_op_map, - serve_api_exists, + auto content_cas_map = + CreateContentCASMap(common_args.just_mr_paths, + common_args.alternative_mirrors, + common_args.ca_info, + &critical_git_op_map, + serve_api_exists, + &(*local_api), + (remote_api and not remote_compatible) + ? std::make_optional(&(*remote_api)) + : std::nullopt, + common_args.jobs); + + auto archive_fetch_map = CreateArchiveFetchMap( + &content_cas_map, + *fetch_dir, &(*local_api), - remote_api ? std::make_optional(&(*remote_api)) : std::nullopt, + (fetch_args.backup_to_remote and remote_api and not remote_compatible) + ? std::make_optional(&(*remote_api)) + : std::nullopt, common_args.jobs); - auto archive_fetch_map = - CreateArchiveFetchMap(&content_cas_map, - *fetch_dir, - &(*local_api), - (fetch_args.backup_to_remote and remote_api) - ? std::make_optional(&(*remote_api)) - : std::nullopt, - common_args.jobs); - auto import_to_git_map = CreateImportToGitMap(&critical_git_op_map, common_args.git_path->string(), *common_args.local_launcher, common_args.jobs); - auto git_tree_fetch_map = CreateGitTreeFetchMap( - &critical_git_op_map, - &import_to_git_map, - common_args.git_path->string(), - *common_args.local_launcher, - serve_api_exists, - &(*local_api), - remote_api ? std::make_optional(&(*remote_api)) : std::nullopt, - fetch_args.backup_to_remote, - common_args.jobs); + auto git_tree_fetch_map = + CreateGitTreeFetchMap(&critical_git_op_map, + &import_to_git_map, + common_args.git_path->string(), + *common_args.local_launcher, + serve_api_exists, + &(*local_api), + (remote_api and not remote_compatible) + ? std::make_optional(&(*remote_api)) + : std::nullopt, + fetch_args.backup_to_remote, + common_args.jobs); // set up progress observer JustMRProgress::Instance().SetTotal(static_cast<int>(nr_a + nr_gt)); diff --git a/src/other_tools/just_mr/setup.cpp b/src/other_tools/just_mr/setup.cpp index ee6c2f30..3370f0fc 100644 --- a/src/other_tools/just_mr/setup.cpp +++ b/src/other_tools/just_mr/setup.cpp @@ -104,30 +104,58 @@ auto MultiRepoSetup(std::shared_ptr<Configuration> const& config, JustMR::Utils::ReachableRepositories(repos, *main, setup_repos); } - // setup the APIs for archive fetches + // setup the APIs for archive fetches; only happens if in native mode auto remote_api = JustMR::Utils::GetRemoteApi(common_args.remote_execution_address, common_args.remote_serve_address, auth_args); IExecutionApi::Ptr local_api{std::make_unique<LocalApi>()}; + bool remote_compatible{common_args.compatible == true}; - // setup the API for serving trees of Git repos or archives + // setup the API for serving roots auto serve_api_exists = JustMR::Utils::SetupServeApi( common_args.remote_serve_address, auth_args); + // check configuration of the serve endpoint provided + if (serve_api_exists) { + // check the compatibility mode of the serve endpoint + auto compatible = ServeApi::IsCompatible(); + if (not compatible) { + Logger::Log(LogLevel::Warning, + "Checking compatibility configuration of the provided " + "serve endpoint failed."); + serve_api_exists = false; + } + if (*compatible != remote_compatible) { + Logger::Log( + LogLevel::Warning, + "Provided serve endpoint operates in a different compatibility " + "mode than stated. Serve endpoint ignored."); + serve_api_exists = false; + } + // if we have a remote endpoint explicitly given by the user, it must + // match what the serve endpoint expects + if (remote_api and common_args.remote_execution_address and + not ServeApi::CheckServeRemoteExecution()) { + return std::nullopt; // this check logs error on failure + } + } + // setup the required async maps auto crit_git_op_ptr = std::make_shared<CriticalGitOpGuard>(); auto critical_git_op_map = CreateCriticalGitOpMap(crit_git_op_ptr); - auto content_cas_map = CreateContentCASMap( - common_args.just_mr_paths, - common_args.alternative_mirrors, - common_args.ca_info, - &critical_git_op_map, - serve_api_exists, - &(*local_api), - remote_api ? std::make_optional(&(*remote_api)) : std::nullopt, - common_args.jobs); + auto content_cas_map = + CreateContentCASMap(common_args.just_mr_paths, + common_args.alternative_mirrors, + common_args.ca_info, + &critical_git_op_map, + serve_api_exists, + &(*local_api), + (remote_api and not remote_compatible) + ? std::make_optional(&(*remote_api)) + : std::nullopt, + common_args.jobs); auto import_to_git_map = CreateImportToGitMap(&critical_git_op_map, @@ -135,44 +163,50 @@ auto MultiRepoSetup(std::shared_ptr<Configuration> const& config, *common_args.local_launcher, common_args.jobs); - auto git_tree_fetch_map = CreateGitTreeFetchMap( - &critical_git_op_map, - &import_to_git_map, - common_args.git_path->string(), - *common_args.local_launcher, - serve_api_exists, - &(*local_api), - remote_api ? std::make_optional(&(*remote_api)) : std::nullopt, - false, /* backup_to_remote */ - common_args.jobs); + auto git_tree_fetch_map = + CreateGitTreeFetchMap(&critical_git_op_map, + &import_to_git_map, + common_args.git_path->string(), + *common_args.local_launcher, + serve_api_exists, + &(*local_api), + (remote_api and not remote_compatible) + ? std::make_optional(&(*remote_api)) + : std::nullopt, + false, /* backup_to_remote */ + common_args.jobs); auto resolve_symlinks_map = CreateResolveSymlinksMap(); - auto commit_git_map = CreateCommitGitMap( - &critical_git_op_map, - &import_to_git_map, - common_args.just_mr_paths, - common_args.alternative_mirrors, - common_args.git_path->string(), - *common_args.local_launcher, - serve_api_exists, - &(*local_api), - remote_api ? std::make_optional(&(*remote_api)) : std::nullopt, - common_args.fetch_absent, - common_args.jobs); + auto commit_git_map = + CreateCommitGitMap(&critical_git_op_map, + &import_to_git_map, + common_args.just_mr_paths, + common_args.alternative_mirrors, + common_args.git_path->string(), + *common_args.local_launcher, + serve_api_exists, + &(*local_api), + (remote_api and not remote_compatible) + ? std::make_optional(&(*remote_api)) + : std::nullopt, + common_args.fetch_absent, + common_args.jobs); - auto content_git_map = CreateContentGitMap( - &content_cas_map, - &import_to_git_map, - common_args.just_mr_paths, - common_args.alternative_mirrors, - common_args.ca_info, - &resolve_symlinks_map, - &critical_git_op_map, - serve_api_exists, - remote_api ? std::make_optional(&(*remote_api)) : std::nullopt, - common_args.fetch_absent, - common_args.jobs); + auto content_git_map = + CreateContentGitMap(&content_cas_map, + &import_to_git_map, + common_args.just_mr_paths, + common_args.alternative_mirrors, + common_args.ca_info, + &resolve_symlinks_map, + &critical_git_op_map, + serve_api_exists, + (remote_api and not remote_compatible) + ? std::make_optional(&(*remote_api)) + : std::nullopt, + common_args.fetch_absent, + common_args.jobs); auto fpath_git_map = CreateFilePathGitMap( just_cmd_args.subcmd_name, @@ -180,30 +214,36 @@ auto MultiRepoSetup(std::shared_ptr<Configuration> const& config, &import_to_git_map, &resolve_symlinks_map, serve_api_exists, - remote_api ? std::make_optional(&(*remote_api)) : std::nullopt, + (remote_api and not remote_compatible) + ? std::make_optional(&(*remote_api)) + : std::nullopt, common_args.jobs, multi_repo_tool_name, common_args.just_path ? common_args.just_path->string() : kDefaultJustPath); - auto distdir_git_map = CreateDistdirGitMap( - &content_cas_map, - &import_to_git_map, - &critical_git_op_map, - serve_api_exists, - &(*local_api), - remote_api ? std::make_optional(&(*remote_api)) : std::nullopt, - common_args.jobs); + auto distdir_git_map = + CreateDistdirGitMap(&content_cas_map, + &import_to_git_map, + &critical_git_op_map, + serve_api_exists, + &(*local_api), + (remote_api and not remote_compatible) + ? std::make_optional(&(*remote_api)) + : std::nullopt, + common_args.jobs); - auto tree_id_git_map = CreateTreeIdGitMap( - &git_tree_fetch_map, - &critical_git_op_map, - &import_to_git_map, - common_args.fetch_absent, - serve_api_exists, - &(*local_api), - remote_api ? std::make_optional(&(*remote_api)) : std::nullopt, - common_args.jobs); + auto tree_id_git_map = + CreateTreeIdGitMap(&git_tree_fetch_map, + &critical_git_op_map, + &import_to_git_map, + common_args.fetch_absent, + serve_api_exists, + &(*local_api), + (remote_api and not remote_compatible) + ? std::make_optional(&(*remote_api)) + : std::nullopt, + common_args.jobs); auto repos_to_setup_map = CreateReposToSetupMap(config, main, diff --git a/src/other_tools/ops_maps/git_tree_fetch_map.cpp b/src/other_tools/ops_maps/git_tree_fetch_map.cpp index 6298acca..38e25606 100644 --- a/src/other_tools/ops_maps/git_tree_fetch_map.cpp +++ b/src/other_tools/ops_maps/git_tree_fetch_map.cpp @@ -229,8 +229,9 @@ auto CreateGitTreeFetchMap( return; } JustMRProgress::Instance().TaskTracker().Start(key.origin); - // check if tree is known to remote serve service - if (serve_api_exists) { + // check if tree is known to remote serve service and can be + // made available in remote CAS + if (serve_api_exists and remote_api) { // as we anyway interrogate the remote execution endpoint, // we're only interested here in the serve endpoint making // an attempt to upload the tree, if known, to remote CAS diff --git a/src/other_tools/root_maps/commit_git_map.cpp b/src/other_tools/root_maps/commit_git_map.cpp index 04f14023..d97f33be 100644 --- a/src/other_tools/root_maps/commit_git_map.cpp +++ b/src/other_tools/root_maps/commit_git_map.cpp @@ -108,6 +108,15 @@ void EnsureRootAsAbsent( /*fatal=*/true); return; } + 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, 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, diff --git a/src/other_tools/root_maps/distdir_git_map.cpp b/src/other_tools/root_maps/distdir_git_map.cpp index c2ba2e20..2fc523f1 100644 --- a/src/other_tools/root_maps/distdir_git_map.cpp +++ b/src/other_tools/root_maps/distdir_git_map.cpp @@ -65,8 +65,6 @@ namespace { /// the setter on success. void ImportFromCASAndSetRoot( DistdirInfo const& key, - bool is_absent, // explicitly given - std::optional<gsl::not_null<IExecutionApi*>> const& remote_api, std::filesystem::path const& distdir_tree_id_file, gsl::not_null<ImportToGitMap*> const& import_to_git_map, gsl::not_null<TaskSystem*> const& ts, @@ -94,8 +92,6 @@ void ImportFromCASAndSetRoot( ts, {std::move(c_info)}, [tmp_dir, // keep tmp_dir alive - is_absent, - remote_api, distdir_tree_id_file, setter, logger](auto const& values) { @@ -115,25 +111,12 @@ void ImportFromCASAndSetRoot( /*fatal=*/true); return; } - // set the workspace root - auto root = nlohmann::json::array( - {FileRoot::kGitTreeMarker, distdir_tree_id}); - if (is_absent) { - // we know serve_api_exists is true and serve endpoint does not - // have the tree, so we need to upload the root to remote CAS - // and tell serve endpoint to set it up - if (not EnsureAbsentRootOnServe(distdir_tree_id, - StorageConfig::GitRoot(), - remote_api, - logger, - /*no_sync_is_fatal = */ true)) { - return; - } - } - else { - root.emplace_back(StorageConfig::GitRoot().string()); - } - (*setter)(std::pair(std::move(root), /*is_cache_hit=*/false)); + // set the workspace root as present + (*setter)(std::pair( + nlohmann::json::array({FileRoot::kGitTreeMarker, + distdir_tree_id, + StorageConfig::GitRoot().string()}), + /*is_cache_hit=*/false)); }, [logger, target_path = tmp_dir->GetPath()](auto const& msg, bool fatal) { @@ -254,6 +237,17 @@ auto CreateDistdirGitMap( /*fatal=*/true); return; } + if (not remote_api) { + (*logger)( + fmt::format( + "Missing or incompatible " + "remote-execution endpoint " + "needed to sync workspace root " + "{} with the serve endpoint.", + distdir_tree_id), + /*fatal=*/true); + return; + } // the tree is known locally, so we upload // it to remote CAS for the serve endpoint // to retrieve it and set up the root @@ -334,8 +328,8 @@ auto CreateDistdirGitMap( auto digest = ArtifactDigest{tree_id, 0, /*is_tree=*/true}; // use this knowledge of the resulting tree identifier to try to set - // up the root (present or absent) without actually checking the - // status of each content blob individually + // up the absent root without actually checking the local status of + // each content blob individually if (key.absent) { if (serve_api_exists) { // first check if serve endpoint has tree @@ -357,8 +351,8 @@ auto CreateDistdirGitMap( ServeApi::RetrieveTreeFromDistdir(key.content_list, /*sync_tree=*/false); if (std::holds_alternative<std::string>(serve_result)) { - // if serve has set up the tree, it must - // match what we expect + // if serve has set up the tree, it must match what we + // expect auto const& served_tree_id = std::get<std::string>(serve_result); if (tree_id != served_tree_id) { @@ -388,6 +382,15 @@ auto CreateDistdirGitMap( /*fatal=*/true); return; } + // we cannot continue without a suitable remote set up + if (not remote_api) { + (*logger)(fmt::format( + "Cannot create workspace root {} as " + "absent for the provided serve endpoint.", + tree_id), + /*fatal=*/true); + return; + } // try to supply the serve endpoint with the tree via the // remote CAS if (remote_api.value()->IsAvailable({digest})) { @@ -436,7 +439,6 @@ auto CreateDistdirGitMap( logger, /*no_sync_is_fatal=*/true)) { // set workspace root as absent - // set workspace root as absent (*setter)(std::pair( nlohmann::json::array( {FileRoot::kGitTreeMarker, tree_id}), @@ -468,8 +470,6 @@ auto CreateDistdirGitMap( // first, look in the local CAS if (local_api->IsAvailable({digest})) { ImportFromCASAndSetRoot(key, - /*is_absent=*/false, - /*remote_api=*/std::nullopt, distdir_tree_id_file, import_to_git_map, ts, @@ -478,7 +478,8 @@ auto CreateDistdirGitMap( // done return; } - // now ask serve endpoint if it can set up the root + // now ask serve endpoint if it can set up the root; as this is for + // a present root, a corresponding remote endpoint is needed if (serve_api_exists and remote_api) { auto serve_result = ServeApi::RetrieveTreeFromDistdir(key.content_list, @@ -497,8 +498,8 @@ auto CreateDistdirGitMap( return; } // we only need the serve endpoint to try to set up the - // root, as we will check the remote CAS for the - // resulting tree anyway + // root, as we will check the remote CAS for the resulting + // tree anyway } else { // check if serve failure was due to distdir content not @@ -521,8 +522,6 @@ auto CreateDistdirGitMap( .type = ObjectType::Tree}}, local_api)) { ImportFromCASAndSetRoot(key, - /*is_absent=*/false, - /*remote_api=*/std::nullopt, distdir_tree_id_file, import_to_git_map, ts, @@ -545,8 +544,6 @@ auto CreateDistdirGitMap( logger]([[maybe_unused]] auto const& values) { // archive blobs are in CAS ImportFromCASAndSetRoot(key, - /*is_absent=*/false, - /*remote_api=*/std::nullopt, distdir_tree_id_file, import_to_git_map, ts, 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); } diff --git a/src/other_tools/root_maps/root_utils.hpp b/src/other_tools/root_maps/root_utils.hpp index bf50e04d..d154eb3e 100644 --- a/src/other_tools/root_maps/root_utils.hpp +++ b/src/other_tools/root_maps/root_utils.hpp @@ -37,6 +37,8 @@ /// defined by a given tree by retrieving it from the remote CAS. This method /// ensures the respective tree is in the remote CAS prior to the ServeApi call /// by uploading it to the remote CAS if it is missing. +/// IMPORTANT: No check is performed for the compatibility mode of the protocol +/// used by given remote execution endpoint! /// \param tree_id The Git-tree identifier. /// \param repo_path Local witnessing Git repository for the tree. /// \param remote_api Optional API of the remote-execution endpoint. If nullopt, diff --git a/src/other_tools/root_maps/tree_id_git_map.cpp b/src/other_tools/root_maps/tree_id_git_map.cpp index 57d8b088..e0456f12 100644 --- a/src/other_tools/root_maps/tree_id_git_map.cpp +++ b/src/other_tools/root_maps/tree_id_git_map.cpp @@ -177,6 +177,15 @@ auto CreateTreeIdGitMap( std::pair(std::move(root), /*is_cache_hit=*/false)); return; } + // we cannot continue without a suitable remote set up + if (not remote_api) { + (*logger)( + fmt::format("Cannot create workspace root {} as absent " + "for the provided serve endpoint.", + key.tree_info.hash), + /*fatal=*/true); + return; + } // check if tree in already in remote CAS auto digest = ArtifactDigest{key.tree_info.hash, 0, /*is_tree=*/true}; @@ -316,7 +325,7 @@ auto CreateTreeIdGitMap( } // give warning that serve endpoint is missing (*logger)(fmt::format("Workspace root {} marked absent but no " - "serve endpoint provided.", + "suitable serve endpoint provided.", key.tree_info.hash), /*fatal=*/false); // set workspace root as absent |