diff options
-rw-r--r-- | src/buildtool/main/main.cpp | 21 | ||||
-rw-r--r-- | src/buildtool/serve_api/remote/configuration_client.cpp | 4 | ||||
-rw-r--r-- | test/end-to-end/serve-service/serve_start_execute.sh | 7 |
3 files changed, 27 insertions, 5 deletions
diff --git a/src/buildtool/main/main.cpp b/src/buildtool/main/main.cpp index d6b06471..25458ef4 100644 --- a/src/buildtool/main/main.cpp +++ b/src/buildtool/main/main.cpp @@ -135,17 +135,32 @@ void SetupExecutionConfig(EndpointArguments const& eargs, } void SetupServeConfig(ServeArguments const& srvargs) { - using RemoteConfig = RemoteServeConfig; if (srvargs.remote_serve_address) { - if (not RemoteConfig::SetRemoteAddress(*srvargs.remote_serve_address)) { + if (not RemoteServeConfig::SetRemoteAddress( + *srvargs.remote_serve_address)) { Logger::Log(LogLevel::Error, "setting serve service address '{}' failed.", *srvargs.remote_serve_address); std::exit(kExitFailure); } + // if the user has not provided the --remote-execution-address, we fall + // back to the --remote-serve-address + if (auto client_remote_address = RemoteExecutionConfig::RemoteAddress(); + !client_remote_address) { + if (!RemoteExecutionConfig::SetRemoteAddress( + *srvargs.remote_serve_address)) { + Logger::Log(LogLevel::Error, + "setting remote execution address '{}' failed.", + *srvargs.remote_serve_address); + std::exit(kExitFailure); + } + Logger::Log(LogLevel::Info, + "Using '{}' as the remote execution endpoint.", + *srvargs.remote_serve_address); + } } if (not srvargs.repositories.empty() and - not RemoteConfig::SetKnownRepositories(srvargs.repositories)) { + not RemoteServeConfig::SetKnownRepositories(srvargs.repositories)) { Logger::Log(LogLevel::Error, "setting serve service repositories failed."); std::exit(kExitFailure); diff --git a/src/buildtool/serve_api/remote/configuration_client.cpp b/src/buildtool/serve_api/remote/configuration_client.cpp index 25c38d79..f0615951 100644 --- a/src/buildtool/serve_api/remote/configuration_client.cpp +++ b/src/buildtool/serve_api/remote/configuration_client.cpp @@ -22,8 +22,8 @@ auto ConfigurationClient::CheckServeRemoteExecution() -> bool { auto client_remote_address = RemoteExecutionConfig::RemoteAddress(); if (!client_remote_address) { logger_.Emit(LogLevel::Error, - "In order to use just-serve, also the " - "--remote-execution-address option must be given."); + "Internal error: the remote execution endpoint should " + "have been set."); return false; } diff --git a/test/end-to-end/serve-service/serve_start_execute.sh b/test/end-to-end/serve-service/serve_start_execute.sh index 6cc0448f..5cad0400 100644 --- a/test/end-to-end/serve-service/serve_start_execute.sh +++ b/test/end-to-end/serve-service/serve_start_execute.sh @@ -77,3 +77,10 @@ ENDTARGETS "${JUST}" install --local-build-root "${LBR}" -r localhost:${PORT} -o . grep 'just-serve-just-execute' out.txt + +# test that if we only pass --remote-serve-address it is also used as remote +# execution endpoint + +rm -rf "${LBR}" +"${JUST}" install --local-build-root "${LBR}" --remote-serve-address localhost:${PORT} -o . +grep 'just-serve-just-execute' out.txt |