From bd335e1735c286562061a49e5ffb23f1b9d67730 Mon Sep 17 00:00:00 2001 From: JimFuller-RedHat Date: Wed, 11 Sep 2024 10:13:14 +0200 Subject: [PATCH] invoke graph analysis ingestion only when we ingest sbom --- modules/ingestor/src/service/mod.rs | 36 ++++++++++++++++------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/modules/ingestor/src/service/mod.rs b/modules/ingestor/src/service/mod.rs index a08ef2047..56df315f7 100644 --- a/modules/ingestor/src/service/mod.rs +++ b/modules/ingestor/src/service/mod.rs @@ -177,22 +177,26 @@ impl IngestorService { .load(&self.graph, labels.into(), issuer, &result.digests, stream) .await?; - // TODO: there maybe better ways to do this - let analysis_service = AnalysisService::new(self.graph.db.clone()); - match analysis_service - .load_graphs(vec![result.id.value()], ()) - .await - { - Ok(_) => log::debug!( - "Analysis graph for sbom: {} loaded successfully.", - result.id.value() - ), - Err(e) => log::warn!( - "Error loading sbom {} into analysis graph : {}", - result.id.value(), - e - ), - } + match fmt { + Format::SPDX | Format::CycloneDX => { + let analysis_service = AnalysisService::new(self.graph.db.clone()); + match analysis_service + .load_graphs(vec![result.id.value()], ()) + .await + { + Ok(_) => log::debug!( + "Analysis graph for sbom: {} loaded successfully.", + result.id.value() + ), + Err(e) => log::warn!( + "Error loading sbom {} into analysis graph : {}", + result.id.value(), + e + ), + } + } + _ => {} + }; let duration = Instant::now() - start; log::debug!(