You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by sz...@apache.org on 2023/05/23 03:51:28 UTC

[nifi-minifi-cpp] branch main updated (6a4d19939 -> c9624ffb6)

This is an automated email from the ASF dual-hosted git repository.

szaszm pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git


    from 6a4d19939 MINIFICPP-2107 fix macOS make package
     new 0cb736359 MINIFICPP-2109 Log json parse error, use the configuration class's own logger for reporting
     new 073967852 MINIFICPP-2111 Remove test-only method
     new 1d4c07182 MINIFICPP-2113 Add support for multi arch docker build
     new c9624ffb6 MINIFICPP-2122 Upgrade CivetWeb to version 1.16

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 CMakeLists.txt                                     |   2 +
 bootstrap.sh                                       |   2 +-
 cmake/CivetWeb.cmake                               |   4 +-
 cmake/DockerConfig.cmake                           |  28 ++++-
 cmake/MiNiFiOptions.cmake                          |   3 +-
 docker/DockerBuild.sh                              | 116 ++++++++++++++-------
 extensions/http-curl/tests/HTTPSiteToSiteTests.cpp |  26 ++---
 .../tests/unit/AdaptiveConfigurationTests.cpp      |  29 ++++++
 .../tests/unit/YamlConfigurationTests.cpp          |  44 ++++----
 libminifi/include/core/yaml/YamlConfiguration.h    |  13 ---
 libminifi/include/utils/gsl.h                      |  16 +--
 libminifi/src/core/flow/AdaptiveConfiguration.cpp  |  33 +++---
 .../src/core/flow/StructuredConfiguration.cpp      |  35 ++++---
 libminifi/src/core/yaml/YamlConfiguration.cpp      |  13 +--
 14 files changed, 214 insertions(+), 150 deletions(-)


[nifi-minifi-cpp] 04/04: MINIFICPP-2122 Upgrade CivetWeb to version 1.16

Posted by sz...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

szaszm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git

commit c9624ffb6fa87bcb361405b1671494201b4a46dd
Author: Gabor Gyimesi <ga...@gmail.com>
AuthorDate: Mon May 22 14:14:31 2023 +0200

    MINIFICPP-2122 Upgrade CivetWeb to version 1.16
    
    Closes #1575
    Signed-off-by: Marton Szasz <sz...@apache.org>
---
 cmake/CivetWeb.cmake                               |  4 ++--
 extensions/http-curl/tests/HTTPSiteToSiteTests.cpp | 26 ++++++----------------
 2 files changed, 9 insertions(+), 21 deletions(-)

diff --git a/cmake/CivetWeb.cmake b/cmake/CivetWeb.cmake
index effc81564..cbd1b2c31 100644
--- a/cmake/CivetWeb.cmake
+++ b/cmake/CivetWeb.cmake
@@ -26,8 +26,8 @@ set(CIVETWEB_ALLOW_WARNINGS "ON" CACHE STRING "" FORCE)
 set(CIVETWEB_ENABLE_ASAN "OFF" CACHE STRING "" FORCE)
 
 FetchContent_Declare(civetweb
-    GIT_REPOSITORY "https://github.com/civetweb/civetweb.git"
-    GIT_TAG "4447b6501d5c568b4c6c0940eac801ec690b2250" # commit containing fix for MSVC issue https://github.com/civetweb/civetweb/issues/1024
+    URL      https://github.com/civetweb/civetweb/archive/refs/tags/v1.16.tar.gz
+    URL_HASH SHA256=f0e471c1bf4e7804a6cfb41ea9d13e7d623b2bcc7bc1e2a4dd54951a24d60285
 )
 
 FetchContent_MakeAvailable(civetweb)
