From 522356f4f0265f53cb2b301fcedc9ad9e2362167 Mon Sep 17 00:00:00 2001 From: Caleb Connolly <caleb@postmarketos.org> Date: Sun, 27 Oct 2024 02:57:34 +0200 Subject: [PATCH] helpers: git: retry clone helps with intermitten DNS errors in CI maybe Signed-off-by: Caleb Connolly <caleb@postmarketos.org> --- .gitlab-ci.yml | 5 +++-- pmb/helpers/git.py | 11 ++++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7bb933e10..022ef30f5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -138,7 +138,8 @@ force build aarch64: tags: [arm64] script: # Packages chosen for being small, unlikely to break, and for langauge coverage. - - .ci/integration_tests/force_build x86_64 hello-world postmarketos-mkinitfs + # It's currently NOT possible to cross build mkinitfs for x86_64 on ARM64. + - .ci/integration_tests/force_build x86_64 hello-world pbsplash #postmarketos-mkinitfs - .ci/integration_tests/force_build aarch64 hello-world postmarketos-mkinitfs - .ci/integration_tests/force_build armv7 hello-world postmarketos-mkinitfs @@ -156,7 +157,7 @@ force_strict build aarch64: tags: [arm64] script: # Packages chosen for being small, unlikely to break, and for langauge coverage. - - .ci/integration_tests/force_strict_build x86_64 hello-world postmarketos-mkinitfs + - .ci/integration_tests/force_strict_build x86_64 hello-world #postmarketos-mkinitfs - .ci/integration_tests/force_strict_build aarch64 hello-world postmarketos-mkinitfs pkgrel_bump amd64: diff --git a/pmb/helpers/git.py b/pmb/helpers/git.py index ce8361cb4..1271c656f 100644 --- a/pmb/helpers/git.py +++ b/pmb/helpers/git.py @@ -56,7 +56,16 @@ def clone(name_repo: str) -> None: # Create parent dir and clone logging.info(f"Clone git repository: {url}") (get_context().config.work / "cache_git").mkdir(exist_ok=True) - pmb.helpers.run.user(command, output="stdout") + tries = 3 + while tries > 0: + try: + pmb.helpers.run.user(command, output="stdout") + break + except RuntimeError as e: + tries -= 1 + logging.error(f"Failed to clone repository, trying {tries} more times: {e}") + if tries == 0: + raise # FETCH_HEAD does not exist after initial clone. Create it, so # is_outdated() can use it. -- GitLab