From 21481c72129ba81c3f22c531b45945924f9c780c Mon Sep 17 00:00:00 2001 From: Sascha Roloff Date: Tue, 27 Jun 2023 19:41:12 +0200 Subject: Update remote execution api to preliminary version v2.3 In preparation for the introduction of our blob splitting protocol as extension to the remote execution api, we need to update the used remote execution api to a more recent version than v2.0.0. Since no new tags are available right now, we update to the preliminary protocol version v2.3 according to the following discussion: https://github.com/bazelbuild/remote-apis/issues/253 --- .../execution_api/bazel_msg/bazel_msg_factory.cpp | 31 ++++++++++++++-------- .../execution_api/bazel_msg/bazel_msg_factory.hpp | 1 - .../execution_service/capabilities_server.cpp | 2 +- src/buildtool/execution_api/local/local_action.hpp | 1 - .../execution_api/remote/bazel/bazel_action.cpp | 1 - 5 files changed, 21 insertions(+), 15 deletions(-) (limited to 'src/buildtool/execution_api') diff --git a/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.cpp b/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.cpp index 12f7398f..9104b94d 100644 --- a/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.cpp +++ b/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.cpp @@ -211,9 +211,10 @@ template copy_nodes(dir.mutable_directories(), dirs); copy_nodes(dir.mutable_symlinks(), links); - std::copy(props.cbegin(), - props.cend(), - pb::back_inserter(dir.mutable_node_properties())); + std::copy( + props.cbegin(), + props.cend(), + pb::back_inserter(dir.mutable_node_properties()->mutable_properties())); return dir; } @@ -229,7 +230,8 @@ template node.set_is_executable(IsExecutableObject(type)); std::copy(props.cbegin(), props.cend(), - pb::back_inserter(node.mutable_node_properties())); + pb::back_inserter( + node.mutable_node_properties()->mutable_properties())); return node; } @@ -252,7 +254,8 @@ template node.set_target(target); std::copy(props.cbegin(), props.cend(), - pb::back_inserter(node.mutable_node_properties())); + pb::back_inserter( + node.mutable_node_properties()->mutable_properties())); return node; } @@ -322,6 +325,10 @@ template std::vector const& platform_properties) -> CommandBundle::Ptr { bazel_re::Command msg; + // DEPRECATED as of v2.2: platform properties are now specified + // directly in the action. See documentation note in the + // [Action][build.bazel.remote.execution.v2.Action] for migration. + // (https://github.com/bazelbuild/remote-apis/blob/e1fe21be4c9ae76269a5a63215bb3c72ed9ab3f0/build/bazel/remote/execution/v2/remote_execution.proto#L646) msg.set_allocated_platform(CreatePlatform(platform_properties).release()); std::copy(std::cbegin(args), std::cend(args), @@ -349,7 +356,7 @@ template [[nodiscard]] auto CreateActionBundle( bazel_re::Digest const& command, bazel_re::Digest const& root_dir, - std::vector const& output_node_properties, + std::vector const& platform_properties, bool do_not_cache, std::chrono::milliseconds const& timeout) -> ActionBundle::Ptr { using seconds = std::chrono::seconds; @@ -368,9 +375,12 @@ template gsl::owner{new bazel_re::Digest{command}}); msg.set_allocated_input_root_digest( gsl::owner{new bazel_re::Digest{root_dir}}); - std::copy(output_node_properties.cbegin(), - output_node_properties.cend(), - pb::back_inserter(msg.mutable_output_node_properties())); + // New in version 2.2: clients SHOULD set these platform properties + // as well as those in the + // [Command][build.bazel.remote.execution.v2.Command]. Servers + // SHOULD prefer those set here. + // (https://github.com/bazelbuild/remote-apis/blob/e1fe21be4c9ae76269a5a63215bb3c72ed9ab3f0/build/bazel/remote/execution/v2/remote_execution.proto#L516) + msg.set_allocated_platform(CreatePlatform(platform_properties).release()); auto content_creator = [&msg] { return SerializeMessage(msg); }; @@ -728,7 +738,6 @@ auto BazelMsgFactory::CreateActionDigestFromCommandLine( bazel_re::Digest const& exec_dir, std::vector const& output_files, std::vector const& output_dirs, - std::vector const& output_node_properties, std::vector const& env_vars, std::vector const& properties, bool do_not_cache, @@ -740,7 +749,7 @@ auto BazelMsgFactory::CreateActionDigestFromCommandLine( // create action auto action = CreateActionBundle( - cmd->Digest(), exec_dir, output_node_properties, do_not_cache, timeout); + cmd->Digest(), exec_dir, properties, do_not_cache, timeout); if (store_blob) { (*store_blob)(cmd->MakeBlob(/*is_exec=*/false)); diff --git a/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.hpp b/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.hpp index ca913c63..f27f246f 100644 --- a/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.hpp +++ b/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.hpp @@ -127,7 +127,6 @@ class BazelMsgFactory { bazel_re::Digest const& exec_dir, std::vector const& output_files, std::vector const& output_dirs, - std::vector const& output_node_properties, std::vector const& env_vars, std::vector const& properties, bool do_not_cache, diff --git a/src/buildtool/execution_api/execution_service/capabilities_server.cpp b/src/buildtool/execution_api/execution_service/capabilities_server.cpp index ea480301..35126bd3 100644 --- a/src/buildtool/execution_api/execution_service/capabilities_server.cpp +++ b/src/buildtool/execution_api/execution_service/capabilities_server.cpp @@ -30,7 +30,7 @@ auto CapabilitiesServiceImpl::GetCapabilities( ::bazel_re::CacheCapabilities cache; ::bazel_re::ExecutionCapabilities exec; - cache.add_digest_function( + cache.add_digest_functions( ::bazel_re::DigestFunction_Value::DigestFunction_Value_SHA256); cache.mutable_action_cache_update_capabilities()->set_update_enabled(false); static constexpr std::size_t kMaxBatchTransferSize = 1024 * 1024; diff --git a/src/buildtool/execution_api/local/local_action.hpp b/src/buildtool/execution_api/local/local_action.hpp index 95f95ff4..82101016 100644 --- a/src/buildtool/execution_api/local/local_action.hpp +++ b/src/buildtool/execution_api/local/local_action.hpp @@ -91,7 +91,6 @@ class LocalAction final : public IExecutionAction { exec_dir, output_files_, output_dirs_, - {} /*FIXME output node properties*/, BazelMsgFactory::CreateMessageVectorFromMap< bazel_re::Command_EnvironmentVariable>(env_vars_), properties_, diff --git a/src/buildtool/execution_api/remote/bazel/bazel_action.cpp b/src/buildtool/execution_api/remote/bazel/bazel_action.cpp index d7f9f389..04d4c3f7 100644 --- a/src/buildtool/execution_api/remote/bazel/bazel_action.cpp +++ b/src/buildtool/execution_api/remote/bazel/bazel_action.cpp @@ -91,7 +91,6 @@ auto BazelAction::CreateBundlesForAction(BlobContainer* blobs, exec_dir, output_files_, output_dirs_, - {} /*FIXME output node properties*/, env_vars_, properties_, do_not_cache, -- cgit v1.2.3