fix: allow cached workspace clone from local repo
This commit is contained in:
parent
67f58e4c57
commit
0c70e71589
@ -396,6 +396,20 @@ def prepare_persistent_build_workspace(
|
|||||||
workspace_root = persistent_build_workspace_path(repo_root, git_ref)
|
workspace_root = persistent_build_workspace_path(repo_root, git_ref)
|
||||||
workspace_root.parent.mkdir(parents=True, exist_ok=True)
|
workspace_root.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
|
# 源仓有时由别的用户维护,git clone 本地路径前先显式加入 safe.directory。
|
||||||
|
local_command_output(
|
||||||
|
["git", "config", "--global", "--add", "safe.directory", str(repo_root)],
|
||||||
|
cwd=workspace_root.parent,
|
||||||
|
label=f"{label} allow source repo",
|
||||||
|
timeout_seconds=120,
|
||||||
|
)
|
||||||
|
local_command_output(
|
||||||
|
["git", "config", "--global", "--add", "safe.directory", str(repo_root / '.git')],
|
||||||
|
cwd=workspace_root.parent,
|
||||||
|
label=f"{label} allow source repo dotgit",
|
||||||
|
timeout_seconds=120,
|
||||||
|
)
|
||||||
|
|
||||||
if not (workspace_root / ".git").exists():
|
if not (workspace_root / ".git").exists():
|
||||||
if workspace_root.exists():
|
if workspace_root.exists():
|
||||||
shutil.rmtree(workspace_root, ignore_errors=True)
|
shutil.rmtree(workspace_root, ignore_errors=True)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user