summaryrefslogtreecommitdiff
path: root/src/other_tools/just_mr/setup.cpp
diff options
context:
space:
mode:
authorPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2024-07-01 14:56:32 +0200
committerPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2024-07-04 16:05:08 +0200
commit9ab21a7f3d7e349b05ceaad5862d7e72a6d7e7b4 (patch)
tree269b95c86875d9bd4fe16e117aa9ba75b6c60304 /src/other_tools/just_mr/setup.cpp
parent0cbc8e226b39ec731373b80024e23cc0580c27ac (diff)
downloadjustbuild-9ab21a7f3d7e349b05ceaad5862d7e72a6d7e7b4.tar.gz
Pass Auth::TLS instance to BazelApi and ServeApi
Diffstat (limited to 'src/other_tools/just_mr/setup.cpp')
-rw-r--r--src/other_tools/just_mr/setup.cpp23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/other_tools/just_mr/setup.cpp b/src/other_tools/just_mr/setup.cpp
index dacbfec6..70c74eb0 100644
--- a/src/other_tools/just_mr/setup.cpp
+++ b/src/other_tools/just_mr/setup.cpp
@@ -18,9 +18,11 @@
#include <condition_variable>
#include <cstddef>
#include <exception>
+#include <optional>
#include <thread>
#include "nlohmann/json.hpp"
+#include "src/buildtool/auth/authentication.hpp"
#include "src/buildtool/execution_api/common/api_bundle.hpp"
#include "src/buildtool/execution_api/common/execution_api.hpp"
#include "src/buildtool/file_system/symlinks_map/resolve_symlinks_map.hpp"
@@ -111,24 +113,31 @@ auto MultiRepoSetup(std::shared_ptr<Configuration> const& config,
}
// setup the APIs for archive fetches; only happens if in native mode
- // setup the APIs for archive fetches; only happens if in native mode
JustMR::Utils::SetupRemoteConfig(common_args.remote_execution_address,
- common_args.remote_serve_address,
- auth_args);
+ common_args.remote_serve_address);
+
+ // setup authentication
+ JustMR::Utils::SetupAuthConfig(auth_args);
+ std::optional<Auth::TLS> auth = {};
+ if (Auth::Instance().GetAuthMethod() == AuthMethod::kTLS) {
+ auth = Auth::TLS::Instance();
+ }
+
+ ApiBundle const apis{/*repo_config=*/nullptr,
+ auth ? &*auth : nullptr,
+ RemoteExecutionConfig::RemoteAddress()};
- ApiBundle const apis{nullptr, RemoteExecutionConfig::RemoteAddress()};
bool const has_remote_api =
apis.local != apis.remote and not common_args.compatible;
// setup the API for serving roots
- auto serve_config = JustMR::Utils::CreateServeConfig(
- common_args.remote_serve_address, auth_args);
+ auto serve_config =
+ JustMR::Utils::CreateServeConfig(common_args.remote_serve_address);
if (not serve_config) {
return std::nullopt;
}
auto serve = ServeApi::Create(*serve_config, &apis);
-
// check configuration of the serve endpoint provided
if (serve) {
// if we have a remote endpoint explicitly given by the user, it must