Skip to content

Commit

Permalink
fix: Fetch custom report artifacts in parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
Kesin11 committed Sep 4, 2020
1 parent 88dd7d3 commit 95311bc
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/client/jenkins_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,16 +258,19 @@ export class JenkinsClient {
const artifactPaths = build.artifacts.map((artifact) => artifact.relativePath )
const jobName = build.fullDisplayName.split(' ')[0]

// TODO: Fetch with parallel using Promise.all
// Fetch artifacts in parallel
const customReports: CustomReportArtifact = new Map<string, Artifact[]>()
for (const customReportConfig of customReportsConfigs) {
// Convert glob path to real artifact paths
const nameArtifacts = customReportsConfigs.map((customReportConfig) => {
const reportArtifactsPaths = artifactPaths.filter((path) => {
return customReportConfig.paths.some((glob) => minimatch(path, glob))
})

const artifacts = await this.fetchArtifacts(jobName, build.number, reportArtifactsPaths)
customReports.set(customReportConfig.name, artifacts)
return {
name: customReportConfig.name,
artifacts: this.fetchArtifacts(jobName, build.number, reportArtifactsPaths)
}
})
for (const { name, artifacts } of nameArtifacts) {
customReports.set(name, await artifacts)
}

return customReports
Expand Down

0 comments on commit 95311bc

Please sign in to comment.