Commit e30eebd4 authored by Jérome Perrin's avatar Jérome Perrin

also retry git push and switch to zx's builtin retry

parent 98636f4d
#!/usr/bin/env zx
import 'zx/globals'
import { retry, expBackoff } from 'zx/experimental'
import {default as parseDuration} from 'parse-duration'
const configData = await fs.readFile(argv['config'] || './config.yaml', 'utf-8')
......@@ -24,20 +25,10 @@ if (!fs.existsSync(wd)) {
}
cd(wd)
let fetchErrors = 0, reportedConflictHashes
let reportedConflictHashes
while (true) {
try {
await $`git fetch --all`
} catch (e) {
echo('Error fetching')
fetchErrors++
if (fetchErrors > 10) {
throw e
}
await sleep(interval)
}
await retry(30, expBackoff(), () => $`git fetch --all`)
fetchErrors = 0
await $`git reset --hard project/${config.project.branch}`
let mergeSuccess = true;
try {
......@@ -86,7 +77,7 @@ ${gitOutput}
}
}
if (mergeSuccess) {
await $`git push project ${config.project.branch}`
await retry(30, expBackoff(), () => $`git push project ${config.project.branch}`)
}
await sleep(interval)
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment