]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
build-integration-branch: retry when running into network failures 40786/head
authorKefu Chai <kchai@redhat.com>
Sun, 11 Apr 2021 03:59:41 +0000 (11:59 +0800)
committerKefu Chai <kchai@redhat.com>
Sun, 11 Apr 2021 14:28:05 +0000 (22:28 +0800)
Signed-off-by: Kefu Chai <kchai@redhat.com>
src/script/build-integration-branch

index 6bedd7d16223e8daaaddb6319e90ed6c2e4f7ca2..0450f6a341132d2baba439c01a79ef1b1887019c 100755 (executable)
@@ -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)