fix: install git for durable state recovery
This commit is contained in:
@@ -222,16 +222,23 @@ class StateGitSync:
|
||||
return env
|
||||
|
||||
def _git(self, *args: str, cwd: Path | None = None, check: bool = True) -> subprocess.CompletedProcess[str]:
|
||||
result = subprocess.run(
|
||||
["git", *args],
|
||||
cwd=str(cwd or self.project_root),
|
||||
env=self._git_environment(),
|
||||
text=True,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
timeout=45,
|
||||
check=False,
|
||||
)
|
||||
try:
|
||||
result = subprocess.run(
|
||||
["git", *args],
|
||||
cwd=str(cwd or self.project_root),
|
||||
env=self._git_environment(),
|
||||
text=True,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
timeout=45,
|
||||
check=False,
|
||||
)
|
||||
except FileNotFoundError as exc:
|
||||
raise StateSyncError(
|
||||
"git executable is unavailable; rebuild the service image from the repository Dockerfile"
|
||||
) from exc
|
||||
except subprocess.TimeoutExpired as exc:
|
||||
raise StateSyncError("git operation timed out after 45 seconds") from exc
|
||||
if check and result.returncode != 0:
|
||||
reason = _safe_text(result.stderr.strip() or result.stdout.strip() or f"git exited {result.returncode}")
|
||||
raise StateSyncError(reason)
|
||||
|
||||
Reference in New Issue
Block a user