Skip to content

Commit

Permalink
feat(black-duck): Make the log output show how the origin is determined
Browse files Browse the repository at this point in the history
Log the query parameter (purl or origin-id) to make obvious how the
origin is of each respective package is determined.

Signed-off-by: Frank Viernau <[email protected]>
  • Loading branch information
fviernau committed Jan 28, 2025
1 parent fb07211 commit 30e8b26
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions plugins/advisors/black-duck/src/main/kotlin/BlackDuck.kt
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,10 @@ class BlackDuck(
}

if (origins.isEmpty()) {
logger.info { "No origin found for package '${pkg.id.toCoordinates()}'." }
logger.info { "No origin found for package '${pkg.id.toCoordinates()}', ${pkg.requestParam}." }
} else {
logger.info {
"Found ${origins.size} origin(s) for package '${pkg.id.toCoordinates()}': " +
"Found ${origins.size} origin(s) for package '${pkg.id.toCoordinates()}', ${pkg.requestParam}: " +
"${origins.joinToString { it.identifier }}."
}
}
Expand Down Expand Up @@ -243,3 +243,6 @@ private fun Map<Identifier, List<OriginView>>.getSummary(): String =
}

private val Package.blackDuckOriginId: String? get() = labels[BlackDuck.PACKAGE_LABEL_BLACK_DUCK_ORIGIN_ID]

private val Package.requestParam: String get() =
blackDuckOriginId?.let { "origin-id: '$it'" } ?: "purl: '$purl'"

0 comments on commit 30e8b26

Please sign in to comment.