Skip to content

Commit c87b986

Browse files
feat(blueprints): Cleanup the BuildContext API (#6407)\n\nTest
1 parent 07a0b8c commit c87b986

9 files changed

Lines changed: 150 additions & 255 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 97
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-779f7a8b0be0c3d2d095c6256d35c5dbb4c28d049f3541384c51a8c215e8a87a.yml
3-
openapi_spec_hash: b4ebc80eeaf4e5b3bcd53c30433cf35e
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-5f33221208c1febba343daf570f73a5086f150a9b128df045ebddc3fe2c86607.yml
3+
openapi_spec_hash: 0aea07130ddbe43a665a13a68231e2ca
44
config_hash: 2363f563f42501d2b1587a4f64bdccaf

src/runloop_api_client/resources/blueprints.py

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -131,13 +131,13 @@ def create(
131131
base_blueprint_id: Optional[str] | Omit = omit,
132132
base_blueprint_name: Optional[str] | Omit = omit,
133133
build_args: Optional[Dict[str, str]] | Omit = omit,
134-
build_contexts: Optional[Dict[str, blueprint_create_params.BuildContexts]] | Omit = omit,
134+
build_context: Optional[blueprint_create_params.BuildContext] | Omit = omit,
135135
code_mounts: Optional[Iterable[CodeMountParameters]] | Omit = omit,
136136
dockerfile: Optional[str] | Omit = omit,
137137
file_mounts: Optional[Dict[str, str]] | Omit = omit,
138138
launch_parameters: Optional[LaunchParameters] | Omit = omit,
139-
local_build_context: Optional[blueprint_create_params.LocalBuildContext] | Omit = omit,
140139
metadata: Optional[Dict[str, str]] | Omit = omit,
140+
named_build_contexts: Optional[Dict[str, blueprint_create_params.NamedBuildContexts]] | Omit = omit,
141141
secrets: Optional[Dict[str, str]] | Omit = omit,
142142
services: Optional[Iterable[blueprint_create_params.Service]] | Omit = omit,
143143
system_setup_commands: Optional[SequenceNotStr[str]] | Omit = omit,
@@ -169,10 +169,7 @@ def create(
169169
170170
build_args: (Optional) Arbitrary Docker build args to pass during build.
171171
172-
build_contexts: (Optional) Map of named Docker build contexts. Keys are context names, values
173-
are typed context definitions (object or http). See Docker buildx additional
174-
contexts for details:
175-
https://docs.docker.com/reference/cli/docker/buildx/build/#build-context
172+
build_context: A build context backed by an Object.
176173
177174
code_mounts: A list of code mounts to be included in the Blueprint.
178175
@@ -182,10 +179,13 @@ def create(
182179
183180
launch_parameters: Parameters to configure your Devbox at launch time.
184181
185-
local_build_context: (Optional) Local build context stored in object-storage.
186-
187182
metadata: (Optional) User defined metadata for the Blueprint.
188183
184+
named_build_contexts: (Optional) Map of named build contexts to attach to the Blueprint build, where
185+
the keys are the name used when referencing the contexts in a Dockerfile. See
186+
Docker buildx additional contexts for details:
187+
https://docs.docker.com/reference/cli/docker/buildx/build/#build-context
188+
189189
secrets: (Optional) Map of mount IDs/environment variable names to secret names. Secrets
190190
will be available to commands during the build. Secrets are NOT stored in the
191191
blueprint image. Example: {"DB_PASS": "DATABASE_PASSWORD"} makes the secret
@@ -219,13 +219,13 @@ def create(
219219
"base_blueprint_id": base_blueprint_id,
220220
"base_blueprint_name": base_blueprint_name,
221221
"build_args": build_args,
222-
"build_contexts": build_contexts,
222+
"build_context": build_context,
223223
"code_mounts": code_mounts,
224224
"dockerfile": dockerfile,
225225
"file_mounts": file_mounts,
226226
"launch_parameters": launch_parameters,
227-
"local_build_context": local_build_context,
228227
"metadata": metadata,
228+
"named_build_contexts": named_build_contexts,
229229
"secrets": secrets,
230230
"services": services,
231231
"system_setup_commands": system_setup_commands,
@@ -649,13 +649,13 @@ def preview(
649649
base_blueprint_id: Optional[str] | Omit = omit,
650650
base_blueprint_name: Optional[str] | Omit = omit,
651651
build_args: Optional[Dict[str, str]] | Omit = omit,
652-
build_contexts: Optional[Dict[str, blueprint_preview_params.BuildContexts]] | Omit = omit,
652+
build_context: Optional[blueprint_preview_params.BuildContext] | Omit = omit,
653653
code_mounts: Optional[Iterable[CodeMountParameters]] | Omit = omit,
654654
dockerfile: Optional[str] | Omit = omit,
655655
file_mounts: Optional[Dict[str, str]] | Omit = omit,
656656
launch_parameters: Optional[LaunchParameters] | Omit = omit,
657-
local_build_context: Optional[blueprint_preview_params.LocalBuildContext] | Omit = omit,
658657
metadata: Optional[Dict[str, str]] | Omit = omit,
658+
named_build_contexts: Optional[Dict[str, blueprint_preview_params.NamedBuildContexts]] | Omit = omit,
659659
secrets: Optional[Dict[str, str]] | Omit = omit,
660660
services: Optional[Iterable[blueprint_preview_params.Service]] | Omit = omit,
661661
system_setup_commands: Optional[SequenceNotStr[str]] | Omit = omit,
@@ -685,10 +685,7 @@ def preview(
685685
686686
build_args: (Optional) Arbitrary Docker build args to pass during build.
687687
688-
build_contexts: (Optional) Map of named Docker build contexts. Keys are context names, values
689-
are typed context definitions (object or http). See Docker buildx additional
690-
contexts for details:
691-
https://docs.docker.com/reference/cli/docker/buildx/build/#build-context
688+
build_context: A build context backed by an Object.
692689
693690
code_mounts: A list of code mounts to be included in the Blueprint.
694691
@@ -698,10 +695,13 @@ def preview(
698695
699696
launch_parameters: Parameters to configure your Devbox at launch time.
700697
701-
local_build_context: (Optional) Local build context stored in object-storage.
702-
703698
metadata: (Optional) User defined metadata for the Blueprint.
704699
700+
named_build_contexts: (Optional) Map of named build contexts to attach to the Blueprint build, where
701+
the keys are the name used when referencing the contexts in a Dockerfile. See
702+
Docker buildx additional contexts for details:
703+
https://docs.docker.com/reference/cli/docker/buildx/build/#build-context
704+
705705
secrets: (Optional) Map of mount IDs/environment variable names to secret names. Secrets
706706
will be available to commands during the build. Secrets are NOT stored in the
707707
blueprint image. Example: {"DB_PASS": "DATABASE_PASSWORD"} makes the secret
@@ -731,13 +731,13 @@ def preview(
731731
"base_blueprint_id": base_blueprint_id,
732732
"base_blueprint_name": base_blueprint_name,
733733
"build_args": build_args,
734-
"build_contexts": build_contexts,
734+
"build_context": build_context,
735735
"code_mounts": code_mounts,
736736
"dockerfile": dockerfile,
737737
"file_mounts": file_mounts,
738738
"launch_parameters": launch_parameters,
739-
"local_build_context": local_build_context,
740739
"metadata": metadata,
740+
"named_build_contexts": named_build_contexts,
741741
"secrets": secrets,
742742
"services": services,
743743
"system_setup_commands": system_setup_commands,
@@ -782,13 +782,13 @@ async def create(
782782
base_blueprint_id: Optional[str] | Omit = omit,
783783
base_blueprint_name: Optional[str] | Omit = omit,
784784
build_args: Optional[Dict[str, str]] | Omit = omit,
785-
build_contexts: Optional[Dict[str, blueprint_create_params.BuildContexts]] | Omit = omit,
785+
build_context: Optional[blueprint_create_params.BuildContext] | Omit = omit,
786786
code_mounts: Optional[Iterable[CodeMountParameters]] | Omit = omit,
787787
dockerfile: Optional[str] | Omit = omit,
788788
file_mounts: Optional[Dict[str, str]] | Omit = omit,
789789
launch_parameters: Optional[LaunchParameters] | Omit = omit,
790-
local_build_context: Optional[blueprint_create_params.LocalBuildContext] | Omit = omit,
791790
metadata: Optional[Dict[str, str]] | Omit = omit,
791+
named_build_contexts: Optional[Dict[str, blueprint_create_params.NamedBuildContexts]] | Omit = omit,
792792
secrets: Optional[Dict[str, str]] | Omit = omit,
793793
services: Optional[Iterable[blueprint_create_params.Service]] | Omit = omit,
794794
system_setup_commands: Optional[SequenceNotStr[str]] | Omit = omit,
@@ -820,10 +820,7 @@ async def create(
820820
821821
build_args: (Optional) Arbitrary Docker build args to pass during build.
822822
823-
build_contexts: (Optional) Map of named Docker build contexts. Keys are context names, values
824-
are typed context definitions (object or http). See Docker buildx additional
825-
contexts for details:
826-
https://docs.docker.com/reference/cli/docker/buildx/build/#build-context
823+
build_context: A build context backed by an Object.
827824
828825
code_mounts: A list of code mounts to be included in the Blueprint.
829826
@@ -833,10 +830,13 @@ async def create(
833830
834831
launch_parameters: Parameters to configure your Devbox at launch time.
835832
836-
local_build_context: (Optional) Local build context stored in object-storage.
837-
838833
metadata: (Optional) User defined metadata for the Blueprint.
839834
835+
named_build_contexts: (Optional) Map of named build contexts to attach to the Blueprint build, where
836+
the keys are the name used when referencing the contexts in a Dockerfile. See
837+
Docker buildx additional contexts for details:
838+
https://docs.docker.com/reference/cli/docker/buildx/build/#build-context
839+
840840
secrets: (Optional) Map of mount IDs/environment variable names to secret names. Secrets
841841
will be available to commands during the build. Secrets are NOT stored in the
842842
blueprint image. Example: {"DB_PASS": "DATABASE_PASSWORD"} makes the secret
@@ -870,13 +870,13 @@ async def create(
870870
"base_blueprint_id": base_blueprint_id,
871871
"base_blueprint_name": base_blueprint_name,
872872
"build_args": build_args,
873-
"build_contexts": build_contexts,
873+
"build_context": build_context,
874874
"code_mounts": code_mounts,
875875
"dockerfile": dockerfile,
876876
"file_mounts": file_mounts,
877877
"launch_parameters": launch_parameters,
878-
"local_build_context": local_build_context,
879878
"metadata": metadata,
879+
"named_build_contexts": named_build_contexts,
880880
"secrets": secrets,
881881
"services": services,
882882
"system_setup_commands": system_setup_commands,
@@ -1300,13 +1300,13 @@ async def preview(
13001300
base_blueprint_id: Optional[str] | Omit = omit,
13011301
base_blueprint_name: Optional[str] | Omit = omit,
13021302
build_args: Optional[Dict[str, str]] | Omit = omit,
1303-
build_contexts: Optional[Dict[str, blueprint_preview_params.BuildContexts]] | Omit = omit,
1303+
build_context: Optional[blueprint_preview_params.BuildContext] | Omit = omit,
13041304
code_mounts: Optional[Iterable[CodeMountParameters]] | Omit = omit,
13051305
dockerfile: Optional[str] | Omit = omit,
13061306
file_mounts: Optional[Dict[str, str]] | Omit = omit,
13071307
launch_parameters: Optional[LaunchParameters] | Omit = omit,
1308-
local_build_context: Optional[blueprint_preview_params.LocalBuildContext] | Omit = omit,
13091308
metadata: Optional[Dict[str, str]] | Omit = omit,
1309+
named_build_contexts: Optional[Dict[str, blueprint_preview_params.NamedBuildContexts]] | Omit = omit,
13101310
secrets: Optional[Dict[str, str]] | Omit = omit,
13111311
services: Optional[Iterable[blueprint_preview_params.Service]] | Omit = omit,
13121312
system_setup_commands: Optional[SequenceNotStr[str]] | Omit = omit,
@@ -1336,10 +1336,7 @@ async def preview(
13361336
13371337
build_args: (Optional) Arbitrary Docker build args to pass during build.
13381338
1339-
build_contexts: (Optional) Map of named Docker build contexts. Keys are context names, values
1340-
are typed context definitions (object or http). See Docker buildx additional
1341-
contexts for details:
1342-
https://docs.docker.com/reference/cli/docker/buildx/build/#build-context
1339+
build_context: A build context backed by an Object.
13431340
13441341
code_mounts: A list of code mounts to be included in the Blueprint.
13451342
@@ -1349,10 +1346,13 @@ async def preview(
13491346
13501347
launch_parameters: Parameters to configure your Devbox at launch time.
13511348
1352-
local_build_context: (Optional) Local build context stored in object-storage.
1353-
13541349
metadata: (Optional) User defined metadata for the Blueprint.
13551350
1351+
named_build_contexts: (Optional) Map of named build contexts to attach to the Blueprint build, where
1352+
the keys are the name used when referencing the contexts in a Dockerfile. See
1353+
Docker buildx additional contexts for details:
1354+
https://docs.docker.com/reference/cli/docker/buildx/build/#build-context
1355+
13561356
secrets: (Optional) Map of mount IDs/environment variable names to secret names. Secrets
13571357
will be available to commands during the build. Secrets are NOT stored in the
13581358
blueprint image. Example: {"DB_PASS": "DATABASE_PASSWORD"} makes the secret
@@ -1382,13 +1382,13 @@ async def preview(
13821382
"base_blueprint_id": base_blueprint_id,
13831383
"base_blueprint_name": base_blueprint_name,
13841384
"build_args": build_args,
1385-
"build_contexts": build_contexts,
1385+
"build_context": build_context,
13861386
"code_mounts": code_mounts,
13871387
"dockerfile": dockerfile,
13881388
"file_mounts": file_mounts,
13891389
"launch_parameters": launch_parameters,
1390-
"local_build_context": local_build_context,
13911390
"metadata": metadata,
1391+
"named_build_contexts": named_build_contexts,
13921392
"secrets": secrets,
13931393
"services": services,
13941394
"system_setup_commands": system_setup_commands,

src/runloop_api_client/types/agent_view.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ class AgentView(BaseModel):
1212
id: str
1313
"""The unique identifier of the Agent."""
1414

15+
create_time_ms: int
16+
"""The creation time of the Agent (Unix timestamp milliseconds)."""
17+
1518
is_public: bool
1619
"""Whether the Agent is publicly accessible."""
1720

src/runloop_api_client/types/blueprint_build_parameters.py

Lines changed: 17 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -7,59 +7,21 @@
77
from .shared.launch_parameters import LaunchParameters
88
from .shared.code_mount_parameters import CodeMountParameters
99

10-
__all__ = [
11-
"BlueprintBuildParameters",
12-
"BuildContexts",
13-
"BuildContextsHTTP",
14-
"BuildContextsObject",
15-
"LocalBuildContext",
16-
"LocalBuildContextHTTP",
17-
"LocalBuildContextObject",
18-
"Service",
19-
"ServiceCredentials",
20-
]
10+
__all__ = ["BlueprintBuildParameters", "BuildContext", "NamedBuildContexts", "Service", "ServiceCredentials"]
2111

2212

23-
class BuildContextsHTTP(BaseModel):
24-
url: str
25-
"""HTTP(S) URL to a tarball or directory to use as context."""
26-
27-
28-
class BuildContextsObject(BaseModel):
13+
class BuildContext(BaseModel):
2914
object_id: str
30-
"""Handle for a Runloop stored object to use as context."""
31-
32-
33-
class BuildContexts(BaseModel):
34-
type: Literal["OBJECT", "HTTP"]
35-
"""Type of the context. Supported values: object, http"""
36-
37-
http: Optional[BuildContextsHTTP] = None
38-
"""HTTP(S) context parameters."""
15+
"""The ID of an object, whose contents are to be used as a build context."""
3916

40-
object: Optional[BuildContextsObject] = None
41-
"""Object context parameters (named build context)."""
17+
type: Literal["object"]
4218

4319

44-
class LocalBuildContextHTTP(BaseModel):
45-
url: str
46-
"""HTTP(S) URL to a tarball or directory to use as context."""
47-
48-
49-
class LocalBuildContextObject(BaseModel):
20+
class NamedBuildContexts(BaseModel):
5021
object_id: str
51-
"""Handle for a Runloop stored object to use as context."""
52-
53-
54-
class LocalBuildContext(BaseModel):
55-
type: Literal["OBJECT", "HTTP"]
56-
"""Type of the context. Supported values: object, http"""
22+
"""The ID of an object, whose contents are to be used as a build context."""
5723

58-
http: Optional[LocalBuildContextHTTP] = None
59-
"""HTTP(S) context parameters."""
60-
61-
object: Optional[LocalBuildContextObject] = None
62-
"""Object context parameters (named build context)."""
24+
type: Literal["object"]
6325

6426

6527
class ServiceCredentials(BaseModel):
@@ -114,13 +76,8 @@ class BlueprintBuildParameters(BaseModel):
11476
build_args: Optional[Dict[str, str]] = None
11577
"""(Optional) Arbitrary Docker build args to pass during build."""
11678

117-
build_contexts: Optional[Dict[str, BuildContexts]] = None
118-
"""(Optional) Map of named Docker build contexts.
119-
120-
Keys are context names, values are typed context definitions (object or http).
121-
See Docker buildx additional contexts for details:
122-
https://docs.docker.com/reference/cli/docker/buildx/build/#build-context
123-
"""
79+
build_context: Optional[BuildContext] = None
80+
"""A build context backed by an Object."""
12481

12582
code_mounts: Optional[List[CodeMountParameters]] = None
12683
"""A list of code mounts to be included in the Blueprint."""
@@ -134,12 +91,17 @@ class BlueprintBuildParameters(BaseModel):
13491
launch_parameters: Optional[LaunchParameters] = None
13592
"""Parameters to configure your Devbox at launch time."""
13693

137-
local_build_context: Optional[LocalBuildContext] = None
138-
"""(Optional) Local build context stored in object-storage."""
139-
14094
metadata: Optional[Dict[str, str]] = None
14195
"""(Optional) User defined metadata for the Blueprint."""
14296

97+
named_build_contexts: Optional[Dict[str, NamedBuildContexts]] = None
98+
"""
99+
(Optional) Map of named build contexts to attach to the Blueprint build, where
100+
the keys are the name used when referencing the contexts in a Dockerfile. See
101+
Docker buildx additional contexts for details:
102+
https://docs.docker.com/reference/cli/docker/buildx/build/#build-context
103+
"""
104+
143105
secrets: Optional[Dict[str, str]] = None
144106
"""(Optional) Map of mount IDs/environment variable names to secret names.
145107

0 commit comments

Comments
 (0)