Skip to content

Commit 34f040a

Browse files
authored
Merge pull request #63 from agentic-labs/caching
Fix private repos
2 parents f351329 + a48c7cf commit 34f040a

2 files changed

Lines changed: 21 additions & 17 deletions

File tree

lsproxy/modal.py

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -81,20 +81,25 @@ def __init__(self, repo_url: str, git_token: str, sha: str, timeout: int, versio
8181
)
8282
url_parts = repo_url.split("://")
8383
lsproxy_image = modal.Image.from_registry(f"agenticlabs/lsproxy:{version}")
84-
lsproxy_image = lsproxy_image.run_commands(
85-
[
86-
"git config --global --add safe.directory /mnt/workspace",
87-
f"git clone --depth 1 {url_parts[0]}://x-access-token:$GITHUB_IAT@{url_parts[1]} /mnt/workspace"
88-
],
89-
secrets=[
90-
gh_secret
91-
], # sneaky, cache the layers (for the same sha) even as the token changes!
92-
)
9384
if sha:
94-
lsproxy_image = lsproxy_image.run_commands([
95-
f"cd /mnt/workspace && git fetch origin {sha}",
96-
f"cd /mnt/workspace && git checkout {sha}"
97-
]
85+
lsproxy_image = lsproxy_image.run_commands(
86+
[
87+
"git config --global --add safe.directory /mnt/workspace",
88+
f"git clone --depth 1 {url_parts[0]}://x-access-token:$GITHUB_IAT@{url_parts[1]} /mnt/workspace && cd /mnt/workspace && git fetch origin {sha} && git checkout {sha}",
89+
],
90+
secrets=[
91+
gh_secret
92+
], # sneaky, cache the layers (for the same sha) even as the token changes!
93+
)
94+
else:
95+
lsproxy_image = lsproxy_image.run_commands(
96+
[
97+
"git config --global --add safe.directory /mnt/workspace",
98+
f"git clone --depth 1 {url_parts[0]}://x-access-token:$GITHUB_IAT@{url_parts[1]} /mnt/workspace"
99+
],
100+
secrets=[
101+
gh_secret
102+
], # sneaky, cache the layers (for the same sha) even as the token changes!
98103
)
99104
else:
100105
lsproxy_image = modal.Image.from_registry(f"agenticlabs/lsproxy:{version}").run_commands(
@@ -116,9 +121,8 @@ def __init__(self, repo_url: str, git_token: str, sha: str, timeout: int, versio
116121

117122
print("Starting sandbox...")
118123

119-
with modal.enable_output():
120-
self.sandbox = modal.Sandbox.create(**sandbox_config)
121-
self.tunnel_url = self.sandbox.tunnels()[4444].url
124+
self.sandbox = modal.Sandbox.create(**sandbox_config)
125+
self.tunnel_url = self.sandbox.tunnels()[4444].url
122126

123127
# Start lsproxy
124128
p = self.sandbox.exec(f"lsproxy")

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "lsproxy-sdk"
3-
version = "0.2.2a1"
3+
version = "0.2.2"
44
description = "SDK for interacting with lsproxy container"
55
readme = "README.md"
66
requires-python = ">=3.10"

0 commit comments

Comments
 (0)