Skip to content

Commit f9aabc2

Browse files
authored
Merge pull request #3749 from onflow/bastian/improve-update-tool-8
Handle command failures in update tool
2 parents 0df2af0 + 876760b commit f9aabc2

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

tools/update/main.ts

+9-8
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ class Updater {
385385
const rootRepoVersion = this.getExpectedVersion(rootFullRepoName)
386386
const branch = ['auto-update', rootRepoOwner, rootRepoName, rootRepoVersion].join('-')
387387
console.log(`Creating branch ${branch} ...`)
388-
await exec(`git checkout -b ${branch}`)
388+
await exec(`git checkout -b ${branch}`, {strict: true})
389389

390390
// TODO: only update dependencies that are updatable
391391

@@ -403,20 +403,20 @@ class Updater {
403403

404404
console.log(`Updating mod ${fullModName} to ${deps.join(', ')} ...`)
405405

406-
await exec(`go get ${deps.join(' ')}`)
406+
await exec(`go get ${deps.join(' ')}`, {strict: true})
407407

408408
console.log(`Cleaning up mod ${fullModName} ...`)
409-
await exec(`go mod tidy`)
409+
await exec(`go mod tidy`, {strict: true})
410410
}
411411

412412
console.log(`Committing update ...`)
413413

414414
const message = `Update to ${capitalizeFirstLetter(rootRepoName)} ${rootRepoVersion}`
415415

416-
await exec(`git commit -a -m "${message}"`)
416+
await exec(`git commit -a -m "${message}"`, {strict: true})
417417

418418
console.log(`Pushing update ...`)
419-
await exec(`git push -u origin ${branch}"`)
419+
await exec(`git push -u origin ${branch}"`, {strict: true})
420420

421421
console.log(`Creating PR ...`)
422422

@@ -540,14 +540,14 @@ class Releaser {
540540
process.chdir(dir)
541541

542542
console.log(`Tagging ${this.repo} version ${this.version} ...`)
543-
await exec(`git tag ${tag}`)
543+
await exec(`git tag ${tag}`, {strict: true})
544544

545545
if (this.modPath !== '') {
546546
console.log(`Pushing ${this.repo} mod ${this.modPath} version ${this.version} ...`)
547547
} else {
548548
console.log(`Pushing ${this.repo} version ${this.version} ...`)
549549
}
550-
await exec(`git push origin --tags`)
550+
await exec(`git push origin --tags`, {strict: true})
551551

552552
console.log(`Cleaning up clone of ${this.repo}`)
553553
await rm(dir, { recursive: true, force: true })
@@ -707,7 +707,8 @@ async function gitClone(protocol: Protocol, fullRepoName: string, dir: string, b
707707
console.error(`unsupported protocol: ${protocol}`)
708708
return
709709
}
710-
await exec(`git clone --depth 1 ${branch ? `-b ${branch} ` : ""}${prefix}${fullRepoName} ${dir}`)
710+
const command = `git clone --depth 1 ${branch ? `-b ${branch} ` : ""}${prefix}${fullRepoName} ${dir}`
711+
await exec(command, {strict: true})
711712
}
712713

713714
async function runWithConsoleGroup(func: () => Promise<boolean>): Promise<boolean> {

0 commit comments

Comments
 (0)