diff --git a/apps/cli/executables/pexable/ingest_envoy/ingest_envoy/collectors.py b/apps/cli/executables/pexable/ingest_envoy/ingest_envoy/collectors.py index 253d6013bc19acadfc60922b2bb2fb9d53b4b758..d10092f6b8171bf472b012c819a7f2c9f28ef6ad 100644 --- a/apps/cli/executables/pexable/ingest_envoy/ingest_envoy/collectors.py +++ b/apps/cli/executables/pexable/ingest_envoy/ingest_envoy/collectors.py @@ -1,14 +1,9 @@ -import glob -import os -import pathlib import shutil import subprocess import sys import logging -import json - from ingest_envoy.schema import AbstractTextFile @@ -17,6 +12,9 @@ class ImageCollector: self.logger = logging.getLogger("ingest_envoy") self.parameters = parameters self.spl = parameters["spl"] + self.staging_source_dir = ( + self.parameters["staging_area"] + "/" + self.parameters["workflowDir"] + ) def collect_image_metadata(self) -> AbstractTextFile: file = open("./aux_image_metadata.json", "r") @@ -34,6 +32,13 @@ class ImageCollector: stdout=sys.stdout, stderr=sys.stderr, ) + self.aux_file_to_staging() + + def aux_file_to_staging(self): + shutil.copy2( + "./aux_image_metadata.json", + self.staging_source_dir, + ) def create_artifacts_name(self): name = "pipeline_artifacts_" diff --git a/apps/cli/executables/pexable/ingest_envoy/test/test_collectors.py b/apps/cli/executables/pexable/ingest_envoy/test/test_collectors.py index fa5a4c1e1890221a8ec2b5fcbdc040ac9a85a1ff..a9dc56d3be064474a62daef1bd66127041d7cc97 100644 --- a/apps/cli/executables/pexable/ingest_envoy/test/test_collectors.py +++ b/apps/cli/executables/pexable/ingest_envoy/test/test_collectors.py @@ -30,11 +30,17 @@ class TestImageCollector: assert mock_open.call_count == 1 assert isinstance(aux, AbstractTextFile) + @patch("shutil.copy2") @patch("subprocess.run") - def test_collect_image_products(self, mock_run): + def test_collect_image_products(self, mock_run, mock_copy): image_collector.collect_image_products() assert mock_run.call_count == 1 + @patch("shutil.copy2") + def test_aux_file_to_staging(self, mock_copy): + image_collector.aux_file_to_staging() + assert mock_copy.call_count == 1 + def test_create_artifacts_name(self): expected_name = "pipeline_artifacts_" + parameters["processingStart"]