summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/other_tools/just_mr/fetch.cpp6
-rw-r--r--src/other_tools/just_mr/setup.cpp6
-rw-r--r--src/other_tools/just_mr/setup_utils.cpp11
-rw-r--r--src/other_tools/just_mr/setup_utils.hpp1
-rw-r--r--src/other_tools/ops_maps/TARGETS1
-rw-r--r--src/other_tools/ops_maps/git_tree_fetch_map.cpp15
-rw-r--r--src/other_tools/root_maps/commit_git_map.cpp8
-rw-r--r--src/other_tools/root_maps/distdir_git_map.cpp23
-rw-r--r--src/other_tools/root_maps/fpath_git_map.cpp10
-rw-r--r--src/other_tools/root_maps/tree_id_git_map.cpp9
10 files changed, 28 insertions, 62 deletions
diff --git a/src/other_tools/just_mr/fetch.cpp b/src/other_tools/just_mr/fetch.cpp
index 083284b9..db2eedcd 100644
--- a/src/other_tools/just_mr/fetch.cpp
+++ b/src/other_tools/just_mr/fetch.cpp
@@ -454,8 +454,10 @@ auto MultiRepoFetch(std::shared_ptr<Configuration> const& config,
nr_gt != 0 ? str_gt : std::string());
// setup the APIs for archive fetches
- auto remote_api = JustMR::Utils::GetRemoteApi(
- common_args.remote_execution_address, auth_args);
+ 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>()};
// setup the API for serving trees of Git repos or archives
diff --git a/src/other_tools/just_mr/setup.cpp b/src/other_tools/just_mr/setup.cpp
index f1a65157..6d716d54 100644
--- a/src/other_tools/just_mr/setup.cpp
+++ b/src/other_tools/just_mr/setup.cpp
@@ -105,8 +105,10 @@ auto MultiRepoSetup(std::shared_ptr<Configuration> const& config,
}
// setup the APIs for archive fetches
- auto remote_api = JustMR::Utils::GetRemoteApi(
- common_args.remote_execution_address, auth_args);
+ 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>()};
// setup the API for serving trees of Git repos or archives
diff --git a/src/other_tools/just_mr/setup_utils.cpp b/src/other_tools/just_mr/setup_utils.cpp
index c3799b1f..c6805e07 100644
--- a/src/other_tools/just_mr/setup_utils.cpp
+++ b/src/other_tools/just_mr/setup_utils.cpp
@@ -236,17 +236,20 @@ auto ReadConfiguration(
}
auto GetRemoteApi(std::optional<std::string> const& remote_exec_addr,
+ std::optional<std::string> const& remote_serve_addr,
MultiRepoRemoteAuthArguments const& auth)
-> IExecutionApi::Ptr {
- // we only allow remotes in native mode
- if (remote_exec_addr and not Compatibility::IsCompatible()) {
+ // if only a serve endpoint address is given, we assume it is one that acts
+ // also as remote-execution
+ auto remote_addr = remote_exec_addr ? remote_exec_addr : remote_serve_addr;
+ if (remote_addr) {
// setup authentication
SetupAuthConfig(auth);
// setup remote
- if (not RemoteExecutionConfig::SetRemoteAddress(*remote_exec_addr)) {
+ if (not RemoteExecutionConfig::SetRemoteAddress(*remote_addr)) {
Logger::Log(LogLevel::Error,
"setting remote execution address '{}' failed.",
- *remote_exec_addr);
+ *remote_addr);
std::exit(kExitConfigError);
}
auto address = RemoteExecutionConfig::RemoteAddress();
diff --git a/src/other_tools/just_mr/setup_utils.hpp b/src/other_tools/just_mr/setup_utils.hpp
index 80f01d75..11d4af45 100644
--- a/src/other_tools/just_mr/setup_utils.hpp
+++ b/src/other_tools/just_mr/setup_utils.hpp
@@ -65,6 +65,7 @@ void DefaultReachableRepositories(
/// \returns Pointer to a configured remote API, or nullptr.
[[nodiscard]] auto GetRemoteApi(
std::optional<std::string> const& remote_exec_addr,
+ std::optional<std::string> const& remote_serve_addr,
MultiRepoRemoteAuthArguments const& auth) -> IExecutionApi::Ptr;
/// \brief Setup of a 'just serve' remote API based on just-mr arguments.
diff --git a/src/other_tools/ops_maps/TARGETS b/src/other_tools/ops_maps/TARGETS
index 9c708f33..41f73000 100644
--- a/src/other_tools/ops_maps/TARGETS
+++ b/src/other_tools/ops_maps/TARGETS
@@ -119,6 +119,7 @@
, "private-deps":
[ ["src/other_tools/ops_maps", "critical_git_op_map"]
, ["src/buildtool/common", "config"]
+ , ["src/buildtool/compatibility", "compatibility"]
, ["src/buildtool/execution_api/common", "common"]
, ["src/buildtool/file_system", "file_system_manager"]
, ["src/buildtool/multithreading", "task_system"]
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 e70ded2b..3dbb557a 100644
--- a/src/other_tools/ops_maps/git_tree_fetch_map.cpp
+++ b/src/other_tools/ops_maps/git_tree_fetch_map.cpp
@@ -18,6 +18,7 @@
#include "fmt/core.h"
#include "src/buildtool/common/repository_config.hpp"
+#include "src/buildtool/compatibility/compatibility.hpp"
#include "src/buildtool/execution_api/common/execution_common.hpp"
#include "src/buildtool/file_system/file_system_manager.hpp"
#include "src/buildtool/multithreading/task_system.hpp"
@@ -104,7 +105,9 @@ void MoveCASTreeToGit(
/*fatal=*/true);
return;
}
- if (backup_to_remote and remote_api != std::nullopt) {
+ // backup to remote if needed and in compatibility mode
+ if (backup_to_remote and remote_api != std::nullopt and
+ not Compatibility::IsCompatible()) {
BackupToRemote(tree_id, *remote_api, logger);
}
(*setter)(false /*no cache hit*/);
@@ -201,8 +204,9 @@ auto CreateGitTreeFetchMap(
return;
}
if (*tree_found) {
- // backup to remote, if needed
- if (backup_to_remote and remote_api != std::nullopt) {
+ // backup to remote if needed and in native mode
+ if (backup_to_remote and remote_api != std::nullopt and
+ not Compatibility::IsCompatible()) {
BackupToRemote(key.hash, *remote_api, logger);
}
// success
@@ -465,9 +469,10 @@ auto CreateGitTreeFetchMap(
}
JustMRProgress::Instance().TaskTracker().Stop(
key.origin);
- // backup to remote, if needed
+ // backup to remote if needed and in native mode
if (backup_to_remote and
- remote_api != std::nullopt) {
+ remote_api != std::nullopt and
+ not Compatibility::IsCompatible()) {
BackupToRemote(
key.hash, *remote_api, logger);
}
diff --git a/src/other_tools/root_maps/commit_git_map.cpp b/src/other_tools/root_maps/commit_git_map.cpp
index 7dc332ea..ddbe3a88 100644
--- a/src/other_tools/root_maps/commit_git_map.cpp
+++ b/src/other_tools/root_maps/commit_git_map.cpp
@@ -90,14 +90,6 @@ void EnsureRootAsAbsent(
/*fatal=*/true);
return;
}
- if (not remote_api) {
- (*logger)(fmt::format("Missing 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/distdir_git_map.cpp b/src/other_tools/root_maps/distdir_git_map.cpp
index 2ee0265f..c2ba2e20 100644
--- a/src/other_tools/root_maps/distdir_git_map.cpp
+++ b/src/other_tools/root_maps/distdir_git_map.cpp
@@ -254,19 +254,6 @@ auto CreateDistdirGitMap(
/*fatal=*/true);
return;
}
- // at this point we cannot continue without
- // the remote api
- if (not remote_api) {
- (*logger)(
- fmt::format(
- "Missing 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
@@ -401,16 +388,6 @@ auto CreateDistdirGitMap(
/*fatal=*/true);
return;
}
- // at this point we cannot continue without the remote api
- if (not remote_api) {
- (*logger)(
- fmt::format("Missing remote-execution endpoint "
- "needed to sync workspace root {} with "
- "the 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})) {
diff --git a/src/other_tools/root_maps/fpath_git_map.cpp b/src/other_tools/root_maps/fpath_git_map.cpp
index 7ca438c1..11344de1 100644
--- a/src/other_tools/root_maps/fpath_git_map.cpp
+++ b/src/other_tools/root_maps/fpath_git_map.cpp
@@ -46,17 +46,9 @@ void CheckServeAndSetRoot(
return; // fatal
}
if (not *has_tree) {
- if (not remote_api) {
- (*logger)(fmt::format(
- "Missing remote-execution endpoint needed to "
- "sync workspace root {} with the serve endpoint.",
- tree_id),
- /*fatal=*/true);
- return;
- }
if (not EnsureAbsentRootOnServe(tree_id,
repo_root,
- remote_api,
+ *remote_api,
logger,
/*no_sync_is_fatal=*/absent)) {
return; // fatal
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 c8e55d9c..57d8b088 100644
--- a/src/other_tools/root_maps/tree_id_git_map.cpp
+++ b/src/other_tools/root_maps/tree_id_git_map.cpp
@@ -177,15 +177,6 @@ auto CreateTreeIdGitMap(
std::pair(std::move(root), /*is_cache_hit=*/false));
return;
}
- // at this point we cannot proceed without the remote api
- if (not remote_api) {
- (*logger)(fmt::format("Missing remote-execution endpoint "
- "needed to sync workspace root {} "
- "with the 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};