in google-storage-agent/src/main/kotlin/jetbrains/buildServer/artifacts/google/publish/GoogleArtifactsPublisher.kt [43:70]
override fun publishFiles(filePathMap: Map<File, String>): Int {
val filesToPublish = filePathMap.entries.filter {
!it.value.startsWith(ArtifactsConstants.TEAMCITY_ARTIFACTS_DIR)
}.associateTo(hashMapOf()) { entry -> entry.toPair() }
if (filesToPublish.isNotEmpty()) {
val build = tracker.currentBuild
try {
if (publishedArtifacts.isEmpty()) {
setPathPrefixProperty(build)
}
val uploader = getFileUploader(build)
val pathPrefix = getPathPrefixProperty(build)
val published = uploader.publishFiles(build, pathPrefix, filesToPublish)
publishedArtifacts.addAll(published)
} catch (e: ArtifactPublishingFailedException) {
throw e
} catch (e: Throwable) {
val message = "Failed to publish files"
LOG.warnAndDebugDetails(message, e)
throw ArtifactPublishingFailedException("$message: ${e.message}", false, e)
}
publishArtifactsList(build)
}
return filesToPublish.size
}