diff options
-rw-r--r-- | CHANGELOG.md | 4 | ||||
-rw-r--r-- | share/man/just.1.md | 14 | ||||
-rw-r--r-- | src/buildtool/common/cli.hpp | 8 | ||||
-rw-r--r-- | src/buildtool/main/main.cpp | 9 |
4 files changed, 33 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index fe57bcc7..bdb281ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,9 @@ A feature release on top of `1.1.0`, backwards compatible. - Actions can now define additional execution properties and in that way chose a specific remote execution image, as well as a factor to scale the time out. This also applies to the built-in - `generic` rule. + `generic` rule. Additionally, the remote-execution endpoint can + be dispatched based on the remote-execution properties using + the `--endpoint-configuration` argument. - Relative non-upwards symbolic links are now treated as first-class objects. This introduces a new artifact type and allows the free use of such symbolic links throughout the build process. diff --git a/share/man/just.1.md b/share/man/just.1.md index 19a748cc..aaa4e4f5 100644 --- a/share/man/just.1.md +++ b/share/man/just.1.md @@ -495,6 +495,20 @@ Supported by: analyse|build|install|rebuild|traverse. Address of the remote execution service. Supported by: analyse|build|install-cas|install|rebuild|traverse. +**`--endpoint-configuration`** FILE +File containing a description on how to dispatch to different +remote-execution endpoints based on the the execution properties. +The format is a JSON list of pairs (lists of length two) of an object +of strings and a string. The first entry describes a condition (the +remote-execution properties have to agree on the domain of this +object), the is remote-exeuction address in the NAME:PORT format as +for the **`-r`** option. The first matching entry (if any) is taken; +in none matches the default execution endpoint is taken (either +as specified by **`-r`**, or local execution if no endpoint is +specified). +Supported by: analyse|build|install-cas|install|rebuild|traverse. + + Authentication options ---------------------- diff --git a/src/buildtool/common/cli.hpp b/src/buildtool/common/cli.hpp index d3d15409..74ff0cce 100644 --- a/src/buildtool/common/cli.hpp +++ b/src/buildtool/common/cli.hpp @@ -90,6 +90,7 @@ struct EndpointArguments { std::optional<std::filesystem::path> local_root{}; std::optional<std::string> remote_execution_address; std::vector<std::string> platform_properties; + std::optional<std::filesystem::path> remote_execution_dispatch_file{}; }; /// \brief Arguments required for building. @@ -378,8 +379,13 @@ static inline auto SetupEndpointArguments( gsl::not_null<EndpointArguments*> const& clargs) { app->add_option("-r,--remote-execution-address", clargs->remote_execution_address, - "Address of the remote execution service.") + "Address of the remote-execution service.") ->type_name("NAME:PORT"); + app->add_option("--endpoint-configuration", + clargs->remote_execution_dispatch_file, + "File with dispatch instructions to use different " + "remote-execution services, depending on the properties") + ->type_name("PATH"); app->add_option( "--remote-execution-property", clargs->platform_properties, diff --git a/src/buildtool/main/main.cpp b/src/buildtool/main/main.cpp index ceecc77c..846fe257 100644 --- a/src/buildtool/main/main.cpp +++ b/src/buildtool/main/main.cpp @@ -330,6 +330,15 @@ void SetupExecutionConfig(EndpointArguments const& eargs, std::exit(kExitFailure); } } + if (eargs.remote_execution_dispatch_file) { + if (not RemoteConfig::SetRemoteExecutionDispatch( + *eargs.remote_execution_dispatch_file)) { + Logger::Log(LogLevel::Error, + "setting remote execution dispatch based on file '{}'", + eargs.remote_execution_dispatch_file->string()); + std::exit(kExitFailure); + } + } if (rargs.cache_endpoint) { if (not(RemoteConfig::SetCacheAddress(*rargs.cache_endpoint) == (*rargs.cache_endpoint != "local"))) { |