Skip to content

Commit b9f40bb

Browse files
authored
feat(sandboxes): expose custom deployments and build logs (#388)
* feat(sandboxes): expose custom source deployments and build logs Keep the existing Project.plan response compatibility values FREE and PRO in the consumer snapshot while syncing the new producer operations. Preserve existing rollout tests. * fix(sandboxes): remove multipart schema memory default * fix(sandboxes): accept canonical regions in deployment logs * test(sandboxes): cover deployment boundaries and align service credentials * fix(sandboxes): expose deployment history page limits * fix(openapi): match sandbox deployment credentials to runtime * fix(sandboxes): preserve typed errors and validate deployment ports * fix: reject non-integer sandbox deployment ports
1 parent 9fc22a6 commit b9f40bb

165 files changed

Lines changed: 22547 additions & 8653 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎docs/sandboxes.md‎

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,3 +114,42 @@ that management scope for reads, commands, files, and HTTP access, even if the
114114
client signs in or switches users. Handles returned by `get()` use the current
115115
signed-in user's grant when available. Public preset discovery requires no
116116
service key or signed-in session.
117+
118+
## Custom image deployments
119+
120+
Upload a tar.gz source archive containing a root Dockerfile fragment. Volcano
121+
supplies the base image; use `RUN`, `COPY`, and `CMD` without `FROM`, `USER`, or
122+
`ENTRYPOINT`.
123+
124+
```python
125+
from pathlib import Path
126+
from uuid import uuid4
127+
128+
sandbox_id = str(uuid4())
129+
request_id = str(uuid4())
130+
deployment = client.sandboxes.deploy(
131+
project_id,
132+
sandbox_id,
133+
Path("source.tar.gz").read_bytes(),
134+
name="custom-image",
135+
memory_mb=1024,
136+
ports=[8080],
137+
request_id=request_id,
138+
)
139+
state = client.sandboxes.deployment(project_id, sandbox_id, deployment.id)
140+
```
141+
142+
Retain both IDs, the source bytes, and build options when retrying a request.
143+
Wait for status `active` before creating sessions with this `sandbox_id`.
144+
Redeploy with the same template ID and a new request ID to update the image;
145+
existing sessions retain their original image.
146+
147+
`deployments(project_id, sandbox_id, cursor=..., limit=10)` returns history and a
148+
`next_cursor`. `source(project_id, sandbox_id, deployment_id)` returns the
149+
original archive bytes. `logs(project_id, sandbox_id, deployment_id,
150+
region="aws-us-east-1", cursor=..., limit=100)` returns regional build messages.
151+
`delete_template(project_id, sandbox_id)` deletes the template and terminates
152+
its sessions and requires the `sandboxes.terminate` permission. History page
153+
limits range from 1 to 100. Archives are limited to 32 MiB compressed and expanded.
154+
155+
Custom deployments accept at most 16 unique ports, from 1 through 65532.

‎maintainers/typed-boundaries.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,8 @@ CI retains the Python 3.11–3.14 check names and selects exact patch versions
3535
listed by the native [setup-python manifest](https://github.com/actions/python-versions/blob/main/versions-manifest.json).
3636
`UV_PYTHON` selects each matrix interpreter; `.python-version` pins the local
3737
3.12 environment. The isolated coverage command pins the same 3.12 patch.
38+
39+
The `ProjectPlan` literal-enum template retains the legacy response values
40+
`FREE` and `PRO` for earlier Hosting releases. This compatibility applies only
41+
to the response-only `Project.plan` model; the vendored producer contract and
42+
all other enum constraints stay unchanged.

‎openapi-python-client.yaml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ post_hooks:
88
- ruff check --isolated --no-cache --preview --select W291,W293,W391 --fix --unsafe-fixes api/sandboxes models/*sandbox*.py
99
# Parse binary bodies without changing their wire Content-Type.
1010
content_type_overrides:
11+
application/gzip: application/octet-stream
1112
application/yaml: application/octet-stream
1213
image/png: application/octet-stream
1314
image/jpeg: application/octet-stream

0 commit comments

Comments
 (0)