Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,4 @@ quarkus.rest-client.pnc-api.read-timeout=30000
%test.callback.auth.enabled=false
%dev.callback.auth.enabled=false
%test.delan.analyzer.disable-spdx-init=true
%dev.delan.analyzer.disable-koji-lookup=true
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

import org.jboss.pnc.api.dto.exception.ReasonedException;
import org.jboss.pnc.api.enums.ResultStatus;
import org.jboss.pnc.deliverablesanalyzer.config.AnalyzerConfig;
import org.jboss.pnc.deliverablesanalyzer.core.ResultAggregator;
import org.jboss.pnc.deliverablesanalyzer.core.ScannedArtifact;
import org.jboss.pnc.deliverablesanalyzer.koji.KojiBuildFinder;
Expand All @@ -52,6 +53,9 @@ public class BuildLookupConsumer {
private static final String EMPTY_FILE_SHA256 = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
private static final String EMPTY_ZIP_SHA256 = "8739c76e681f900923b900c9df0ef75cf421d39cabb54650c4b9ad19b6a76d85";

@Inject
AnalyzerConfig analyzerConfig;

@Inject
PncBuildFinder pncBuildFinder;

Expand Down Expand Up @@ -123,12 +127,19 @@ private void processBatch(List<ScannedArtifact> batch, Map<String, AnalyzerResul

// Koji Lookup
if (!unresolvedBatch.isEmpty()) {
try {
processLookup(path, unresolvedBatch, globalResults, kojiBuildFinder::findBuilds);
} catch (Exception e) {
if (e instanceof CancellationException || e instanceof ReasonedException)
throw e;
throw new ReasonedException(ResultStatus.SYSTEM_ERROR, "Koji Lookup failed for path: " + path, e);
if (analyzerConfig.disableKojiLookup()) {
LOGGER.debug("Koji lookup is disabled, skipping.");
} else {
try {
processLookup(path, unresolvedBatch, globalResults, kojiBuildFinder::findBuilds);
} catch (Exception e) {
if (e instanceof CancellationException || e instanceof ReasonedException)
throw e;
throw new ReasonedException(
ResultStatus.SYSTEM_ERROR,
"Koji Lookup failed for path: " + path,
e);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ public interface AnalyzerConfig {
@WithDefault("false")
boolean disableRecursion();

@WithDefault("false")
boolean disableKojiLookup();

@WithDefault("dll,dylib,ear,jar,jdocbook,jdocbook-style,kar,plugin,pom,rar,sar,so,war,xml,exe,msi,zip,rpm")
List<String> archiveExtensions();

Expand Down