in google-storage-server/src/main/kotlin/jetbrains/buildServer/serverSide/artifacts/google/GoogleArtifactContentProvider.kt [15:36]
override fun getContent(artifactInfo: StoredBuildArtifactInfo): InputStream {
val artifactData = artifactInfo.artifactData
?: throw IOException("Can not process artifact download request for a folder")
val path = GoogleUtils.getArtifactPath(artifactInfo.commonProperties, artifactData.path)
try {
val bucket = GoogleUtils.getStorageBucket(artifactInfo.storageSettings)
val blob = bucket.get(path)
return Channels.newInputStream(blob.reader())
} catch (e: StorageException) {
val errorType = if (e.isRetryable) "intermittent" else ""
val message =
"Failed to access artifact $path due to $errorType Google Cloud Storage error, try to access it later"
LOG.infoAndDebugDetails(message, e)
throw IOException("$message: $e.message", e)
} catch (e: Throwable) {
val message = "Failed to access artifact $path from Google Cloud Storage due to unexpected error"
LOG.warnAndDebugDetails(message, e)
throw IOException("$message: $e.message", e)
}
}