Skip to content

Commit 4559818

Browse files
authored
feat: troubleshooting docs (#175)
1 parent 7966f94 commit 4559818

File tree

4 files changed

+34
-5
lines changed

4 files changed

+34
-5
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,9 @@ def main(context: dict[str, str]) -> int:
318318

319319
### colima
320320

321-
Since devenv 1.14.0, colima (and the docker CLI needed to interact with it) should have been installed globally for you during bootstrap.
322-
If you're on an older version, run `devenv update` twice to get global colima.
321+
Since devenv 1.14.0, colima (and the docker CLI needed to interact with it)
322+
should have been installed globally for you during bootstrap.
323+
If you're on an older version, run `devenv update`.
323324

324325

325326
### gcloud

devenv/constants.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,21 @@
66
import pwd
77
import typing
88

9+
troubleshooting_help = """\
10+
===============
11+
Troubleshooting
12+
===============
13+
14+
Problem? First try running `devenv doctor`.
15+
If that doesn't help, then proceed:
16+
17+
Internal living doc (more up-to-date):
18+
https://www.notion.so/sentry/devenv-troubleshooting-1448b10e4b5d8080ba04f452e33de48d
19+
20+
Public doc:
21+
https://develop.sentry.dev/development-infrastructure/environment/#troubleshooting
22+
"""
23+
924
version = importlib.metadata.version("sentry_devenv")
1025

1126
CI = os.getenv("CI")

devenv/main.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from devenv import sync
1313
from devenv import update
1414
from devenv.constants import home
15+
from devenv.constants import troubleshooting_help
1516
from devenv.constants import user
1617
from devenv.constants import version
1718
from devenv.lib.config import read_config
@@ -51,7 +52,10 @@ def devenv(argv: Sequence[str], config_path: str) -> ExitCode:
5152

5253
# TODO: Search for modules in work repo
5354

54-
parser = argparse.ArgumentParser()
55+
parser = argparse.ArgumentParser(
56+
formatter_class=argparse.RawDescriptionHelpFormatter,
57+
epilog=troubleshooting_help,
58+
)
5559
parser.add_argument("--version", action="version", version=version)
5660
subparser = parser.add_subparsers(
5761
title=argparse.SUPPRESS,
@@ -62,7 +66,12 @@ def devenv(argv: Sequence[str], config_path: str) -> ExitCode:
6266

6367
for info in modinfo_list:
6468
# Argparse stuff
65-
subparser.add_parser(info.command, help=info.help)
69+
subparser.add_parser(
70+
info.command,
71+
help=info.help,
72+
formatter_class=argparse.RawDescriptionHelpFormatter,
73+
epilog=troubleshooting_help,
74+
)
6675

6776
if len(argv) == 1:
6877
parser.print_help()

devenv/sync.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import os
66
from collections.abc import Sequence
77

8+
from devenv.constants import troubleshooting_help
89
from devenv.lib.context import Context
910
from devenv.lib.modules import DevModuleInfo
1011
from devenv.lib.modules import require_repo
@@ -35,7 +36,10 @@ def main(context: Context, argv: Sequence[str] | None = None) -> int:
3536
}
3637

3738
with contextlib.chdir(repo.path):
38-
return module.main(context_compat) # type: ignore
39+
rc = module.main(context_compat)
40+
if rc != 0:
41+
print(troubleshooting_help)
42+
return rc # type: ignore
3943

4044

4145
module_info = DevModuleInfo(

0 commit comments

Comments
 (0)