Skip to content

Commit

Permalink
ci: add retries to downloads for arm testing (#18534)
Browse files Browse the repository at this point in the history
  • Loading branch information
trop[bot] authored and codebytere committed May 31, 2019
1 parent c1b5a1c commit a6117ab
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions script/download-circleci-artifacts.js
Expand Up @@ -49,9 +49,28 @@ async function downloadArtifact (name, buildNum, dest) {
process.exit(1)
} else {
console.log(`Downloading ${artifactToDownload.url}.`)
await downloadFile(artifactToDownload.url, dest)
console.log(`Successfully downloaded ${name}.`)
let downloadError = false
await downloadWithRetry(artifactToDownload.url, dest).catch(err => {
console.log(`Error downnloading ${artifactToDownload.url} :`, err)
downloadError = true
})
if (!downloadError) {
console.log(`Successfully downloaded ${name}.`)
}
}
}

async function downloadWithRetry (url, directory) {
let lastError
for (let i = 0; i < 5; i++) {
console.log(`Attempting to download ${url} - attempt #${(i + 1)}`)
try {
return await downloadFile(url, directory)
} catch (err) {
lastError = err
}
}
throw lastError
}

function downloadFile (url, directory) {
Expand Down

0 comments on commit a6117ab

Please sign in to comment.