Skip to content

Commit 4c96cd7

Browse files
handle older git clients
1 parent 0faa87f commit 4c96cd7

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

configuration/steps/commands/download.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,15 @@ def as_cmd_arg(self) -> list[str]:
5959
depth = "--depth " + str(self.depth)
6060
else:
6161
depth = ""
62+
# Some worker images (e.g. centos7) ship a git old enough (<1.8.4/2.8)
63+
# to not understand submodule update's --depth/--jobs flags at all --
64+
# it rejects the whole option set and dumps usage instead of erroring
65+
# on just the unknown flag. Fall back to a plain (non-shallow,
66+
# unparallelized) submodule update on those rather than failing.
67+
submodule_update = (
68+
f"git -c http.version=HTTP/1.1 submodule update --init --recursive {depth} --jobs={self.jobs}"
69+
" || git -c http.version=HTTP/1.1 submodule update --init --recursive"
70+
)
6271
return [
6372
"bash",
6473
"-exc",
@@ -68,7 +77,7 @@ def as_cmd_arg(self) -> list[str]:
6877
f"git remote add origin {self.repo_url} && "
6978
f"git -c http.version=HTTP/1.1 fetch {depth} origin {self.commit} && "
7079
"git checkout FETCH_HEAD && "
71-
f"git -c http.version=HTTP/1.1 submodule update --init --recursive {depth} --jobs={self.jobs}"
80+
f"({submodule_update})"
7281
)
7382
),
7483
]

0 commit comments

Comments
 (0)