diff --git a/extensions/http-curl/tests/HTTPSiteToSiteTests.cpp b/extensions/http-curl/tests/HTTPSiteToSiteTests.cpp
index 78ca8ac5f..311c7b501 100644
--- a/extensions/http-curl/tests/HTTPSiteToSiteTests.cpp
+++ b/extensions/http-curl/tests/HTTPSiteToSiteTests.cpp
@@ -77,7 +77,7 @@ class SiteToSiteTestHarness : public HTTPIntegrationBase {
 struct test_profile {
   [[nodiscard]] bool allFalse() const {
     return !flow_url_broken && !transaction_url_broken &&
-      !empty_transaction_url && !no_delete && !invalid_checksum;
+      !empty_transaction_url && !invalid_checksum;
   }
   // tests for a broken flow file url
   bool flow_url_broken{false};
@@ -85,8 +85,6 @@ struct test_profile {
   bool transaction_url_broken{false};
   // Location will be absent within the
   bool empty_transaction_url{false};
-  // delete url is not supported.
-  bool no_delete{false};
   // invalid checksum error
   bool invalid_checksum{false};
 };
@@ -151,15 +149,13 @@ void run_variance(const std::string& test_file_location, bool isSecure, const st
   harness.setUrl(flow_url, flowResponder);
   harness.setUrl(flow_output_url, flowOutputResponder);
 
-  if (!profile.no_delete) {
-    std::string delete_url = transaction_url + "/" + transaction_id;
-    auto *deleteResponse = new DeleteTransactionResponder(delete_url, "201 OK", 12);
-    harness.setUrl(delete_url, deleteResponse);
+  std::string delete_url = transaction_url + "/" + transaction_id;
+  auto *deleteResponse = new DeleteTransactionResponder(delete_url, "201 OK", 12);
+  harness.setUrl(delete_url, deleteResponse);
 
-    std::string delete_output_url = transaction_output_url + "/" + transaction_output_id;
-    auto *deleteOutputResponse = new DeleteTransactionResponder(delete_output_url, "201 OK", producedFlows);
-    harness.setUrl(delete_output_url, deleteOutputResponse);
-  }
+  std::string delete_output_url = transaction_output_url + "/" + transaction_output_id;
+  auto *deleteOutputResponse = new DeleteTransactionResponder(delete_output_url, "201 OK", producedFlows);
+  harness.setUrl(delete_output_url, deleteOutputResponse);
 
   harness.run(test_file_location);
 
@@ -180,8 +176,6 @@ void run_variance(const std::string& test_file_location, bool isSecure, const st
     assertStr.str(std::string());
     assertStr << "Site2Site delete transaction " << transaction_id;
     assert(LogTestController::getInstance().contains(assertStr.str()));
-  } else if (profile.no_delete) {
-    assert(LogTestController::getInstance().contains("Received 401 response code from delete"));
   } else {
     assertStr << "Site2Site transaction " << transaction_id << " peer unknown respond code 254";
     assert(LogTestController::getInstance().contains(assertStr.str()));
@@ -218,12 +212,6 @@ int main(int argc, char **argv) {
     run_variance(args.test_file, isSecure, args.url, profile);
   }
 
-  {
-    struct test_profile profile;
-    profile.no_delete = true;
-    run_variance(args.test_file, isSecure, args.url, profile);
-  }
-
   {
     struct test_profile profile;
     profile.invalid_checksum = true;


[nifi-minifi-cpp] 01/04: MINIFICPP-2109 Log json parse error, use the configuration class's own logger for reporting

Posted by sz...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

szaszm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git

commit 0cb7363597f5137db96c1ad618bf45a41abcc03b
Author: Adam Debreceni <ad...@apache.org>
AuthorDate: Mon May 22 14:11:11 2023 +0200

    MINIFICPP-2109 Log json parse error, use the configuration class's own logger for reporting
    
    Closes #1566
    Signed-off-by: Marton Szasz <sz...@apache.org>
---
 .../tests/unit/AdaptiveConfigurationTests.cpp      | 29 ++++++++++++++++++
 .../tests/unit/YamlConfigurationTests.cpp          | 14 +++++++--
 libminifi/include/utils/gsl.h                      | 16 +++-------
 libminifi/src/core/flow/AdaptiveConfiguration.cpp  | 33 ++++++++++----------
 .../src/core/flow/StructuredConfiguration.cpp      | 35 ++++++++++++----------
 libminifi/src/core/yaml/YamlConfiguration.cpp      |  4 +--
 6 files changed, 84 insertions(+), 47 deletions(-)

diff --git a/extensions/standard-processors/tests/unit/AdaptiveConfigurationTests.cpp b/extensions/standard-processors/tests/unit/AdaptiveConfigurationTests.cpp
index 7bf8ddd27..0863db41a 100644
--- a/extensions/standard-processors/tests/unit/AdaptiveConfigurationTests.cpp
+++ b/extensions/standard-processors/tests/unit/AdaptiveConfigurationTests.cpp
@@ -20,6 +20,9 @@
 #include "Catch.h"
 #include "ConfigurationTestController.h"
 #include "core/flow/AdaptiveConfiguration.h"
+#include "utils/IntegrationTestUtils.h"
+
+using namespace std::literals::chrono_literals;
 
 TEST_CASE("Adaptive configuration can parse JSON") {
   ConfigurationTestController controller;
@@ -64,3 +67,29 @@ Connections: []
 
   REQUIRE(root->findProcessorByName("Proc1"));
 }
+
+TEST_CASE("Adaptive configuration logs json parse errors") {
+  ConfigurationTestController controller;
+
+  const char* json_config = R"(
+    {
+      "Flow Controller": {"name
+      "Processors": [
+        {
+          "id": "00000000-0000-0000-0000-000000000001",
+          "class": "DummyProcessor",
+          "name": "Proc1"
+        }
+      ],
+      "Connections": []
+    }
+  )";
+
+  core::flow::AdaptiveConfiguration config{controller.getContext()};
+
+  REQUIRE_THROWS(config.getRootFromPayload(json_config));
+
+  REQUIRE(utils::verifyLogLinePresenceInPollTime(0s, "[debug] Could not parse configuration as json, trying yaml"));
+  REQUIRE(utils::verifyLogLinePresenceInPollTime(0s, "[error] Configuration file is not valid json: Invalid encoding in string. (38)"));
+  REQUIRE(utils::verifyLogLinePresenceInPollTime(0s, "[error] Configuration file is not valid yaml: yaml-cpp: error at line 3, column 27: end of map flow not found"));
+}
diff --git a/extensions/standard-processors/tests/unit/YamlConfigurationTests.cpp b/extensions/standard-processors/tests/unit/YamlConfigurationTests.cpp
index 651480578..157038af8 100644
--- a/extensions/standard-processors/tests/unit/YamlConfigurationTests.cpp
+++ b/extensions/standard-processors/tests/unit/YamlConfigurationTests.cpp
@@ -29,6 +29,7 @@
 #include "utils/TestUtils.h"
 #include "utils/StringUtils.h"
 #include "ConfigurationTestController.h"
+#include "utils/IntegrationTestUtils.h"
 
 using namespace std::literals::chrono_literals;
 
@@ -160,7 +161,7 @@ Provenance Reporting:
     rootFlowConfig->getConnections(connectionMap);
     REQUIRE(2 == connectionMap.size());
     // This is a map of UUID->Connection, and we don't know UUID, so just going to loop over it
-    for (auto it : connectionMap) {
+    for (const auto& it : connectionMap) {
       REQUIRE(it.second);
       REQUIRE(!it.second->getUUIDStr().empty());
       REQUIRE(it.second->getDestination());
@@ -475,7 +476,7 @@ NiFi Properties Overrides: {}
   rootFlowConfig->getConnections(connectionMap);
   REQUIRE(2 == connectionMap.size());
 
-  for (auto it : connectionMap) {
+  for (const auto& it : connectionMap) {
     REQUIRE(it.second);
     REQUIRE(!it.second->getUUIDStr().empty());
     REQUIRE(it.second->getDestination());
@@ -766,7 +767,7 @@ Remote Process Groups: []
   std::map<std::string, minifi::Connection*> connectionMap;
   rootFlowConfig->getConnections(connectionMap);
   REQUIRE(6 == connectionMap.size());
-  for (auto it : connectionMap) {
+  for (const auto& it : connectionMap) {
     REQUIRE(it.second);
     REQUIRE(!it.second->getUUIDStr().empty());
     REQUIRE(it.second->getDestination());
@@ -831,3 +832,10 @@ TEST_CASE("Test UUID duplication checks", "[YamlConfiguration]") {
     }
   }
 }
+
+TEST_CASE("Configuration is not valid yaml", "[YamlConfiguration]") {
+  ConfigurationTestController test_controller;
+  core::YamlConfiguration yaml_config(test_controller.getContext());
+  REQUIRE_THROWS(yaml_config.getRootFromPayload("}"));
+  REQUIRE(utils::verifyLogLinePresenceInPollTime(0s, "Configuration is not valid yaml"));
+}
diff --git a/libminifi/include/utils/gsl.h b/libminifi/include/utils/gsl.h
index 01aae19dd..efbf47645 100644
--- a/libminifi/include/utils/gsl.h
+++ b/libminifi/include/utils/gsl.h
@@ -14,17 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-#ifndef LIBMINIFI_INCLUDE_UTILS_GSL_H_
-#define LIBMINIFI_INCLUDE_UTILS_GSL_H_
+
+#pragma once
 
 #include <type_traits>
 
 #include <gsl-lite/gsl-lite.hpp>
 
-namespace org {
-namespace apache {
-namespace nifi {
-namespace minifi {
+namespace org::apache::nifi::minifi {
 
 namespace gsl = ::gsl_lite;
 
@@ -55,9 +52,4 @@ template<typename T>
 inline constexpr bool is_not_null_v = is_not_null<T>::value;
 }  // namespace utils
 
-}  // namespace minifi
-}  // namespace nifi
-}  // namespace apache
-}  // namespace org
-
-#endif  // LIBMINIFI_INCLUDE_UTILS_GSL_H_
+}  // namespace org::apache::nifi::minifi
diff --git a/libminifi/src/core/flow/AdaptiveConfiguration.cpp b/libminifi/src/core/flow/AdaptiveConfiguration.cpp
index cef220bb4..5346a9c23 100644
--- a/libminifi/src/core/flow/AdaptiveConfiguration.cpp
+++ b/libminifi/src/core/flow/AdaptiveConfiguration.cpp
@@ -24,6 +24,7 @@
 #include "yaml-cpp/yaml.h"
 #include "utils/file/FileUtils.h"
 #include "Defaults.h"
+#include "rapidjson/error/en.h"
 
 namespace org::apache::nifi::minifi::core::flow {
 
@@ -41,25 +42,27 @@ AdaptiveConfiguration::AdaptiveConfiguration(ConfigurationContext ctx)
       logging::LoggerFactory<AdaptiveConfiguration>::getLogger()) {}
 
 std::unique_ptr<core::ProcessGroup> AdaptiveConfiguration::getRootFromPayload(const std::string &payload) {
-  try {
-    rapidjson::Document doc;
-    rapidjson::ParseResult res = doc.Parse(payload.c_str(), payload.length());
-    if (res) {
-      flow::Node root{std::make_shared<JsonNode>(&doc)};
-      if (root[FlowSchema::getDefault().flow_header]) {
-        logger_->log_debug("Processing configuration as default json");
-        return getRootFrom(root, FlowSchema::getDefault());
-      } else {
-        logger_->log_debug("Processing configuration as nifi flow json");
-        return getRootFrom(root, FlowSchema::getNiFiFlowJson());
-      }
+  rapidjson::Document doc;
+  rapidjson::ParseResult res = doc.Parse(payload.c_str(), payload.length());
+  if (res) {
+    flow::Node root{std::make_shared<JsonNode>(&doc)};
+    if (root[FlowSchema::getDefault().flow_header]) {
+      logger_->log_debug("Processing configuration as default json");
+      return getRootFrom(root, FlowSchema::getDefault());
+    } else {
+      logger_->log_debug("Processing configuration as nifi flow json");
+      return getRootFrom(root, FlowSchema::getNiFiFlowJson());
     }
-    logger_->log_debug("Could not parse configuration as json, trying yaml");
+  }
+  logger_->log_debug("Could not parse configuration as json, trying yaml");
+
+  try {
     YAML::Node rootYamlNode = YAML::Load(payload);
     flow::Node root{std::make_shared<YamlNode>(rootYamlNode)};
     return getRootFrom(root, FlowSchema::getDefault());
-  } catch(...) {
-    logger_->log_error("Invalid configuration file");
+  } catch (const YAML::ParserException& ex) {
+    logger_->log_error("Configuration file is not valid json: %s (%zu)", rapidjson::GetParseError_En(res.Code()), gsl::narrow<size_t>(res.Offset()));
+    logger_->log_error("Configuration file is not valid yaml: %s", ex.what());
     throw;
   }
 }
diff --git a/libminifi/src/core/flow/StructuredConfiguration.cpp b/libminifi/src/core/flow/StructuredConfiguration.cpp
index 847258399..5306af402 100644
--- a/libminifi/src/core/flow/StructuredConfiguration.cpp
+++ b/libminifi/src/core/flow/StructuredConfiguration.cpp
@@ -122,25 +122,30 @@ std::unique_ptr<core::ProcessGroup> StructuredConfiguration::parseProcessGroup(c
 }
 
 std::unique_ptr<core::ProcessGroup> StructuredConfiguration::getRootFrom(const Node& root_node, FlowSchema schema) {
-  schema_ = std::move(schema);
-  uuids_.clear();
-  Node controllerServiceNode = root_node[schema_.root_group][schema_.controller_services];
-  Node provenanceReportNode = root_node[schema_.provenance_reporting];
+  try {
+    schema_ = std::move(schema);
+    uuids_.clear();
+    Node controllerServiceNode = root_node[schema_.root_group][schema_.controller_services];
+    Node provenanceReportNode = root_node[schema_.provenance_reporting];
 
-  parseControllerServices(controllerServiceNode);
-  // Create the root process group
-  std::unique_ptr<core::ProcessGroup> root = parseRootProcessGroup(root_node);
-  parseProvenanceReporting(provenanceReportNode, root.get());
+    parseControllerServices(controllerServiceNode);
+    // Create the root process group
+    std::unique_ptr<core::ProcessGroup> root = parseRootProcessGroup(root_node);
+    parseProvenanceReporting(provenanceReportNode, root.get());
 
-  // set the controller services into the root group.
-  for (const auto& controller_service : controller_services_->getAllControllerServices()) {
-    root->addControllerService(controller_service->getName(), controller_service);
-    root->addControllerService(controller_service->getUUIDStr(), controller_service);
-  }
+    // set the controller services into the root group.
+    for (const auto& controller_service : controller_services_->getAllControllerServices()) {
+      root->addControllerService(controller_service->getName(), controller_service);
+      root->addControllerService(controller_service->getUUIDStr(), controller_service);
+    }
 
-  root->verify();
+    root->verify();
 
-  return root;
+    return root;
+  } catch (const std::exception& ex) {
+    logger_->log_error("Error while processing configuration file: %s", ex.what());
+    throw;
+  }
 }
 
 void StructuredConfiguration::parseProcessorNode(const Node& processors_node, core::ProcessGroup* parentGroup) {
diff --git a/libminifi/src/core/yaml/YamlConfiguration.cpp b/libminifi/src/core/yaml/YamlConfiguration.cpp
index f7bde6a66..5f4982210 100644
--- a/libminifi/src/core/yaml/YamlConfiguration.cpp
+++ b/libminifi/src/core/yaml/YamlConfiguration.cpp
@@ -46,7 +46,7 @@ std::unique_ptr<core::ProcessGroup> YamlConfiguration::getYamlRoot(std::istream
     flow::Node root{std::make_shared<YamlNode>(rootYamlNode)};
     return getRootFrom(root, flow::FlowSchema::getDefault());
   } catch (const YAML::ParserException &pe) {
-    logger_->log_error(pe.what());
+    logger_->log_error("Configuration is not valid yaml: %s", pe.what());
     throw;
   }
 }
@@ -57,7 +57,7 @@ std::unique_ptr<core::ProcessGroup> YamlConfiguration::getRootFromPayload(const
     flow::Node root{std::make_shared<YamlNode>(rootYamlNode)};
     return getRootFrom(root, flow::FlowSchema::getDefault());
   } catch (const YAML::ParserException &pe) {
-    logger_->log_error(pe.what());
+    logger_->log_error("Configuration is not valid yaml: %s", pe.what());
     throw;
   }
 }


[nifi-minifi-cpp] 03/04: MINIFICPP-2113 Add support for multi arch docker build

Posted by sz...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

szaszm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git

commit 1d4c0718261a6d7610c4990cbc67e7ccae7be97d
Author: Gabor Gyimesi <ga...@gmail.com>
AuthorDate: Mon May 22 14:14:05 2023 +0200

    MINIFICPP-2113 Add support for multi arch docker build
    
    Closes #1569
    Signed-off-by: Marton Szasz <sz...@apache.org>
---
 CMakeLists.txt            |   2 +
 bootstrap.sh              |   2 +-
 cmake/DockerConfig.cmake  |  28 ++++++++++-
 cmake/MiNiFiOptions.cmake |   3 +-
 docker/DockerBuild.sh     | 116 ++++++++++++++++++++++++++++++++--------------
 5 files changed, 112 insertions(+), 39 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index ce9589bfa..2e76bc7f7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -33,6 +33,8 @@ set(BUILD_NUMBER "" CACHE STRING "Build number")
 # Base Alpine image to be used in the Docker build instead of the default Alpine image
 set(DOCKER_BASE_IMAGE "" CACHE STRING "Docker build Alpine base image")
 set(DOCKER_CCACHE_DUMP_LOCATION "" CACHE STRING "Directory to dump ccache to after docker build for later reuse")
+set(DOCKER_PLATFORMS "" CACHE STRING "Build platforms for docker image build")
+set(DOCKER_TAGS "" CACHE STRING "Comma separated tags to override default docker build image:tag pairs with")
 
 include(CMakeDependentOption)
 include(CheckIncludeFile)
diff --git a/bootstrap.sh b/bootstrap.sh
index b6c1390f4..985f183c5 100755
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -151,7 +151,7 @@ elif [ -f /etc/SUSE-release ]; then
   OS=$(tr '\n' ' ' < /etc/SUSE-release | sed s/VERSION.*//)
 elif [ -f /etc/redhat-release ]; then
   # Older Red Hat, CentOS, etc.
-  ...
+  echo "Unsupported old release!"
 else
   OS=$(uname -s)
   VER=$(uname -r)
diff --git a/cmake/DockerConfig.cmake b/cmake/DockerConfig.cmake
index 8721cdd47..c70539106 100644
--- a/cmake/DockerConfig.cmake
+++ b/cmake/DockerConfig.cmake
@@ -28,6 +28,9 @@ add_custom_target(
         -c DOCKER_SKIP_TESTS=${DOCKER_SKIP_TESTS}
         -c CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
         -c BUILD_NUMBER=${BUILD_NUMBER}
+        -c DOCKER_PLATFORMS=${DOCKER_PLATFORMS}
+        -c DOCKER_PUSH=${DOCKER_PUSH}
+        -c DOCKER_TAGS=${DOCKER_TAGS}
     WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/docker/)
 
 # Create minimal docker image
@@ -36,7 +39,7 @@ add_custom_target(
     COMMAND ${CMAKE_SOURCE_DIR}/docker/DockerBuild.sh
         -u 1000
         -g 1000
-        -t minimal
+        -p minimal
         -v ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}
         -o \"-DENABLE_LIBRDKAFKA=ON
              -DENABLE_AWS=ON
@@ -47,12 +50,15 @@ add_custom_target(
              -DENABLE_ELASTICSEARCH=OFF
              -DENABLE_LUA_SCRIPTING=OFF
              -DENABLE_PYTHON_SCRIPTING=OFF
-	     -DENABLE_OPC=OFF
+             -DENABLE_OPC=OFF
              -DENABLE_ENCRYPT_CONFIG=OFF \"
         -c DOCKER_BASE_IMAGE=${DOCKER_BASE_IMAGE}
         -c DOCKER_SKIP_TESTS=${DOCKER_SKIP_TESTS}
         -c BUILD_NUMBER=${BUILD_NUMBER}
         -c CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
+        -c DOCKER_PLATFORMS=${DOCKER_PLATFORMS}
+        -c DOCKER_PUSH=${DOCKER_PUSH}
+        -c DOCKER_TAGS=${DOCKER_TAGS}
     WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/docker/)
 
 add_custom_target(
@@ -68,6 +74,9 @@ add_custom_target(
         -c DOCKER_CCACHE_DUMP_LOCATION=${DOCKER_CCACHE_DUMP_LOCATION}
         -c DOCKER_SKIP_TESTS=${DOCKER_SKIP_TESTS}
         -c CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
+        -c DOCKER_PLATFORMS=${DOCKER_PLATFORMS}
+        -c DOCKER_PUSH=${DOCKER_PUSH}
+        -c DOCKER_TAGS=${DOCKER_TAGS}
     WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/docker/)
 
 add_custom_target(
@@ -81,6 +90,9 @@ add_custom_target(
         -c BUILD_NUMBER=${BUILD_NUMBER}
         -c DOCKER_CCACHE_DUMP_LOCATION=${DOCKER_CCACHE_DUMP_LOCATION}
         -c DOCKER_SKIP_TESTS=OFF
+        -c DOCKER_PLATFORMS=${DOCKER_PLATFORMS}
+        -c DOCKER_PUSH=${DOCKER_PUSH}
+        -c DOCKER_TAGS=${DOCKER_TAGS}
     WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/docker/)
 
 add_custom_target(
@@ -94,6 +106,9 @@ add_custom_target(
         -d fedora
         -c BUILD_NUMBER=${BUILD_NUMBER}
         -c CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
+        -c DOCKER_PLATFORMS=${DOCKER_PLATFORMS}
+        -c DOCKER_PUSH=${DOCKER_PUSH}
+        -c DOCKER_TAGS=${DOCKER_TAGS}
     WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/docker/)
 
 add_custom_target(
@@ -107,6 +122,9 @@ add_custom_target(
         -d bionic
         -c BUILD_NUMBER=${BUILD_NUMBER}
         -c CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
+        -c DOCKER_PLATFORMS=${DOCKER_PLATFORMS}
+        -c DOCKER_PUSH=${DOCKER_PUSH}
+        -c DOCKER_TAGS=${DOCKER_TAGS}
     WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/docker/)
 
 add_custom_target(
@@ -120,6 +138,9 @@ add_custom_target(
         -d focal
         -c BUILD_NUMBER=${BUILD_NUMBER}
         -c CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
+        -c DOCKER_PLATFORMS=${DOCKER_PLATFORMS}
+        -c DOCKER_PUSH=${DOCKER_PUSH}
+        -c DOCKER_TAGS=${DOCKER_TAGS}
     WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/docker/)
 
 add_custom_target(
@@ -135,6 +156,9 @@ add_custom_target(
         -c DOCKER_CCACHE_DUMP_LOCATION=${DOCKER_CCACHE_DUMP_LOCATION}
         -c DOCKER_SKIP_TESTS=${DOCKER_SKIP_TESTS}
         -c CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
+        -c DOCKER_PLATFORMS=${DOCKER_PLATFORMS}
+        -c DOCKER_PUSH=${DOCKER_PUSH}
+        -c DOCKER_TAGS=${DOCKER_TAGS}
     WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/docker/)
 
 if (EXISTS ${CMAKE_SOURCE_DIR}/docker/test/integration/features)
diff --git a/cmake/MiNiFiOptions.cmake b/cmake/MiNiFiOptions.cmake
index 1f4c5d5e5..1da46a8da 100644
--- a/cmake/MiNiFiOptions.cmake
+++ b/cmake/MiNiFiOptions.cmake
@@ -38,6 +38,7 @@ add_minifi_option(CI_BUILD "Build is used for CI." OFF)
 add_minifi_option(SKIP_TESTS "Skips building all tests." OFF)
 add_minifi_option(DOCKER_BUILD_ONLY "Disables all targets except docker build scripts. Ideal for systems without an up-to-date compiler." OFF)
 add_minifi_option(DOCKER_SKIP_TESTS "Skip building tests in docker image targets." ON)
+add_minifi_option(DOCKER_PUSH "Push created images to the specified tags" OFF)
 
 add_minifi_option(PORTABLE "Instructs the compiler to remove architecture specific optimizations" ON)
 add_minifi_option(USE_SHARED_LIBS "Builds using shared libraries" ON)
@@ -134,7 +135,7 @@ endif()
 function(get_minifi_docker_options RET_VALUE)
     set(MINIFI_DOCKER_OPTIONS_STR ${MINIFI_EXTERNAL_DOCKER_OPTIONS_STR})
     foreach(MINIFI_OPTION ${MINIFI_OPTIONS})
-        if (MINIFI_OPTION STREQUAL "CI_BUILD" OR MINIFI_OPTION STREQUAL "SKIP_TESTS" OR MINIFI_OPTION STREQUAL "DOCKER_BUILD_ONLY" OR MINIFI_OPTION STREQUAL "DOCKER_SKIP_TESTS")
+        if (MINIFI_OPTION STREQUAL "CI_BUILD" OR MINIFI_OPTION STREQUAL "SKIP_TESTS" OR MINIFI_OPTION STREQUAL "DOCKER_BUILD_ONLY" OR MINIFI_OPTION STREQUAL "DOCKER_SKIP_TESTS" OR MINIFI_OPTION STREQUAL "DOCKER_PUSH")
             continue()
         endif()
         set(MINIFI_DOCKER_OPTIONS_STR "${MINIFI_DOCKER_OPTIONS_STR} -D${MINIFI_OPTION}=${${MINIFI_OPTION}}")
diff --git a/docker/DockerBuild.sh b/docker/DockerBuild.sh
index 4ac0c4050..0bfeeb6bb 100755
--- a/docker/DockerBuild.sh
+++ b/docker/DockerBuild.sh
@@ -24,19 +24,23 @@ set -euo pipefail
 UID_ARG=1000
 GID_ARG=1000
 MINIFI_VERSION=
-IMAGE_TAG=
+PREFIX=
 DUMP_LOCATION=
 DISTRO_NAME=
 BUILD_NUMBER=
 DOCKER_CCACHE_DUMP_LOCATION=
 DOCKER_SKIP_TESTS=ON
 CMAKE_BUILD_TYPE=Release
+PLATFORMS=
+PUSH_OR_LOAD="--load"
+TAGS=()
+MULTI_ARCH=no
 
 function usage {
   echo "Usage: ./DockerBuild.sh -v <MINIFI_VERSION> [additional options]"
   echo "Options:"
   echo "-v, --minifi-version  Minifi version number to be used (required)"
-  echo "-t, --tag             Additional prefix added to the image tag"
+  echo "-p, --prefix          Additional prefix added to the image tag"
   echo "-u, --uid             User id to be used in the Docker image (default: 1000)"
   echo "-g, --gid             Group id to be used in the Docker image (default: 1000)"
   echo "-d, --distro-name     Linux distribution build to be used for alternative builds (bionic|focal|fedora|centos)"
@@ -50,7 +54,7 @@ function usage {
 function dump_ccache() {
   ccache_source_image=$1
   docker_ccache_dump_location=$2
-  container_id=$(docker run --rm -d "${ccache_source_image}" sh -c "while true; do sleep 1; done")
+  container_id=$(docker create "${ccache_source_image}")
   mkdir -p "${docker_ccache_dump_location}"
   docker cp "${container_id}:/opt/minifi/.ccache/." "${docker_ccache_dump_location}"
   docker rm -f "${container_id}"
@@ -75,8 +79,8 @@ while [[ $# -gt 0 ]]; do
     shift
     shift
     ;;
-  -t | --tag)
-    IMAGE_TAG="$2"
+  -p | --prefix)
+    PREFIX="$2"
     shift
     shift
     ;;
@@ -103,6 +107,14 @@ while [[ $# -gt 0 ]]; do
         DOCKER_SKIP_TESTS="${ARR[1]}"
       elif [ "${ARR[0]}" == "CMAKE_BUILD_TYPE" ]; then
         CMAKE_BUILD_TYPE="${ARR[1]}"
+      elif [ "${ARR[0]}" == "DOCKER_PLATFORMS" ] && [ -n "${ARR[1]}" ]; then
+        PLATFORMS="--platform ${ARR[1]}"
+      elif [ "${ARR[0]}" == "DOCKER_PUSH" ]; then
+        if [ "${ARR[1]}" == "ON" ]; then
+          PUSH_OR_LOAD="--push"
+        fi
+      elif [ "${ARR[0]}" == "DOCKER_TAGS" ] && [ -n "${ARR[1]}" ]; then
+        IFS=', ' read -r -a TAGS <<< "${ARR[1]}"
       else
         BUILD_ARGS+=("--build-arg" "${ARR[0]}=${ARR[1]}")
       fi
@@ -129,6 +141,25 @@ if [ -z "${MINIFI_VERSION}" ]; then
   usage
 fi
 
+if [[ "${PLATFORMS}" == *,* ]]; then
+  MULTI_ARCH=yes
+fi
+
+if { [ -n "${DUMP_LOCATION}" ] || [ -n "${DOCKER_CCACHE_DUMP_LOCATION}" ]; } && [ "${PUSH_OR_LOAD}" == "--push" ]; then
+  echo "Error: Cannot save ccache dump or binaries locally when pushing image to remote registry. Turn DOCKER_PUSH flag OFF if you want to build binaries on docker."
+  exit 1
+fi
+
+if { [ -n "${DUMP_LOCATION}" ] || [ -n "${DOCKER_CCACHE_DUMP_LOCATION}" ]; } && [ "${MULTI_ARCH}" == "yes" ]; then
+  echo "Error: Cannot save ccache dump or binaries locally when using multi-arch image. Change DOCKER_PLATFORMS option to a single architecture if you want to build binaries on docker."
+  exit 1
+fi
+
+if [ "${MULTI_ARCH}" == "yes" ] && [ "${PUSH_OR_LOAD}" == "--load" ]; then
+  echo "Error: Multi-arch image cannot be locally built. Either change DOCKER_PLATFORMS flag to a single architecture or turn DOCKER_PUSH flag ON."
+  exit 1
+fi
+
 echo "NiFi-MiNiFi-CPP Version: ${MINIFI_VERSION}"
 
 if [ -n "${DISTRO_NAME}" ]; then
@@ -137,53 +168,68 @@ else
   DOCKERFILE="Dockerfile"
 fi
 
-TAG=""
-if [ -n "${IMAGE_TAG}" ]; then
-  TAG="${IMAGE_TAG}-"
-fi
-if [ -n "${DISTRO_NAME}" ]; then
-  TAG="${TAG}${DISTRO_NAME}-"
-fi
-TAG="${TAG}${MINIFI_VERSION}"
-if [ -n "${BUILD_NUMBER}" ]; then
-  TAG="${TAG}-${BUILD_NUMBER}"
-fi
+if [ ${#TAGS[@]} -eq 0 ]; then
+  TAG="apacheminificpp:"
+  if [ -n "${PREFIX}" ]; then
+    TAG="${TAG}${PREFIX}-"
+  fi
+  if [ -n "${DISTRO_NAME}" ]; then
+    TAG="${TAG}${DISTRO_NAME}-"
+  fi
+  TAG="${TAG}${MINIFI_VERSION}"
+  if [ -n "${BUILD_NUMBER}" ]; then
+    TAG="${TAG}-${BUILD_NUMBER}"
+  fi
 
-TARGZ_TAG="bin"
-if [ -n "${DISTRO_NAME}" ]; then
-  TARGZ_TAG="${TARGZ_TAG}-${DISTRO_NAME}"
-fi
-if [ -n "${BUILD_NUMBER}" ]; then
-  TARGZ_TAG="${TARGZ_TAG}-${BUILD_NUMBER}"
+  TAGS+=("${TAG}")
+
+  TARGZ_TAG="bin"
+  if [ -n "${DISTRO_NAME}" ]; then
+    TARGZ_TAG="${TARGZ_TAG}-${DISTRO_NAME}"
+  fi
+  if [ -n "${BUILD_NUMBER}" ]; then
+    TARGZ_TAG="${TARGZ_TAG}-${BUILD_NUMBER}"
+  fi
 fi
 
 BUILD_ARGS+=("--build-arg" "UID=${UID_ARG}"
-            "--build-arg" "GID=${GID_ARG}"
-            "--build-arg" "MINIFI_VERSION=${MINIFI_VERSION}"
-            "--build-arg" "DUMP_LOCATION=${DUMP_LOCATION}"
-            "--build-arg" "DISTRO_NAME=${DISTRO_NAME}"
-            "--build-arg" "DOCKER_SKIP_TESTS=${DOCKER_SKIP_TESTS}"
-            "--build-arg" "CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}")
+             "--build-arg" "GID=${GID_ARG}"
+             "--build-arg" "MINIFI_VERSION=${MINIFI_VERSION}"
+             "--build-arg" "DUMP_LOCATION=${DUMP_LOCATION}"
+             "--build-arg" "DISTRO_NAME=${DISTRO_NAME}"
+             "--build-arg" "DOCKER_SKIP_TESTS=${DOCKER_SKIP_TESTS}"
+             "--build-arg" "CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}")
 if [ -n "${DUMP_LOCATION}" ]; then
   BUILD_ARGS+=("--build-arg" "DOCKER_MAKE_TARGET=package")
 fi
 
+TAGGING_CMD=""
+for t in "${TAGS[@]}"; do
+  TAGGING_CMD="${TAGGING_CMD} -t ${t}"
+done
+
 if [ -n "${DISTRO_NAME}" ]; then
-  echo DOCKER_BUILDKIT=1 docker build "${BUILD_ARGS[@]}" -f "${DOCKERFILE}" -t apacheminificpp:"${TAG}" ..
-  DOCKER_BUILDKIT=1 docker build "${BUILD_ARGS[@]}" -f "${DOCKERFILE}" -t apacheminificpp:"${TAG}" ..
+  # shellcheck disable=SC2086
+  echo docker buildx build "${BUILD_ARGS[@]}" -f "${DOCKERFILE}" ${PLATFORMS} ${PUSH_OR_LOAD} ${TAGGING_CMD} ..
+  # shellcheck disable=SC2086
+  docker buildx build "${BUILD_ARGS[@]}" -f "${DOCKERFILE}" ${PLATFORMS} ${PUSH_OR_LOAD} ${TAGGING_CMD} ..
 
   if [ -n "${DOCKER_CCACHE_DUMP_LOCATION}" ]; then
-    dump_ccache "apacheminificpp:${TAG}" "${DOCKER_CCACHE_DUMP_LOCATION}"
+    dump_ccache "${TAG[0]}" "${DOCKER_CCACHE_DUMP_LOCATION}"
   fi
 else
   if [ -n "${DOCKER_CCACHE_DUMP_LOCATION}" ]; then
-    DOCKER_BUILDKIT=1 docker build "${BUILD_ARGS[@]}" -f "${DOCKERFILE}" --target build -t minifi_build ..
+    docker buildx build "${BUILD_ARGS[@]}" -f "${DOCKERFILE}" --target build -t minifi_build ..
     dump_ccache "minifi_build" "${DOCKER_CCACHE_DUMP_LOCATION}"
   fi
-  echo DOCKER_BUILDKIT=1 docker build "${BUILD_ARGS[@]}" -f "${DOCKERFILE}" -t apacheminificpp:"${TAG}" ..
-  DOCKER_BUILDKIT=1 docker build "${BUILD_ARGS[@]}" -f "${DOCKERFILE}" -t apacheminificpp:"${TAG}" ..
+  # shellcheck disable=SC2086
+  echo docker buildx build "${BUILD_ARGS[@]}" -f "${DOCKERFILE}" ${PLATFORMS} ${PUSH_OR_LOAD} ${TAGGING_CMD} ..
+  # shellcheck disable=SC2086
+  docker buildx build "${BUILD_ARGS[@]}" -f "${DOCKERFILE}" ${PLATFORMS} ${PUSH_OR_LOAD} ${TAGGING_CMD} ..
 fi
 
 if [ -n "${DUMP_LOCATION}" ]; then
-  docker run --rm --entrypoint cat "apacheminificpp:${TAG}" "/opt/minifi/build/nifi-minifi-cpp-${MINIFI_VERSION}.tar.gz" >"${DUMP_LOCATION}/nifi-minifi-cpp-${MINIFI_VERSION}-${TARGZ_TAG}.tar.gz"
+  container_id=$(docker create "${TAG}")
+  docker cp "${container_id}:/opt/minifi/build/nifi-minifi-cpp-${MINIFI_VERSION}.tar.gz" "${DUMP_LOCATION}/nifi-minifi-cpp-${MINIFI_VERSION}-${TARGZ_TAG}.tar.gz"
+  docker rm -f "${container_id}"
 fi


[nifi-minifi-cpp] 02/04: MINIFICPP-2111 Remove test-only method

Posted by sz...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

szaszm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git

commit 073967852c893b2bbd2dfa141ac55d794d0dcff2
Author: Adam Debreceni <ad...@apache.org>
AuthorDate: Mon May 22 14:13:29 2023 +0200

    MINIFICPP-2111 Remove test-only method
    
    Closes #1567
    Signed-off-by: Marton Szasz <sz...@apache.org>
---
 .../tests/unit/YamlConfigurationTests.cpp          | 30 ++++++++--------------
 libminifi/include/core/yaml/YamlConfiguration.h    | 13 ----------
 libminifi/src/core/yaml/YamlConfiguration.cpp      | 11 --------
 3 files changed, 10 insertions(+), 44 deletions(-)

diff --git a/extensions/standard-processors/tests/unit/YamlConfigurationTests.cpp b/extensions/standard-processors/tests/unit/YamlConfigurationTests.cpp
index 157038af8..8179f328a 100644
--- a/extensions/standard-processors/tests/unit/YamlConfigurationTests.cpp
+++ b/extensions/standard-processors/tests/unit/YamlConfigurationTests.cpp
@@ -142,8 +142,7 @@ Provenance Reporting:
     batch size: 1000;
         )";
 
-    std::istringstream configYamlStream(CONFIG_YAML_WITHOUT_IDS);
-    std::unique_ptr<core::ProcessGroup> rootFlowConfig = yamlConfig.getYamlRoot(configYamlStream);
+    std::unique_ptr<core::ProcessGroup> rootFlowConfig = yamlConfig.getRootFromPayload(CONFIG_YAML_WITHOUT_IDS);
 
     REQUIRE(rootFlowConfig);
     REQUIRE(rootFlowConfig->findProcessorByName("TailFile"));
@@ -191,8 +190,7 @@ Remote Processing Groups:
             use compression: false
       )";
 
-    std::istringstream configYamlStream(CONFIG_YAML_NO_RPG_PORT_ID);
-    REQUIRE_THROWS_AS(yamlConfig.getYamlRoot(configYamlStream), std::invalid_argument);
+    REQUIRE_THROWS_AS(yamlConfig.getRootFromPayload(CONFIG_YAML_NO_RPG_PORT_ID), std::invalid_argument);
   }
 
   SECTION("Validated YAML property failure throws exception and logs invalid attribute name") {
@@ -213,8 +211,7 @@ Remote Processing Groups: []
 Provenance Reporting:
       )";
 
-    std::istringstream configYamlStream(CONFIG_YAML_EMPTY_RETRY_ATTRIBUTE);
-    REQUIRE_THROWS_AS(yamlConfig.getYamlRoot(configYamlStream), utils::internal::InvalidValueException);
+    REQUIRE_THROWS_AS(yamlConfig.getRootFromPayload(CONFIG_YAML_EMPTY_RETRY_ATTRIBUTE), utils::internal::InvalidValueException);
     REQUIRE(LogTestController::getInstance().contains("Invalid value was set for property 'Retry Attribute' creating component 'RetryFlowFile'"));
   }
 }
@@ -335,9 +332,8 @@ Remote Process Groups:
   Output Ports: []
 NiFi Properties Overrides: {}
       )";
-  std::istringstream configYamlStream(TEST_CONFIG_YAML);
 
-  REQUIRE_THROWS_AS(yamlConfig.getYamlRoot(configYamlStream), minifi::Exception);
+  REQUIRE_THROWS_AS(yamlConfig.getRootFromPayload(TEST_CONFIG_YAML), minifi::Exception);
 }
 
 TEST_CASE("Test YAML v3 Config Processing", "[YamlConfiguration3]") {
@@ -456,8 +452,7 @@ Remote Process Groups:
   Output Ports: []
 NiFi Properties Overrides: {}
       )";
-  std::istringstream configYamlStream(TEST_CONFIG_YAML);
-  std::unique_ptr<core::ProcessGroup> rootFlowConfig = yamlConfig.getYamlRoot(configYamlStream);
+  std::unique_ptr<core::ProcessGroup> rootFlowConfig = yamlConfig.getRootFromPayload(TEST_CONFIG_YAML);
 
   REQUIRE(rootFlowConfig);
   REQUIRE(rootFlowConfig->findProcessorByName("TailFile"));
@@ -499,8 +494,7 @@ Processors:
   Properties:
      Dynamic Property: Bad
       )";
-  std::istringstream configYamlStream(TEST_CONFIG_YAML);
-  std::unique_ptr<core::ProcessGroup> rootFlowConfig = yamlConfig.getYamlRoot(configYamlStream);
+  std::unique_ptr<core::ProcessGroup> rootFlowConfig = yamlConfig.getRootFromPayload(TEST_CONFIG_YAML);
 
   REQUIRE(rootFlowConfig);
   REQUIRE(rootFlowConfig->findProcessorByName("GenerateFlowFile"));
@@ -527,11 +521,10 @@ Processors:
     Input Directory: ""
     Batch Size: 1
       )";
-  std::istringstream configYamlStream(TEST_CONFIG_YAML);
   bool caught_exception = false;
 
   try {
-    std::unique_ptr<core::ProcessGroup> rootFlowConfig = yamlConfig.getYamlRoot(configYamlStream);
+    std::unique_ptr<core::ProcessGroup> rootFlowConfig = yamlConfig.getRootFromPayload(TEST_CONFIG_YAML);
 
     REQUIRE(rootFlowConfig);
     REQUIRE(rootFlowConfig->findProcessorByName("GetFile"));
@@ -562,8 +555,7 @@ Processors:
     Input Directory: "/"
     Batch Size: 1
       )";
-  std::istringstream configYamlStream(TEST_CONFIG_YAML);
-  std::unique_ptr<core::ProcessGroup> rootFlowConfig = yamlConfig.getYamlRoot(configYamlStream);
+  std::unique_ptr<core::ProcessGroup> rootFlowConfig = yamlConfig.getRootFromPayload(TEST_CONFIG_YAML);
 
   REQUIRE(rootFlowConfig);
   REQUIRE(rootFlowConfig->findProcessorByName("XYZ"));
@@ -756,8 +748,7 @@ Connections:
 Remote Process Groups: []
     )";
 
-  std::istringstream configYamlStream(CONFIG_YAML_WITH_FUNNEL);
-  std::unique_ptr<core::ProcessGroup> rootFlowConfig = yamlConfig.getYamlRoot(configYamlStream);
+  std::unique_ptr<core::ProcessGroup> rootFlowConfig = yamlConfig.getRootFromPayload(CONFIG_YAML_WITH_FUNNEL);
 
   REQUIRE(rootFlowConfig);
   REQUIRE(rootFlowConfig->findProcessorByName("GenerateFlowFile1"));
@@ -827,8 +818,7 @@ TEST_CASE("Test UUID duplication checks", "[YamlConfiguration]") {
 
       auto config_old = config_yaml;
       utils::StringUtils::replaceAll(config_yaml, std::string("00000000-0000-0000-0000-00000000000") + i, "99999999-9999-9999-9999-999999999999");
-      std::istringstream config_yaml_stream(config_yaml);
-      REQUIRE_THROWS_WITH(yaml_config.getYamlRoot(config_yaml_stream), "General Operation: UUID 99999999-9999-9999-9999-999999999999 is duplicated in the flow configuration");
+      REQUIRE_THROWS_WITH(yaml_config.getRootFromPayload(config_yaml), "General Operation: UUID 99999999-9999-9999-9999-999999999999 is duplicated in the flow configuration");
     }
   }
 }
diff --git a/libminifi/include/core/yaml/YamlConfiguration.h b/libminifi/include/core/yaml/YamlConfiguration.h
index e501f551b..d1bfb961a 100644
--- a/libminifi/include/core/yaml/YamlConfiguration.h
+++ b/libminifi/include/core/yaml/YamlConfiguration.h
@@ -49,19 +49,6 @@ class YamlConfiguration : public flow::StructuredConfiguration {
     return {"text/yml", "application/vnd.minifi-c2+yaml;version=2"};
   }
 
-  /**
-   * Returns a shared pointer to a ProcessGroup object containing the
-   * flow configuration. The yamlConfigStream argument must point to
-   * an input stream for the raw YAML configuration.
-   *
-   * @param yamlConfigStream an input stream for the raw YAML configutation
-   *                           to be parsed and loaded into the flow
-   *                           configuration tree
-   * @return                 the root ProcessGroup node of the flow
-   *                           configuration tree
-   */
-  std::unique_ptr<core::ProcessGroup> getYamlRoot(std::istream &yamlConfigStream);
-
   /**
    * Returns a shared pointer to a ProcessGroup object containing the
    * flow configuration. The yamlConfigPayload argument must be
diff --git a/libminifi/src/core/yaml/YamlConfiguration.cpp b/libminifi/src/core/yaml/YamlConfiguration.cpp
index 5f4982210..f652e38b9 100644
--- a/libminifi/src/core/yaml/YamlConfiguration.cpp
+++ b/libminifi/src/core/yaml/YamlConfiguration.cpp
@@ -40,17 +40,6 @@ YamlConfiguration::YamlConfiguration(ConfigurationContext ctx)
         })(),
         logging::LoggerFactory<YamlConfiguration>::getLogger()) {}
 
-std::unique_ptr<core::ProcessGroup> YamlConfiguration::getYamlRoot(std::istream &yamlConfigStream) {
-  try {
-    YAML::Node rootYamlNode = YAML::Load(yamlConfigStream);
-    flow::Node root{std::make_shared<YamlNode>(rootYamlNode)};
-    return getRootFrom(root, flow::FlowSchema::getDefault());
-  } catch (const YAML::ParserException &pe) {
-    logger_->log_error("Configuration is not valid yaml: %s", pe.what());
-    throw;
-  }
-}
-
 std::unique_ptr<core::ProcessGroup> YamlConfiguration::getRootFromPayload(const std::string &yamlConfigPayload) {
   try {
     YAML::Node rootYamlNode = YAML::Load(yamlConfigPayload);