sentry-devenv 1.16.0__py3-none-any.whl → 1.18.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- devenv/checks/limaDns.py +85 -0
- devenv/colima.py +3 -0
- devenv/lib/colima.py +11 -0
- devenv/lib/docker.py +67 -12
- {sentry_devenv-1.16.0.dist-info → sentry_devenv-1.18.0.dist-info}/METADATA +3 -3
- {sentry_devenv-1.16.0.dist-info → sentry_devenv-1.18.0.dist-info}/RECORD +9 -8
- {sentry_devenv-1.16.0.dist-info → sentry_devenv-1.18.0.dist-info}/WHEEL +1 -1
- {sentry_devenv-1.16.0.dist-info → sentry_devenv-1.18.0.dist-info}/entry_points.txt +0 -0
- {sentry_devenv-1.16.0.dist-info → sentry_devenv-1.18.0.dist-info}/top_level.txt +0 -0
devenv/checks/limaDns.py
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import sys
|
|
4
|
+
|
|
5
|
+
from devenv.lib import colima
|
|
6
|
+
from devenv.lib import proc
|
|
7
|
+
from devenv.lib_check.types import checker
|
|
8
|
+
from devenv.lib_check.types import fixer
|
|
9
|
+
|
|
10
|
+
tags: set[str] = {"builtin"}
|
|
11
|
+
name = "limaDns"
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@checker
|
|
15
|
+
def check() -> tuple[bool, str]:
|
|
16
|
+
# dns resolution can... stop working if colima's running
|
|
17
|
+
# and wifi changes to some other network that gives macos some
|
|
18
|
+
# weird nameservers
|
|
19
|
+
|
|
20
|
+
status = colima.check()
|
|
21
|
+
if status != colima.ColimaStatus.UP:
|
|
22
|
+
return False, "colima isn't up"
|
|
23
|
+
|
|
24
|
+
try:
|
|
25
|
+
proc.run(
|
|
26
|
+
(
|
|
27
|
+
"colima",
|
|
28
|
+
"exec",
|
|
29
|
+
"--",
|
|
30
|
+
"python3",
|
|
31
|
+
"-Su",
|
|
32
|
+
"-c",
|
|
33
|
+
"""
|
|
34
|
+
import socket
|
|
35
|
+
|
|
36
|
+
try:
|
|
37
|
+
socket.getaddrinfo("ghcr.io", None)
|
|
38
|
+
except socket.gaierror as e:
|
|
39
|
+
raise SystemExit(f"failed to resolve ghcr.io: {e}")
|
|
40
|
+
""",
|
|
41
|
+
),
|
|
42
|
+
stdout=True,
|
|
43
|
+
)
|
|
44
|
+
except RuntimeError as e:
|
|
45
|
+
return False, f"{e}"
|
|
46
|
+
|
|
47
|
+
return True, ""
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
@fixer
|
|
51
|
+
def fix() -> tuple[bool, str]:
|
|
52
|
+
status = colima.start()
|
|
53
|
+
if status == colima.ColimaStatus.UNHEALTHY:
|
|
54
|
+
return False, "colima started, but it's unhealthy"
|
|
55
|
+
|
|
56
|
+
try:
|
|
57
|
+
proc.run(
|
|
58
|
+
(
|
|
59
|
+
"colima",
|
|
60
|
+
"exec",
|
|
61
|
+
"--",
|
|
62
|
+
"sudo",
|
|
63
|
+
"systemctl",
|
|
64
|
+
"restart",
|
|
65
|
+
"systemd-resolved.service",
|
|
66
|
+
),
|
|
67
|
+
stdout=True,
|
|
68
|
+
)
|
|
69
|
+
except RuntimeError as e:
|
|
70
|
+
print(
|
|
71
|
+
f"""
|
|
72
|
+
failed to restart the vm's resolved:
|
|
73
|
+
{e}
|
|
74
|
+
|
|
75
|
+
we're going to try restarting colima
|
|
76
|
+
"""
|
|
77
|
+
)
|
|
78
|
+
try:
|
|
79
|
+
proc.run(
|
|
80
|
+
(sys.executable, "-P", "-m", "devenv", "colima", "restart")
|
|
81
|
+
)
|
|
82
|
+
except RuntimeError as e:
|
|
83
|
+
return False, f"{e}"
|
|
84
|
+
|
|
85
|
+
return True, ""
|
devenv/colima.py
CHANGED
|
@@ -18,6 +18,9 @@ def main(context: Context, argv: Sequence[str] | None = None) -> int:
|
|
|
18
18
|
|
|
19
19
|
args = parser.parse_args(argv)
|
|
20
20
|
|
|
21
|
+
# TODO: in addition to returning 1 we should print colima logs
|
|
22
|
+
# (and/or send to sentry)
|
|
23
|
+
|
|
21
24
|
if args.command == "start":
|
|
22
25
|
status = colima.start()
|
|
23
26
|
if status == colima.ColimaStatus.UNHEALTHY:
|
devenv/lib/colima.py
CHANGED
|
@@ -180,6 +180,17 @@ def start(restart: bool = False) -> ColimaStatus:
|
|
|
180
180
|
"colima",
|
|
181
181
|
"start",
|
|
182
182
|
"--verbose",
|
|
183
|
+
# this effectively makes the vm's resolvectl status use:
|
|
184
|
+
# DNS Servers: 8.8.8.8 1.1.1.1 192.168.5.2
|
|
185
|
+
# https://lima-vm.io/docs/config/network/user/
|
|
186
|
+
# 192.168.5.2 is the host, accessible from the vm
|
|
187
|
+
# sometimes using only the host will result in dns breaking
|
|
188
|
+
# for any number of reasons (public wifi that gives you some weird dns server,
|
|
189
|
+
# tethering, vpn, what have you)
|
|
190
|
+
"--dns",
|
|
191
|
+
"8.8.8.8",
|
|
192
|
+
"--dns",
|
|
193
|
+
"1.1.1.1",
|
|
183
194
|
# ideally we keep ~ ro, but currently the "default" vm
|
|
184
195
|
# is shared across repositories, so for ease of use we'll let home rw
|
|
185
196
|
f"--mount=/var/folders:w,/private/tmp/colima:w,{home}:w",
|
devenv/lib/docker.py
CHANGED
|
@@ -7,6 +7,7 @@ import subprocess
|
|
|
7
7
|
import tempfile
|
|
8
8
|
from threading import Thread
|
|
9
9
|
|
|
10
|
+
from devenv.constants import home
|
|
10
11
|
from devenv.constants import root
|
|
11
12
|
from devenv.constants import SYSTEM_MACHINE
|
|
12
13
|
from devenv.lib import archive
|
|
@@ -55,7 +56,10 @@ def check_docker_to_host_connectivity(timeout: int = 3) -> bool:
|
|
|
55
56
|
|
|
56
57
|
|
|
57
58
|
def uninstall(binroot: str) -> None:
|
|
58
|
-
for fp in (
|
|
59
|
+
for fp in (
|
|
60
|
+
f"{binroot}/docker",
|
|
61
|
+
f"{home}/.docker/cli-plugins/docker-buildx",
|
|
62
|
+
):
|
|
59
63
|
try:
|
|
60
64
|
os.remove(fp)
|
|
61
65
|
except FileNotFoundError:
|
|
@@ -76,30 +80,81 @@ def _install(url: str, sha256: str, into: str) -> None:
|
|
|
76
80
|
os.replace(f"{tmpd}/docker", f"{into}/docker")
|
|
77
81
|
|
|
78
82
|
|
|
83
|
+
def _install_buildx(url: str, sha256: str, into: str) -> None:
|
|
84
|
+
archive.download(url, sha256, dest=f"{into}/docker-buildx")
|
|
85
|
+
os.chmod(f"{into}/docker-buildx", 0o775)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def _check_buildx(binroot: str, expected_version: str) -> bool:
|
|
89
|
+
try:
|
|
90
|
+
stdout = proc.run(
|
|
91
|
+
(f"{binroot}/docker", "buildx", "version"), stdout=True
|
|
92
|
+
)
|
|
93
|
+
except RuntimeError as e:
|
|
94
|
+
print(f"failed getting buildx version:\n\n{e}")
|
|
95
|
+
return False
|
|
96
|
+
|
|
97
|
+
# github.com/docker/buildx v0.22.0 Homebrew
|
|
98
|
+
installed_version = stdout.strip().split()[1]
|
|
99
|
+
|
|
100
|
+
if installed_version == expected_version:
|
|
101
|
+
return True
|
|
102
|
+
|
|
103
|
+
print(
|
|
104
|
+
f"installed docker-buildx {installed_version} is outdated! expected: {expected_version}"
|
|
105
|
+
)
|
|
106
|
+
return False
|
|
107
|
+
|
|
108
|
+
|
|
79
109
|
def install_global() -> None:
|
|
80
110
|
version = "27.3.1"
|
|
81
111
|
cfg = {
|
|
82
|
-
"darwin_x86_64": "https://download.docker.com/mac/static/stable/x86_64/docker-
|
|
112
|
+
"darwin_x86_64": f"https://download.docker.com/mac/static/stable/x86_64/docker-{version}.tgz",
|
|
83
113
|
"darwin_x86_64_sha256": "1b621d4c9a57ff361811cf29754aafb0c28bc113c70011927af8d73c2c162186",
|
|
84
|
-
"darwin_arm64": "https://download.docker.com/mac/static/stable/aarch64/docker-
|
|
114
|
+
"darwin_arm64": f"https://download.docker.com/mac/static/stable/aarch64/docker-{version}.tgz",
|
|
85
115
|
"darwin_arm64_sha256": "9dae125282116146b06eb777c2125ddda6c0468c0b9ad6c72a82edbc6783a77b",
|
|
86
|
-
"linux_x86_64": "https://download.docker.com/linux/static/stable/x86_64/docker-
|
|
116
|
+
"linux_x86_64": f"https://download.docker.com/linux/static/stable/x86_64/docker-{version}.tgz",
|
|
87
117
|
"linux_x86_64_sha256": "9b4f6fe406e50f9085ee474c451e2bb5adb119a03591f467922d3b4e2ddf31d3",
|
|
88
118
|
}
|
|
89
119
|
|
|
120
|
+
version_buildx = "v0.22.0"
|
|
121
|
+
cfg_buildx = {
|
|
122
|
+
"darwin_x86_64": f"https://github.com/docker/buildx/releases/download/{version_buildx}/buildx-{version_buildx}.darwin-amd64",
|
|
123
|
+
"darwin_x86_64_sha256": "5221ad6b8acd2283f8fbbeebc79ae4b657e83519ca1c1e4cfbb9405230b3d933",
|
|
124
|
+
"darwin_arm64": f"https://github.com/docker/buildx/releases/download/{version_buildx}/buildx-{version_buildx}.darwin-arm64",
|
|
125
|
+
"darwin_arm64_sha256": "5898c338abb1f673107bc087997dc3cb63b4ea66d304ce4223472f57bd8d616e",
|
|
126
|
+
"linux_x86_64": f"https://github.com/docker/buildx/releases/download/{version_buildx}/buildx-{version_buildx}.linux-amd64",
|
|
127
|
+
"linux_x86_64_sha256": "805195386fba0cea5a1487cf0d47da82a145ea0a792bd3fb477583e2dbcdcc2f",
|
|
128
|
+
}
|
|
129
|
+
|
|
90
130
|
binroot = f"{root}/bin"
|
|
91
131
|
|
|
92
132
|
if shutil.which("docker", path=binroot) == f"{binroot}/docker":
|
|
93
133
|
stdout = proc.run((f"{binroot}/docker", "--version"), stdout=True)
|
|
94
134
|
installed_version = stdout.strip().split()[2][:-1]
|
|
95
|
-
if version
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
135
|
+
if version != installed_version:
|
|
136
|
+
print(f"installed docker {installed_version} is outdated!")
|
|
137
|
+
print(f"installing docker (cli, not desktop) {version}...")
|
|
138
|
+
uninstall(binroot)
|
|
139
|
+
_install(
|
|
140
|
+
cfg[SYSTEM_MACHINE], cfg[f"{SYSTEM_MACHINE}_sha256"], binroot
|
|
141
|
+
)
|
|
142
|
+
else:
|
|
143
|
+
_install(cfg[SYSTEM_MACHINE], cfg[f"{SYSTEM_MACHINE}_sha256"], binroot)
|
|
102
144
|
|
|
103
145
|
stdout = proc.run((f"{binroot}/docker", "--version"), stdout=True)
|
|
104
146
|
if f"Docker version {version}" not in stdout:
|
|
105
|
-
raise SystemExit(f"Failed to install docker {version}
|
|
147
|
+
raise SystemExit(f"Failed to install docker {version}!\n\n{stdout}")
|
|
148
|
+
|
|
149
|
+
if not _check_buildx(binroot, version_buildx):
|
|
150
|
+
print(f"installing docker buildx {version_buildx}...")
|
|
151
|
+
_install_buildx(
|
|
152
|
+
cfg_buildx[SYSTEM_MACHINE],
|
|
153
|
+
cfg_buildx[f"{SYSTEM_MACHINE}_sha256"],
|
|
154
|
+
f"{home}/.docker/cli-plugins",
|
|
155
|
+
)
|
|
156
|
+
|
|
157
|
+
if not _check_buildx(binroot, version_buildx):
|
|
158
|
+
raise SystemExit(
|
|
159
|
+
f"Failed to install docker buildx {version_buildx}!"
|
|
160
|
+
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: sentry_devenv
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.18.0
|
|
4
4
|
Summary: Utilities for setting up a Sentry development environment
|
|
5
5
|
Author-email: Joshua Li <joshua.li@sentry.io>, Ian Woodard <ian.woodard@sentry.io>, Buck Evan <buck.evan@sentry.io>
|
|
6
6
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -16,7 +16,7 @@ Requires-Dist: sentry-sdk
|
|
|
16
16
|
managing dev environments since '24
|
|
17
17
|
|
|
18
18
|
`devenv` is an extensible execution framework and library for authoring
|
|
19
|
-
a simple set of high level commands - bootstrap, sync, doctor
|
|
19
|
+
a simple set of high level commands - bootstrap, fetch, sync, doctor - that
|
|
20
20
|
manage a repository's dev environment.
|
|
21
21
|
|
|
22
22
|
## prerequisites
|
|
@@ -2,7 +2,7 @@ ci/integration/repo/devenv/sync.py,sha256=mZhOcSeA10BQ5DkDBoSbpjc2rHeRVYEZAZ6zse
|
|
|
2
2
|
devenv/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
3
|
devenv/__main__.py,sha256=O8ROZOx3emX7hhzMD608Ud_Pny_PCy5RsWXwBLhf8Q8,122
|
|
4
4
|
devenv/bootstrap.py,sha256=VSlS1giUv8fE0K5pZgIO-QBKg5PsaWxirF6G9OPUUhE,4047
|
|
5
|
-
devenv/colima.py,sha256=
|
|
5
|
+
devenv/colima.py,sha256=Dk9t6eu2DEoqqkY8xLmgiB96r-6zi3aXcvON3P8h1JQ,1537
|
|
6
6
|
devenv/constants.py,sha256=wl0sRfkNeJL-sML6MG5nS0zU-dwRo1mDPrhUSHHY1YQ,1498
|
|
7
7
|
devenv/doctor.py,sha256=VZlcX1GgIEUGTT4PX0phyWSx1UfI3uQbXsANpKVDTj0,8782
|
|
8
8
|
devenv/fetch.py,sha256=MbztGFOzBR4KDPG0TVWcQsA4pGXk61zrQXvh-C9xHuk,3904
|
|
@@ -14,15 +14,16 @@ devenv/sync.py,sha256=B9bvAuI7K-4SqcfHD4_zwKpozAnHWCNOL-IhVOcc3Zg,1254
|
|
|
14
14
|
devenv/update.py,sha256=CkshQUvmVVblXdjARgWQKXSe7pwMjSMrPR3gDEesX5c,2402
|
|
15
15
|
devenv/checks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
16
16
|
devenv/checks/credsStore.py,sha256=eUwtoQ8btFsM8Ir-Vla98MEQFQ5o-OyFu--CSnZr3uY,1149
|
|
17
|
+
devenv/checks/limaDns.py,sha256=yX0s63BR9OcX4TWtlywNlaS4NkrlFYj9W_vxX6NAFQg,1860
|
|
17
18
|
devenv/checks/test.py,sha256=AvxoA2W5qTO2ZpoXmjScLiJxXD3Y_limYp5yTjGSZ9U,701
|
|
18
19
|
devenv/lib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
19
20
|
devenv/lib/archive.py,sha256=LlVETRsf3J53yY_8sjL4P8plLNEMKoS9G48kfoVoseA,4503
|
|
20
21
|
devenv/lib/brew.py,sha256=_7recvYh-LnUJC0eKnYK7F8AzGRL5bi_Khv0f_mgrlM,1795
|
|
21
|
-
devenv/lib/colima.py,sha256=
|
|
22
|
+
devenv/lib/colima.py,sha256=8JSAGC2pXthY_h7-AOsW0xgN-kyZq7_fh63-hhYFCIE,7381
|
|
22
23
|
devenv/lib/config.py,sha256=5eXYwM44AJ3w2VfVbCDqchYOL1zAjazNcirtM6kxxGw,3344
|
|
23
24
|
devenv/lib/context.py,sha256=4EDImK9pvTp3FqeNigevC9lbJsgdDO9D1t2_Y4NyPlc,207
|
|
24
25
|
devenv/lib/direnv.py,sha256=HDRUaIR0PMAQYiiTaw3gEQuh6Tdb7BUJmV7dBZdPztM,1325
|
|
25
|
-
devenv/lib/docker.py,sha256=
|
|
26
|
+
devenv/lib/docker.py,sha256=cOBe9TRzoVkJbYv0g8yqkuyDYyntTasagwBGSiAgijs,5684
|
|
26
27
|
devenv/lib/fs.py,sha256=IBahQ9fB-o9cK9HipK_L0gso2OVinIDTxFWoeMte9ww,2764
|
|
27
28
|
devenv/lib/gcloud.py,sha256=G8rhKC89TqWcFzIVsFd64d4ouD6M6s-TaMX5ZxtKypw,3550
|
|
28
29
|
devenv/lib/github.py,sha256=AMtcz6gTVKy7qvCP1zTUdHQlnSM32TVaji0aOXJ_F9A,3463
|
|
@@ -69,8 +70,8 @@ tests/lib/test_github.py,sha256=IMEG2cmRaK_PMJprFE_ZMqPnZ0StwWqgznhhT_zVk3U,4526
|
|
|
69
70
|
tests/lib/test_proc.py,sha256=XH6OnxKPSSm3HvDjYHApputMKwgOE8lYqDuK2vK0Z0U,2626
|
|
70
71
|
tests/lib/test_repository.py,sha256=gUi1lkY7bha5WwZ5xcnENOlFYboVV8TFW1lCESvS0VA,787
|
|
71
72
|
tests/lib/test_venv.py,sha256=wscU7Enp8fK6o_2HgIT4WwDnvHbKwaKvJhNyJUrDNqk,3262
|
|
72
|
-
sentry_devenv-1.
|
|
73
|
-
sentry_devenv-1.
|
|
74
|
-
sentry_devenv-1.
|
|
75
|
-
sentry_devenv-1.
|
|
76
|
-
sentry_devenv-1.
|
|
73
|
+
sentry_devenv-1.18.0.dist-info/METADATA,sha256=2yYNwF0Iz9QTxXw0dnucRef4B0hIpcil88QzTqs6uf4,13622
|
|
74
|
+
sentry_devenv-1.18.0.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
|
75
|
+
sentry_devenv-1.18.0.dist-info/entry_points.txt,sha256=StsIuNugcoEU8jsPy6H9ECjzoDzOVKXl1vUaYTIGbzM,44
|
|
76
|
+
sentry_devenv-1.18.0.dist-info/top_level.txt,sha256=dOQExvIA0fj_EQjCrMTS7CCHNH7WZFHxEU0M7LlNcKQ,16
|
|
77
|
+
sentry_devenv-1.18.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|