Skip to contentSkip to conversation

gitlab: use --refetch in check-patch/check-dco jobs

PATCH Applied Daniel P. Berrangé 3 participants 3 messages Feb 25, 2025 – Feb 28, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gitlab: use --refetch in check-patch/check-dco jobs

When gitlab initializes the repo checkout for a CI job, it will have done a shallow clone with only partial history. Periodically the objects that are omitted cause trouble with the check-patch/check-dco jobs. This is exhibited as reporting strange errors being unable to fetch certain objects that are known to exist.

Passing the --refetch flag to 'git fetch' causes it to not assume the local checkout has all common objects and thus re-fetch everything that is needed. This appears to solve the check-patch/check-dco job failures.

---
 .gitlab-ci.d/check-dco.py   | 2 +-
 .gitlab-ci.d/check-patch.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
.gitlab-ci.d/check-dco.py +1 -1
index 70dec7d6ee..2fd56683dc 100755
@@ -21,7 +21,7 @@
 
 print(f"adding upstream git repo @ {repourl}")
 subprocess.check_call(["git", "remote", "add", "check-dco", repourl])
-subprocess.check_call(["git", "fetch", "check-dco", "master"])
+subprocess.check_call(["git", "fetch", "--refetch", "check-dco", "master"])
 
 ancestor = subprocess.check_output(["git", "merge-base",
                                     "check-dco/master", "HEAD"],
.gitlab-ci.d/check-patch.py +1 -1
index 68c549a146..be13e6f77d 100755
@@ -24,7 +24,7 @@
 # base for the user's branch. We thus need to figure out a common
 # ancestor between the user's branch and current git master.
 subprocess.check_call(["git", "remote", "add", "check-patch", repourl])
-subprocess.check_call(["git", "fetch", "check-patch", "master"])
+subprocess.check_call(["git", "fetch", "--refetch", "check-patch", "master"])
 
 ancestor = subprocess.check_output(["git", "merge-base",
                                     "check-patch/master", "HEAD"],
Signature · 1 line
2.47.1
Acked-by on v1 1/1
#1 lore raw
Quoted 11 lines · Daniel P. Berrangé

When gitlab initializes the repo checkout for a CI job, it will have done a shallow clone with only partial history. Periodically the objects that are omitted cause trouble with the check-patch/check-dco jobs. This is exhibited as reporting strange errors being unable to fetch certain objects that are known to exist.

Passing the --refetch flag to 'git fetch' causes it to not assume the local checkout has all common objects and thus re-fetch everything that is needed. This appears to solve the check-patch/check-dco job failures.

Thanks!

Quoted 33 lines
---
 .gitlab-ci.d/check-dco.py   | 2 +-
 .gitlab-ci.d/check-patch.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
.gitlab-ci.d/check-dco.py +1 -1
index 70dec7d6ee..2fd56683dc 100755
@@ -21,7 +21,7 @@
 
 print(f"adding upstream git repo @ {repourl}")
 subprocess.check_call(["git", "remote", "add", "check-dco", repourl])
-subprocess.check_call(["git", "fetch", "check-dco", "master"])
+subprocess.check_call(["git", "fetch", "--refetch", "check-dco", "master"])
 
 ancestor = subprocess.check_output(["git", "merge-base",
                                     "check-dco/master", "HEAD"],
.gitlab-ci.d/check-patch.py +1 -1
index 68c549a146..be13e6f77d 100755
@@ -24,7 +24,7 @@
 # base for the user's branch. We thus need to figure out a common
 # ancestor between the user's branch and current git master.
 subprocess.check_call(["git", "remote", "add", "check-patch", repourl])
-subprocess.check_call(["git", "fetch", "check-patch", "master"])
+subprocess.check_call(["git", "fetch", "--refetch", "check-patch", "master"])
 
 ancestor = subprocess.check_output(["git", "merge-base",
                                     "check-patch/master", "HEAD"],
Signature · 1 line
2.47.1
Applied
#2 lore raw
In reply to Daniel P. Berrangé
Quoted 11 lines · Daniel P. Berrangé

When gitlab initializes the repo checkout for a CI job, it will have done a shallow clone with only partial history. Periodically the objects that are omitted cause trouble with the check-patch/check-dco jobs. This is exhibited as reporting strange errors being unable to fetch certain objects that are known to exist.

Passing the --refetch flag to 'git fetch' causes it to not assume the local checkout has all common objects and thus re-fetch everything that is needed. This appears to solve the check-patch/check-dco job failures.

Queued to maintainer/for-10.0-softfreeze, thanks.

Signature · 2 lines
Alex Bennée
Virtualisation Tech Lead @ Linaro