Skip to content

Commit 054c88e

Browse files
Skip update checks during installer verification
1 parent eacbe44 commit 054c88e

3 files changed

Lines changed: 25 additions & 1 deletion

File tree

gauss_cli/banner.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,9 @@ def check_for_updates() -> Optional[int]:
244244
``~/.gauss/.update_check``). Returns the number of commits behind,
245245
or ``None`` if the check fails or isn't applicable.
246246
"""
247+
if os.getenv("GAUSS_SKIP_UPDATE_CHECK", "").strip().lower() in {"1", "true", "yes", "on"}:
248+
return None
249+
247250
from gauss_cli.config import get_gauss_home, get_installed_repo_root
248251

249252
gauss_home = get_gauss_home()

scripts/install-internal.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1614,7 +1614,7 @@ run_post_install_self_check() {
16141614
log_info "Running post-install verification..."
16151615

16161616
local version_output
1617-
if ! version_output="$("$GAUSS_BIN" --version 2>&1)"; then
1617+
if ! version_output="$(GAUSS_SKIP_UPDATE_CHECK=1 "$GAUSS_BIN" --version 2>&1)"; then
16181618
log_error "Gauss CLI verification failed."
16191619
printf '%s\n' "$version_output" >&2
16201620
exit 1

tests/gauss_cli/test_update_check.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,27 @@ def test_check_for_updates_no_git_dir(tmp_path):
8080
banner.__file__ = original
8181

8282

83+
def test_check_for_updates_can_be_disabled_via_env(tmp_path):
84+
"""Installer and CI callers can skip the update probe entirely."""
85+
from gauss_cli.banner import check_for_updates
86+
87+
repo_dir = tmp_path / "checkout"
88+
repo_dir.mkdir()
89+
(repo_dir / ".git").mkdir()
90+
(tmp_path / "install-root").write_text(str(repo_dir))
91+
92+
with patch.dict(
93+
"os.environ",
94+
{"GAUSS_HOME": str(tmp_path), "GAUSS_SKIP_UPDATE_CHECK": "1"},
95+
clear=False,
96+
):
97+
with patch("gauss_cli.banner.subprocess.run") as mock_run:
98+
result = check_for_updates()
99+
100+
assert result is None
101+
mock_run.assert_not_called()
102+
103+
83104
def test_check_for_updates_fallback_to_project_root():
84105
"""Dev install: falls back to Path(__file__).parent.parent when GAUSS_HOME has no git repo."""
85106
import gauss_cli.banner as banner

0 commit comments

Comments
 (0)