From 10eabcf67a3089ce9be57df2389ef6af0123eb8b Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Tue, 25 Feb 2025 10:14:53 +0100 Subject: Invocation meta-data: include repository-config digest To do so, extend multi-repo setup to also return the digest of the configuration file. --- src/other_tools/just_mr/setup.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src/other_tools/just_mr/setup.cpp') diff --git a/src/other_tools/just_mr/setup.cpp b/src/other_tools/just_mr/setup.cpp index 5fb8dfed..9ba02fa7 100644 --- a/src/other_tools/just_mr/setup.cpp +++ b/src/other_tools/just_mr/setup.cpp @@ -30,6 +30,7 @@ #include "nlohmann/json.hpp" #include "src/buildtool/build_engine/expression/expression.hpp" #include "src/buildtool/build_engine/expression/expression_ptr.hpp" +#include "src/buildtool/common/artifact_digest.hpp" #include "src/buildtool/common/remote/remote_common.hpp" #include "src/buildtool/common/user_structs.hpp" #include "src/buildtool/crypto/hash_function.hpp" @@ -51,7 +52,6 @@ #include "src/buildtool/multithreading/task_system.hpp" #include "src/buildtool/progress_reporting/base_progress_reporter.hpp" #include "src/buildtool/serve_api/remote/serve_api.hpp" -#include "src/buildtool/storage/fs_utils.hpp" #include "src/buildtool/storage/garbage_collector.hpp" #include "src/other_tools/just_mr/progress_reporting/progress.hpp" #include "src/other_tools/just_mr/progress_reporting/progress_reporter.hpp" @@ -82,7 +82,7 @@ auto MultiRepoSetup(std::shared_ptr const& config, Storage const& native_storage, bool interactive, std::string const& multi_repo_tool_name) - -> std::optional { + -> std::optional> { // provide report Logger::Log(LogLevel::Info, "Performing repositories setup"); // set anchor dir to setup_root; current dir will be reverted when anchor @@ -536,5 +536,14 @@ auto MultiRepoSetup(std::shared_ptr const& config, return std::nullopt; } // if successful, return the output config - return StorageUtils::AddToCAS(native_storage, mr_config.dump(2)); + auto const& cas = native_storage.CAS(); + auto digest = cas.StoreBlob(mr_config.dump(2)); + if (not digest) { + return std::nullopt; + } + auto blob_path = cas.BlobPath(*digest, /*is_executable=*/false); + if (not blob_path) { + return std::nullopt; + } + return std::make_optional(std::make_pair(*blob_path, digest->hash())); } -- cgit v1.2.3