devservices 1.0.13__tar.gz → 1.0.14__tar.gz
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.
- {devservices-1.0.13 → devservices-1.0.14}/PKG-INFO +1 -1
- {devservices-1.0.13 → devservices-1.0.14}/README.md +1 -1
- {devservices-1.0.13 → devservices-1.0.14}/devservices/exceptions.py +9 -0
- {devservices-1.0.13 → devservices-1.0.14}/devservices/main.py +15 -2
- {devservices-1.0.13 → devservices-1.0.14}/devservices/utils/dependencies.py +8 -1
- {devservices-1.0.13 → devservices-1.0.14}/devservices/utils/docker_compose.py +4 -1
- devservices-1.0.14/devservices/utils/git.py +21 -0
- {devservices-1.0.13 → devservices-1.0.14}/devservices.egg-info/PKG-INFO +1 -1
- {devservices-1.0.13 → devservices-1.0.14}/devservices.egg-info/SOURCES.txt +2 -0
- {devservices-1.0.13 → devservices-1.0.14}/pyproject.toml +1 -1
- {devservices-1.0.13 → devservices-1.0.14}/tests/utils/test_dependencies.py +7 -0
- {devservices-1.0.13 → devservices-1.0.14}/tests/utils/test_docker_compose.py +8 -2
- devservices-1.0.14/tests/utils/test_git.py +33 -0
- {devservices-1.0.13 → devservices-1.0.14}/LICENSE.md +0 -0
- {devservices-1.0.13 → devservices-1.0.14}/devservices/__init__.py +0 -0
- {devservices-1.0.13 → devservices-1.0.14}/devservices/commands/__init__.py +0 -0
- {devservices-1.0.13 → devservices-1.0.14}/devservices/commands/down.py +0 -0
- {devservices-1.0.13 → devservices-1.0.14}/devservices/commands/list_dependencies.py +0 -0
- {devservices-1.0.13 → devservices-1.0.14}/devservices/commands/list_services.py +0 -0
- {devservices-1.0.13 → devservices-1.0.14}/devservices/commands/logs.py +0 -0
- {devservices-1.0.13 → devservices-1.0.14}/devservices/commands/purge.py +0 -0
- {devservices-1.0.13 → devservices-1.0.14}/devservices/commands/status.py +0 -0
- {devservices-1.0.13 → devservices-1.0.14}/devservices/commands/up.py +0 -0
- {devservices-1.0.13 → devservices-1.0.14}/devservices/commands/update.py +0 -0
- {devservices-1.0.13 → devservices-1.0.14}/devservices/configs/service_config.py +0 -0
- {devservices-1.0.13 → devservices-1.0.14}/devservices/constants.py +0 -0
- {devservices-1.0.13 → devservices-1.0.14}/devservices/utils/__init__.py +0 -0
- {devservices-1.0.13 → devservices-1.0.14}/devservices/utils/check_for_update.py +0 -0
- {devservices-1.0.13 → devservices-1.0.14}/devservices/utils/console.py +0 -0
- {devservices-1.0.13 → devservices-1.0.14}/devservices/utils/devenv.py +0 -0
- {devservices-1.0.13 → devservices-1.0.14}/devservices/utils/docker.py +0 -0
- {devservices-1.0.13 → devservices-1.0.14}/devservices/utils/file_lock.py +0 -0
- {devservices-1.0.13 → devservices-1.0.14}/devservices/utils/install_binary.py +0 -0
- {devservices-1.0.13 → devservices-1.0.14}/devservices/utils/services.py +0 -0
- {devservices-1.0.13 → devservices-1.0.14}/devservices/utils/state.py +0 -0
- {devservices-1.0.13 → devservices-1.0.14}/devservices.egg-info/dependency_links.txt +0 -0
- {devservices-1.0.13 → devservices-1.0.14}/devservices.egg-info/entry_points.txt +0 -0
- {devservices-1.0.13 → devservices-1.0.14}/devservices.egg-info/requires.txt +0 -0
- {devservices-1.0.13 → devservices-1.0.14}/devservices.egg-info/top_level.txt +0 -0
- {devservices-1.0.13 → devservices-1.0.14}/setup.cfg +0 -0
- {devservices-1.0.13 → devservices-1.0.14}/testing/__init__.py +0 -0
- {devservices-1.0.13 → devservices-1.0.14}/testing/utils.py +0 -0
- {devservices-1.0.13 → devservices-1.0.14}/tests/__init__.py +0 -0
- {devservices-1.0.13 → devservices-1.0.14}/tests/commands/test_down.py +0 -0
- {devservices-1.0.13 → devservices-1.0.14}/tests/commands/test_list_dependencies.py +0 -0
- {devservices-1.0.13 → devservices-1.0.14}/tests/commands/test_list_services.py +0 -0
- {devservices-1.0.13 → devservices-1.0.14}/tests/commands/test_logs.py +0 -0
- {devservices-1.0.13 → devservices-1.0.14}/tests/commands/test_purge.py +0 -0
- {devservices-1.0.13 → devservices-1.0.14}/tests/commands/test_status.py +0 -0
- {devservices-1.0.13 → devservices-1.0.14}/tests/commands/test_up.py +0 -0
- {devservices-1.0.13 → devservices-1.0.14}/tests/commands/test_update.py +0 -0
- {devservices-1.0.13 → devservices-1.0.14}/tests/configs/test_service_config.py +0 -0
- {devservices-1.0.13 → devservices-1.0.14}/tests/conftest.py +0 -0
- {devservices-1.0.13 → devservices-1.0.14}/tests/utils/test_check_for_update.py +0 -0
- {devservices-1.0.13 → devservices-1.0.14}/tests/utils/test_docker.py +0 -0
- {devservices-1.0.13 → devservices-1.0.14}/tests/utils/test_install_binary.py +0 -0
- {devservices-1.0.13 → devservices-1.0.14}/tests/utils/test_services.py +0 -0
- {devservices-1.0.13 → devservices-1.0.14}/tests/utils/test_state.py +0 -0
|
@@ -123,6 +123,15 @@ class DependencyNotInstalledError(DependencyError):
|
|
|
123
123
|
return f"Dependency not installed correctly: {self.repo_name} ({self.repo_link}) on {self.branch}"
|
|
124
124
|
|
|
125
125
|
|
|
126
|
+
class GitError(Exception):
|
|
127
|
+
"""Base class for git related errors."""
|
|
128
|
+
|
|
129
|
+
def __init__(self, command: str, returncode: int, stderr: str):
|
|
130
|
+
self.command = command
|
|
131
|
+
self.returncode = returncode
|
|
132
|
+
self.stderr = stderr
|
|
133
|
+
|
|
134
|
+
|
|
126
135
|
class GitConfigError(Exception):
|
|
127
136
|
"""Base class for git config related errors."""
|
|
128
137
|
|
|
@@ -5,6 +5,7 @@ import atexit
|
|
|
5
5
|
import getpass
|
|
6
6
|
import logging
|
|
7
7
|
import os
|
|
8
|
+
import platform
|
|
8
9
|
from importlib import metadata
|
|
9
10
|
|
|
10
11
|
from sentry_sdk import capture_exception
|
|
@@ -26,14 +27,18 @@ from devservices.commands import update
|
|
|
26
27
|
from devservices.constants import LOGGER_NAME
|
|
27
28
|
from devservices.exceptions import DockerComposeInstallationError
|
|
28
29
|
from devservices.exceptions import DockerDaemonNotRunningError
|
|
30
|
+
from devservices.exceptions import GitError
|
|
29
31
|
from devservices.utils.console import Console
|
|
30
32
|
from devservices.utils.docker_compose import check_docker_compose_version
|
|
33
|
+
from devservices.utils.git import get_git_version
|
|
31
34
|
|
|
32
35
|
sentry_environment = (
|
|
33
|
-
"development" if os.environ.get("IS_DEV", default=
|
|
36
|
+
"development" if os.environ.get("IS_DEV", default="0") == "1" else "production"
|
|
34
37
|
)
|
|
38
|
+
if os.environ.get("CI", default="false") == "true":
|
|
39
|
+
sentry_environment = "CI"
|
|
35
40
|
|
|
36
|
-
disable_sentry = os.environ.get("DEVSERVICES_DISABLE_SENTRY", default=
|
|
41
|
+
disable_sentry = os.environ.get("DEVSERVICES_DISABLE_SENTRY", default="0") == "1"
|
|
37
42
|
logging.basicConfig(level=logging.INFO)
|
|
38
43
|
current_version = metadata.version("devservices")
|
|
39
44
|
|
|
@@ -49,6 +54,14 @@ if not disable_sentry:
|
|
|
49
54
|
)
|
|
50
55
|
username = getpass.getuser()
|
|
51
56
|
set_user({"username": username})
|
|
57
|
+
set_tag("platform", platform.platform())
|
|
58
|
+
try:
|
|
59
|
+
git_version = get_git_version()
|
|
60
|
+
set_tag("git_version", git_version)
|
|
61
|
+
except GitError as e:
|
|
62
|
+
capture_exception(e)
|
|
63
|
+
logging.debug("Failed to get git version: %s", e)
|
|
64
|
+
set_tag("git_version", "unknown")
|
|
52
65
|
|
|
53
66
|
|
|
54
67
|
@atexit.register
|
|
@@ -472,7 +472,14 @@ def _update_dependency(
|
|
|
472
472
|
|
|
473
473
|
try:
|
|
474
474
|
_run_command_with_retries(
|
|
475
|
-
[
|
|
475
|
+
[
|
|
476
|
+
"git",
|
|
477
|
+
"fetch",
|
|
478
|
+
"origin",
|
|
479
|
+
dependency.branch,
|
|
480
|
+
"--filter=blob:none",
|
|
481
|
+
"--no-recurse-submodules", # Avoid fetching submodules
|
|
482
|
+
],
|
|
476
483
|
cwd=dependency_repo_dir,
|
|
477
484
|
)
|
|
478
485
|
except subprocess.CalledProcessError as e:
|
|
@@ -84,7 +84,10 @@ def install_docker_compose() -> None:
|
|
|
84
84
|
# Verify the installation
|
|
85
85
|
try:
|
|
86
86
|
version = subprocess.run(
|
|
87
|
-
["docker", "compose", "version", "--short"],
|
|
87
|
+
["docker", "compose", "version", "--short"],
|
|
88
|
+
capture_output=True,
|
|
89
|
+
check=True,
|
|
90
|
+
text=True,
|
|
88
91
|
).stdout
|
|
89
92
|
except Exception as e:
|
|
90
93
|
raise DockerComposeInstallationError(
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import subprocess
|
|
4
|
+
|
|
5
|
+
from devservices.exceptions import GitError
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def get_git_version() -> str:
|
|
9
|
+
"""Get the git version"""
|
|
10
|
+
try:
|
|
11
|
+
return subprocess.check_output(
|
|
12
|
+
["git", "version"],
|
|
13
|
+
text=True,
|
|
14
|
+
stderr=subprocess.PIPE,
|
|
15
|
+
).strip()
|
|
16
|
+
except subprocess.CalledProcessError as e:
|
|
17
|
+
raise GitError(
|
|
18
|
+
command="git --version",
|
|
19
|
+
returncode=e.returncode,
|
|
20
|
+
stderr=e.stderr,
|
|
21
|
+
) from e
|
|
@@ -30,6 +30,7 @@ devservices/utils/devenv.py
|
|
|
30
30
|
devservices/utils/docker.py
|
|
31
31
|
devservices/utils/docker_compose.py
|
|
32
32
|
devservices/utils/file_lock.py
|
|
33
|
+
devservices/utils/git.py
|
|
33
34
|
devservices/utils/install_binary.py
|
|
34
35
|
devservices/utils/services.py
|
|
35
36
|
devservices/utils/state.py
|
|
@@ -50,6 +51,7 @@ tests/utils/test_check_for_update.py
|
|
|
50
51
|
tests/utils/test_dependencies.py
|
|
51
52
|
tests/utils/test_docker.py
|
|
52
53
|
tests/utils/test_docker_compose.py
|
|
54
|
+
tests/utils/test_git.py
|
|
53
55
|
tests/utils/test_install_binary.py
|
|
54
56
|
tests/utils/test_services.py
|
|
55
57
|
tests/utils/test_state.py
|
|
@@ -681,6 +681,7 @@ def test_install_dependency_git_fetch_transient_failure(tmp_path: Path) -> None:
|
|
|
681
681
|
"origin",
|
|
682
682
|
"main",
|
|
683
683
|
"--filter=blob:none",
|
|
684
|
+
"--no-recurse-submodules",
|
|
684
685
|
],
|
|
685
686
|
cwd=str(
|
|
686
687
|
tmp_path
|
|
@@ -697,6 +698,7 @@ def test_install_dependency_git_fetch_transient_failure(tmp_path: Path) -> None:
|
|
|
697
698
|
"origin",
|
|
698
699
|
"main",
|
|
699
700
|
"--filter=blob:none",
|
|
701
|
+
"--no-recurse-submodules",
|
|
700
702
|
],
|
|
701
703
|
cwd=str(
|
|
702
704
|
tmp_path
|
|
@@ -713,6 +715,7 @@ def test_install_dependency_git_fetch_transient_failure(tmp_path: Path) -> None:
|
|
|
713
715
|
"origin",
|
|
714
716
|
"main",
|
|
715
717
|
"--filter=blob:none",
|
|
718
|
+
"--no-recurse-submodules",
|
|
716
719
|
],
|
|
717
720
|
cwd=str(
|
|
718
721
|
tmp_path
|
|
@@ -800,6 +803,7 @@ def test_install_dependency_git_fetch_failure_with_retries(tmp_path: Path) -> No
|
|
|
800
803
|
"origin",
|
|
801
804
|
"main",
|
|
802
805
|
"--filter=blob:none",
|
|
806
|
+
"--no-recurse-submodules",
|
|
803
807
|
],
|
|
804
808
|
cwd=str(
|
|
805
809
|
tmp_path
|
|
@@ -816,6 +820,7 @@ def test_install_dependency_git_fetch_failure_with_retries(tmp_path: Path) -> No
|
|
|
816
820
|
"origin",
|
|
817
821
|
"main",
|
|
818
822
|
"--filter=blob:none",
|
|
823
|
+
"--no-recurse-submodules",
|
|
819
824
|
],
|
|
820
825
|
cwd=str(
|
|
821
826
|
tmp_path
|
|
@@ -832,6 +837,7 @@ def test_install_dependency_git_fetch_failure_with_retries(tmp_path: Path) -> No
|
|
|
832
837
|
"origin",
|
|
833
838
|
"main",
|
|
834
839
|
"--filter=blob:none",
|
|
840
|
+
"--no-recurse-submodules",
|
|
835
841
|
],
|
|
836
842
|
cwd=str(
|
|
837
843
|
tmp_path
|
|
@@ -919,6 +925,7 @@ def test_install_dependency_update_git_checkout_failure(tmp_path: Path) -> None:
|
|
|
919
925
|
"origin",
|
|
920
926
|
"main",
|
|
921
927
|
"--filter=blob:none",
|
|
928
|
+
"--no-recurse-submodules",
|
|
922
929
|
],
|
|
923
930
|
cwd=str(
|
|
924
931
|
tmp_path
|
|
@@ -192,7 +192,10 @@ def test_install_docker_compose_macos_arm64(
|
|
|
192
192
|
os.path.expanduser("~/.docker/cli-plugins/docker-compose"),
|
|
193
193
|
)
|
|
194
194
|
mock_subprocess_run.assert_called_once_with(
|
|
195
|
-
["docker", "compose", "version", "--short"],
|
|
195
|
+
["docker", "compose", "version", "--short"],
|
|
196
|
+
capture_output=True,
|
|
197
|
+
check=True,
|
|
198
|
+
text=True,
|
|
196
199
|
)
|
|
197
200
|
|
|
198
201
|
|
|
@@ -231,7 +234,10 @@ def test_install_docker_compose_linux_x86(
|
|
|
231
234
|
os.path.expanduser("~/.docker/cli-plugins/docker-compose"),
|
|
232
235
|
)
|
|
233
236
|
mock_subprocess_run.assert_called_once_with(
|
|
234
|
-
["docker", "compose", "version", "--short"],
|
|
237
|
+
["docker", "compose", "version", "--short"],
|
|
238
|
+
capture_output=True,
|
|
239
|
+
check=True,
|
|
240
|
+
text=True,
|
|
235
241
|
)
|
|
236
242
|
|
|
237
243
|
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import subprocess
|
|
4
|
+
from unittest import mock
|
|
5
|
+
|
|
6
|
+
import pytest
|
|
7
|
+
|
|
8
|
+
from devservices.exceptions import GitError
|
|
9
|
+
from devservices.utils.git import get_git_version
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@mock.patch(
|
|
13
|
+
"devservices.utils.git.subprocess.check_output", return_value="git version 2.42.0"
|
|
14
|
+
)
|
|
15
|
+
def test_get_git_version_success(mock_get_git_version: mock.Mock) -> None:
|
|
16
|
+
assert get_git_version() == "git version 2.42.0"
|
|
17
|
+
mock_get_git_version.assert_called_once_with(
|
|
18
|
+
["git", "version"], text=True, stderr=subprocess.PIPE
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@mock.patch(
|
|
23
|
+
"devservices.utils.git.subprocess.check_output",
|
|
24
|
+
side_effect=subprocess.CalledProcessError(
|
|
25
|
+
returncode=1, cmd="git version", stderr="error"
|
|
26
|
+
),
|
|
27
|
+
)
|
|
28
|
+
def test_get_git_version_error(mock_get_git_version: mock.Mock) -> None:
|
|
29
|
+
with pytest.raises(GitError):
|
|
30
|
+
get_git_version()
|
|
31
|
+
mock_get_git_version.assert_called_once_with(
|
|
32
|
+
["git", "version"], text=True, stderr=subprocess.PIPE
|
|
33
|
+
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|