diff options
author | Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> | 2020-05-19 08:12:38 +0000 |
---|---|---|
committer | Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> | 2020-05-19 08:16:51 +0000 |
commit | 11d21148f879ca003b574c3b12ae534508f4887c (patch) | |
tree | 83e4558362c669d8654bbe4ecb7e1d80da001cec | |
parent | a792a1d55fd28fab9b79ba8d1f8d336a4840e181 (diff) |
jenkins-helpers.sh: Handle corrupted repos in clone_or_update_repo_no_checkout
In [1] we have a binutils repo corrupted, which prevents its update and
most git operations. Git fetch returns:
error: object file .git/objects/32/d1f47a126567f24be18e7cadf5d2490968c986 is empty
error: object file .git/objects/32/d1f47a126567f24be18e7cadf5d2490968c986 is empty
fatal: loose object 32d1f47a126567f24be18e7cadf5d2490968c986 (stored in .git/objects/32/d1f47a126567f24be18e7cadf5d2490968c986) is corrupt
fatal: The remote end hung up unexpectedly
This kind of problem happens due to Lab power outages, jenkins restarts,
jenkins node container restarts, and other infrastructure artifacts.
The solution is to remove a repo where a basic "git status" command fails.
[1] https://ci.linaro.org/job/tcwg_kernel-bisect-gnu-master-arm-next-allyesconfig/78/artifact/artifacts/build-baseline/03-build_abe-binutils/console.log/*view*/
Change-Id: I33cd22787a62c3759a950f3a1cc84d923f2f370c
-rw-r--r-- | jenkins-helpers.sh | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/jenkins-helpers.sh b/jenkins-helpers.sh index b196edca..e2f5a8d8 100644 --- a/jenkins-helpers.sh +++ b/jenkins-helpers.sh @@ -451,7 +451,8 @@ clone_or_update_repo_no_checkout () *) refopt="--reference $reference" ;; esac - if ! [ -d "$dir/.git" ]; then + if ! git -C "$dir" status >/dev/null 2>&1; then + # Git repo doesn't exist or is corrupted. Make a new clone. rm -rf "$dir" local single_branch_opt="" |