Skip to content

Commit 54eec44

Browse files
committed
Fix default path for UV and minimum SDK version to fix tar hash upload
1 parent d37f8a3 commit 54eec44

File tree

5 files changed

+51
-24
lines changed

5 files changed

+51
-24
lines changed

Dockerfile

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ ARG CLI_VERSION
44
ARG SDK_VERSION
55
ARG PIP_INDEX_URL=https://pypi.org/simple
66
ARG PIP_EXTRA_INDEX_URL=https://pypi.org/simple
7+
ARG USE_LOCAL_INSTALL=false
78

89
RUN apk update \
910
&& apk add --no-cache git nodejs npm yarn curl \
@@ -12,17 +13,28 @@ RUN apk update \
1213
# Install uv
1314
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
1415

15-
# Install CLI with retries for TestPyPI propagation (10 attempts, 30s each = 5 minutes total)
16-
RUN for i in $(seq 1 10); do \
17-
echo "Attempt $i/10: Installing socketsecurity==$CLI_VERSION"; \
18-
if pip install --index-url ${PIP_INDEX_URL} --extra-index-url ${PIP_EXTRA_INDEX_URL} socketsecurity==$CLI_VERSION; then \
19-
break; \
16+
# Install CLI based on build mode
17+
RUN if [ "$USE_LOCAL_INSTALL" = "true" ]; then \
18+
echo "Using local development install"; \
19+
else \
20+
for i in $(seq 1 10); do \
21+
echo "Attempt $i/10: Installing socketsecurity==$CLI_VERSION"; \
22+
if pip install --index-url ${PIP_INDEX_URL} --extra-index-url ${PIP_EXTRA_INDEX_URL} socketsecurity==$CLI_VERSION; then \
23+
break; \
24+
fi; \
25+
echo "Install failed, waiting 30s before retry..."; \
26+
sleep 30; \
27+
done && \
28+
if [ ! -z "$SDK_VERSION" ]; then \
29+
pip install --index-url ${PIP_INDEX_URL} --extra-index-url ${PIP_EXTRA_INDEX_URL} socketdev==${SDK_VERSION}; \
2030
fi; \
21-
echo "Install failed, waiting 30s before retry..."; \
22-
sleep 30; \
23-
done && \
24-
if [ ! -z "$SDK_VERSION" ]; then \
25-
pip install --index-url ${PIP_INDEX_URL} --extra-index-url ${PIP_EXTRA_INDEX_URL} socketdev==${SDK_VERSION}; \
31+
fi
32+
33+
# Copy local source and install in editable mode if USE_LOCAL_INSTALL is true
34+
COPY . /app
35+
WORKDIR /app
36+
RUN if [ "$USE_LOCAL_INSTALL" = "true" ]; then \
37+
pip install -e .; \
2638
fi
2739

2840
# ENTRYPOINT ["socketcli"]

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.24"
9+
version = "2.2.25"
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.16,<4.0.0',
19+
'socketdev>=3.0.17,<4.0.0',
2020
"bs4>=0.0.2",
2121
]
2222
readme = "README.md"

scripts/build_container.sh

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,15 @@ verify_package() {
2424

2525
echo $VERSION
2626
if [ -z $ENABLE_PYPI_BUILD ] || [ -z $STABLE_VERSION ]; then
27-
echo "$0 pypi-build=<option> stable=<true|false>"
27+
echo "$0 pypi-build=<option> stable=<true|false|prod|test>"
2828
echo "\tpypi-build: Options are prod, test, or local"
2929
echo "\t - prod: Build and publish to production PyPI, then build Docker images"
3030
echo "\t - test: Build and publish to test PyPI, then build Docker images"
3131
echo "\t - local: Build Docker images only using existing PyPI package (specify prod or test via stable parameter)"
32-
echo "\tstable: true/false - Also tag as stable; for local builds, use 'prod' or 'test' to specify PyPI source"
32+
echo "\tstable: true/false/prod/test - Also tag as stable; for local builds:"
33+
echo "\t - stable=prod: Use production PyPI package"
34+
echo "\t - stable=test: Use test PyPI package"
35+
echo "\t - stable=false: Use local development install (pip install -e .)"
3336
exit
3437
fi
3538

@@ -109,22 +112,35 @@ if [ $ENABLE_PYPI_BUILD = "pypi-build=local" ]; then
109112
PIP_INDEX_URL="https://pypi.org/simple"
110113
PIP_EXTRA_INDEX_URL="https://pypi.org/simple"
111114
TAG_SUFFIX="local"
115+
USE_LOCAL_INSTALL="false"
112116
elif [ $STABLE_VERSION = "stable=test" ]; then
113117
echo "Using test PyPI"
114118
PIP_INDEX_URL="https://test.pypi.org/simple"
115119
PIP_EXTRA_INDEX_URL="https://pypi.org/simple"
116120
TAG_SUFFIX="local-test"
121+
USE_LOCAL_INSTALL="false"
122+
elif [ $STABLE_VERSION = "stable=false" ]; then
123+
echo "Using local development install (pip install -e .)"
124+
TAG_SUFFIX="local-dev"
125+
USE_LOCAL_INSTALL="true"
117126
else
118-
echo "For local builds, use stable=prod or stable=test to specify PyPI source"
127+
echo "For local builds, use stable=prod, stable=test, or stable=false"
119128
exit 1
120129
fi
121130

122-
docker build --no-cache \
123-
--build-arg CLI_VERSION=$VERSION \
124-
--build-arg PIP_INDEX_URL=$PIP_INDEX_URL \
125-
--build-arg PIP_EXTRA_INDEX_URL=$PIP_EXTRA_INDEX_URL \
126-
-t socketdev/cli:$VERSION-$TAG_SUFFIX \
127-
-t socketdev/cli:$TAG_SUFFIX .
131+
if [ $USE_LOCAL_INSTALL = "true" ]; then
132+
docker build --no-cache \
133+
--build-arg USE_LOCAL_INSTALL=true \
134+
-t socketdev/cli:$VERSION-$TAG_SUFFIX \
135+
-t socketdev/cli:$TAG_SUFFIX .
136+
else
137+
docker build --no-cache \
138+
--build-arg CLI_VERSION=$VERSION \
139+
--build-arg PIP_INDEX_URL=$PIP_INDEX_URL \
140+
--build-arg PIP_EXTRA_INDEX_URL=$PIP_EXTRA_INDEX_URL \
141+
-t socketdev/cli:$VERSION-$TAG_SUFFIX \
142+
-t socketdev/cli:$TAG_SUFFIX .
143+
fi
128144
echo "Local build complete. Tagged as socketdev/cli:$VERSION-$TAG_SUFFIX and socketdev/cli:$TAG_SUFFIX"
129145
fi
130146

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.24'
2+
__version__ = '2.2.25'
33
USER_AGENT = f'SocketPythonCLI/{__version__}'

socketsecurity/socketcli.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,7 @@ def main_code():
251251
org_slug=org_slug,
252252
file_paths=manifest_files,
253253
workspace=config.repo or "default-workspace",
254-
base_path=None,
255-
base_paths=base_paths,
254+
base_paths=[config.target_path],
256255
use_lazy_loading=False
257256
)
258257
log.info(f"Manifest upload successful, tar hash: {tar_hash}")

0 commit comments

Comments
 (0)