From 0bd3bb3c38e6c50650bf05aab8d69e62036b7765 Mon Sep 17 00:00:00 2001 From: Paul Cristian Sarbu Date: Thu, 24 Aug 2023 10:34:07 +0200 Subject: just-mr: Add remote execution and mTLS arguments These have similar meanings as in 'just', are forwarded to 'just' subcommands that support them, and can be set also in the RC file via appropriate fields. --- src/other_tools/just_mr/launch.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'src/other_tools/just_mr/launch.cpp') diff --git a/src/other_tools/just_mr/launch.cpp b/src/other_tools/just_mr/launch.cpp index 0d8f263b..61953cda 100644 --- a/src/other_tools/just_mr/launch.cpp +++ b/src/other_tools/just_mr/launch.cpp @@ -33,6 +33,7 @@ auto CallJust(std::optional const& config_file, MultiRepoSetupArguments const& setup_args, MultiRepoJustSubCmdsArguments const& just_cmd_args, MultiRepoLogArguments const& log_args, + MultiRepoRemoteAuthArguments const& auth_args, bool forward_build_root) -> int { // check if subcmd_name can be taken from additional args auto additional_args_offset = 0U; @@ -46,6 +47,9 @@ auto CallJust(std::optional const& config_file, bool use_build_root{false}; bool use_launcher{false}; bool supports_defines{false}; + bool supports_remote{false}; + bool supports_cacert{false}; + bool supports_client_auth{false}; std::optional mr_config_path{std::nullopt}; std::optional lock{}; @@ -74,6 +78,10 @@ auto CallJust(std::optional const& config_file, use_build_root = kKnownJustSubcommands.at(*subcommand).build_root; use_launcher = kKnownJustSubcommands.at(*subcommand).launch; supports_defines = kKnownJustSubcommands.at(*subcommand).defines; + supports_remote = kKnownJustSubcommands.at(*subcommand).remote; + supports_cacert = kKnownJustSubcommands.at(*subcommand).cacert; + supports_client_auth = + kKnownJustSubcommands.at(*subcommand).client_auth; } // build just command std::vector cmd = {common_args.just_path->string()}; @@ -135,6 +143,29 @@ auto CallJust(std::optional const& config_file, cmd.emplace_back(overlay_config.ToString()); } } + // forward remote execution arguments + if (supports_remote and (common_args.compatible == true)) { + cmd.emplace_back("--compatible"); + } + if (supports_remote and common_args.remote_execution_address) { + cmd.emplace_back("-r"); + cmd.emplace_back(*common_args.remote_execution_address); + } + // forward mutual TLS arguments + if (supports_cacert and auth_args.tls_ca_cert) { + cmd.emplace_back("--tls-ca-cert"); + cmd.emplace_back(auth_args.tls_ca_cert->string()); + } + if (supports_client_auth) { + if (auth_args.tls_client_cert) { + cmd.emplace_back("--tls-client-cert"); + cmd.emplace_back(auth_args.tls_client_cert->string()); + } + if (auth_args.tls_client_key) { + cmd.emplace_back("--tls-client-key"); + cmd.emplace_back(auth_args.tls_client_key->string()); + } + } // add args read from just-mrrc if (subcommand and just_cmd_args.just_args.contains(*subcommand)) { for (auto const& subcmd_arg : just_cmd_args.just_args.at(*subcommand)) { -- cgit v1.2.3