From: Kefu Chai Date: Sun, 11 Apr 2021 03:59:41 +0000 (+0800) Subject: build-integration-branch: retry when running into network failures X-Git-Tag: v17.1.0~2297^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=34e4e4870e85bed3cda03c0b8abe71f40dcf2792;p=ceph.git build-integration-branch: retry when running into network failures Signed-off-by: Kefu Chai --- diff --git a/src/script/build-integration-branch b/src/script/build-integration-branch index 6bedd7d16223..0450f6a34113 100755 --- a/src/script/build-integration-branch +++ b/src/script/build-integration-branch @@ -93,8 +93,20 @@ for pr in prs: pr_url = pr['head']['repo']['clone_url'] pr_ref = pr['head']['ref'] print(f'--- pr {pr_number} --- pulling {pr_url} branch {pr_ref}') - r = call(['git', 'pull', '--no-edit', pr_url, pr_ref]) - assert not r + while True: + r = call(['git', 'pull', '--no-edit', pr_url, pr_ref]) + if r == 0: + break + elif r == 1: + print(f'Unable to access {pr_url}, retrying..') + elif r == 128: + message = f'Unable to resolve conflict when merging PR#{pr_number}' + raise Exception(message) + else: + message = ('Exiting due to an unknown failure when pulling ' + f'PR#{pr_number}') + raise Exception(message) + print('--- done. these PRs were included:') print('\n'.join(prtext).encode('ascii', errors='ignore').decode()) print('--- perhaps you want to: make && ctest -j12 && git push ci %s' % branch)