From 669d1d8714b258ffd19f1610028374233a143f4b Mon Sep 17 00:00:00 2001 From: Paul Cristian Sarbu Date: Fri, 8 Sep 2023 18:15:01 +0200 Subject: just-mr: Implement 'absent' roots ...via an 'absent' pragma in repository descriptions. For 'git'-type repositories, first interrogates a 'just serve' remote, if given, before reverting to fetching from the network. --- src/other_tools/just_mr/setup_utils.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/other_tools/just_mr/setup_utils.cpp') diff --git a/src/other_tools/just_mr/setup_utils.cpp b/src/other_tools/just_mr/setup_utils.cpp index 28355e89..b325a71d 100644 --- a/src/other_tools/just_mr/setup_utils.cpp +++ b/src/other_tools/just_mr/setup_utils.cpp @@ -15,6 +15,9 @@ #include "src/other_tools/just_mr/setup_utils.hpp" #include +#include +#include +#include #include #include "nlohmann/json.hpp" @@ -24,6 +27,7 @@ #include "src/buildtool/execution_api/remote/bazel/bazel_api.hpp" #include "src/buildtool/file_system/file_system_manager.hpp" #include "src/buildtool/logging/logger.hpp" +#include "src/buildtool/serve_api/remote/config.hpp" #include "src/other_tools/just_mr/exit_codes.hpp" namespace { @@ -202,4 +206,22 @@ auto SetupRemoteApi(std::optional const& remote_exec_addr, return nullptr; } +auto SetupServeApi(std::optional const& remote_serve_addr, + MultiRepoRemoteAuthArguments const& auth) -> ServeApi::Ptr { + if (remote_serve_addr) { + // setup authentication + SetupAuthConfig(auth); + // setup remote + if (not RemoteServeConfig::SetRemoteAddress(*remote_serve_addr)) { + Logger::Log(LogLevel::Error, + "setting remote serve service address '{}' failed.", + *remote_serve_addr); + std::exit(kExitConfigError); + } + auto address = RemoteServeConfig::RemoteAddress(); + return std::make_unique(address->host, address->port); + } + return nullptr; +} + } // namespace JustMR::Utils -- cgit v1.2.3