Skip to content

Commit 6279c13

Browse files
authored
Pin to new verison of SDK (#126)
* Pin to new verison of SDK * Fix branch not being a string in auto detection * Add the Reachability CLI to the Docker build so that it is already present and doesn't need to be pulled * If version isn't specific always pull latest coana cli, else make sure we have the specified version
1 parent ef1fbf9 commit 6279c13

File tree

6 files changed

+37
-33
lines changed

6 files changed

+37
-33
lines changed

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ ARG PIP_INDEX_URL=https://pypi.org/simple
66
ARG PIP_EXTRA_INDEX_URL=https://pypi.org/simple
77

88
RUN apk update \
9-
&& apk add --no-cache git nodejs npm yarn
9+
&& apk add --no-cache git nodejs npm yarn \
10+
&& npm install @coana-tech/cli -g
1011

1112
# Install CLI with retries for TestPyPI propagation (10 attempts, 30s each = 5 minutes total)
1213
RUN for i in $(seq 1 10); do \

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ build-backend = "hatchling.build"
66

77
[project]
88
name = "socketsecurity"
9-
version = "2.2.18"
9+
version = "2.2.22"
1010
requires-python = ">= 3.10"
1111
license = {"file" = "LICENSE"}
1212
dependencies = [
@@ -16,7 +16,7 @@ dependencies = [
1616
'GitPython',
1717
'packaging',
1818
'python-dotenv',
19-
'socketdev>=3.0.6,<4.0.0',
19+
'socketdev>=3.0.16,<4.0.0',
2020
"bs4>=0.0.2",
2121
]
2222
readme = "README.md"

socketsecurity/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
__author__ = 'socket.dev'
2-
__version__ = '2.2.18'
2+
__version__ = '2.2.22'
33
USER_AGENT = f'SocketPythonCLI/{__version__}'

socketsecurity/core/git_interface.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,7 @@ def __init__(self, path: str):
9797
else:
9898
# Try to get branch name from git properties
9999
try:
100-
self.branch = self.head.reference
101-
urllib.parse.unquote(str(self.branch))
100+
self.branch = urllib.parse.unquote(str(self.head.reference))
102101
log.debug(f"Branch detected from git reference: {self.branch}")
103102
except Exception as error:
104103
log.debug(f"Failed to get branch from git reference: {error}")

socketsecurity/core/tools/reachability.py

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,38 +17,42 @@ def __init__(self, sdk: socketdev, api_token: str):
1717

1818
def _ensure_coana_cli_installed(self, version: Optional[str] = None) -> str:
1919
"""
20-
Check if @coana-tech/cli is installed, and install it if not present.
20+
Check if @coana-tech/cli is installed, and install/update it if needed.
2121
2222
Args:
23-
version: Specific version to install (e.g., '1.2.3')
23+
version: Specific version to install (e.g., '1.2.3'). If None, updates to latest.
2424
2525
Returns:
2626
str: The package specifier to use with npx
2727
"""
2828
# Determine the package specifier
2929
package_spec = f"@coana-tech/cli@{version}" if version else "@coana-tech/cli"
3030

31-
# Check if the package is already available
32-
try:
33-
check_cmd = ["npm", "list", "-g", "@coana-tech/cli", "--depth=0"]
34-
result = subprocess.run(
35-
check_cmd,
36-
capture_output=True,
37-
text=True,
38-
timeout=10
39-
)
40-
41-
# If npm list succeeds and mentions the package, it's installed
42-
if result.returncode == 0 and "@coana-tech/cli" in result.stdout:
43-
log.debug(f"@coana-tech/cli is already installed globally")
44-
return package_spec
31+
# If a specific version is requested, check if it's already installed
32+
if version:
33+
try:
34+
check_cmd = ["npm", "list", "-g", "@coana-tech/cli", "--depth=0"]
35+
result = subprocess.run(
36+
check_cmd,
37+
capture_output=True,
38+
text=True,
39+
timeout=10
40+
)
4541

46-
except Exception as e:
47-
log.debug(f"Could not check for existing @coana-tech/cli installation: {e}")
48-
49-
# Package not found or check failed - install it
50-
log.info("Downloading reachability analysis plugin (@coana-tech/cli)...")
51-
log.info("This may take a moment on first run...")
42+
# If npm list succeeds and mentions the specific version, it's installed
43+
if result.returncode == 0 and f"@coana-tech/cli@{version}" in result.stdout:
44+
log.debug(f"@coana-tech/cli@{version} is already installed globally")
45+
return package_spec
46+
47+
except Exception as e:
48+
log.debug(f"Could not check for existing @coana-tech/cli installation: {e}")
49+
50+
# Install or update the package
51+
if version:
52+
log.info(f"Installing reachability analysis plugin (@coana-tech/cli@{version})...")
53+
else:
54+
log.info("Updating reachability analysis plugin (@coana-tech/cli) to latest version...")
55+
log.info("This may take a moment...")
5256

5357
try:
5458
install_cmd = ["npm", "install", "-g", package_spec]

uv.lock

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)