ci: add retries to downloads for arm testing (#18526)
This commit is contained in:
parent
1e3e5a6619
commit
a31faaae61
1 changed files with 21 additions and 2 deletions
|
@ -49,11 +49,30 @@ async function downloadArtifact (name, buildNum, dest) {
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
} else {
|
} else {
|
||||||
console.log(`Downloading ${artifactToDownload.url}.`)
|
console.log(`Downloading ${artifactToDownload.url}.`)
|
||||||
await downloadFile(artifactToDownload.url, dest)
|
let downloadError = false
|
||||||
console.log(`Successfully downloaded ${name}.`)
|
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) {
|
function downloadFile (url, directory) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const nuggetOpts = {
|
const nuggetOpts = {
|
||||||
|
|
Loading…
Reference in a new issue