commit 83b169f255c17c66311bb1cce772b0826ead08bc
parent 5d8fba62e472474cce59e5f6e06386a1e572a49f
Author: agoloman <agoloman@mozilla.com>
Date: Mon, 29 Dec 2025 11:46:55 +0200
Revert "Bug 2007063: Remove mach doctor checks for hg.mozilla.org. r=firefox-build-system-reviewers,ahochheiden" for causing gecko decision task failures.
This reverts commit 5d8fba62e472474cce59e5f6e06386a1e572a49f.
Diffstat:
1 file changed, 76 insertions(+), 0 deletions(-)
diff --git a/python/mozbuild/mozbuild/doctor.py b/python/mozbuild/mozbuild/doctor.py
@@ -133,6 +133,82 @@ def internet(**kwargs) -> DoctorCheck:
@check
+def ssh(**kwargs) -> DoctorCheck:
+ """Check the status of `ssh hg.mozilla.org` for common errors."""
+ try:
+ # We expect this command to return exit code 1 even when we hit
+ # the successful code path, since we don't specify a `pash` command.
+ proc = subprocess.run(
+ ["ssh", "hg.mozilla.org"],
+ check=False,
+ encoding="utf-8",
+ capture_output=True,
+ )
+
+ # Command output from a successful `pash` run.
+ if "has privileges to access Mercurial over" in proc.stdout:
+ return DoctorCheck(
+ name="ssh",
+ status=CheckStatus.OK,
+ display_text=["SSH is properly configured for access to hg."],
+ )
+
+ if "Permission denied" in proc.stdout:
+ # Parse proc.stdout for username, which looks like:
+ # `<username>@hg.mozilla.org: Permission denied (reason)`
+ login_string = proc.stdout.split()[0]
+ username, _host = login_string.split("@hg.mozilla.org")
+
+ # `<username>` should be an email.
+ if "@" not in username:
+ return DoctorCheck(
+ name="ssh",
+ status=CheckStatus.FATAL,
+ display_text=[
+ f"SSH username `{username}` is not an email address.",
+ "hg.mozilla.org logins should be in the form `user@domain.com`.",
+ ],
+ )
+
+ return DoctorCheck(
+ name="ssh",
+ status=CheckStatus.WARNING,
+ display_text=[
+ f"SSH username `{username}` does not have permission to push to "
+ "hg.mozilla.org."
+ ],
+ )
+
+ if "Mercurial access is currently disabled on your account" in proc.stdout:
+ return DoctorCheck(
+ name="ssh",
+ status=CheckStatus.FATAL,
+ display_text=[
+ "You previously had push access to hgmo, but due to inactivity",
+ "your access was revoked. Please file a bug in Bugzilla under",
+ "`Infrastructure & Operations :: Infrastructure: LDAP` to request",
+ "access.",
+ ],
+ )
+
+ return DoctorCheck(
+ name="ssh",
+ status=CheckStatus.WARNING,
+ display_text=[
+ "Unexpected output from `ssh hg.mozilla.org`:",
+ proc.stdout,
+ ],
+ )
+
+ except subprocess.CalledProcessError:
+ return DoctorCheck(
+ name="ssh",
+ status=CheckStatus.WARNING,
+ display_text=["Could not run `ssh hg.mozilla.org`."],
+ )
+
+
+@check
def cpu(**kwargs) -> DoctorCheck:
"""Check the host machine has the recommended processing power to develop Firefox."""
cpu_count = psutil.cpu_count()