Skip to content

Commit

Permalink
Add boostrap cli flag for create/inspect
Browse files Browse the repository at this point in the history
Fix spaces
  • Loading branch information
fizzgig1888 committed Jun 2, 2024
1 parent d09f324 commit b1ae92f
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion python_on_whales/components/buildx/cli_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,7 @@ def _method_to_get_image(self, builder: Optional[str]) -> GetImageMethod:
def create(
self,
context_or_endpoint: Optional[str] = None,
bootstrap: bool = False,
buildkitd_flags: Optional[str] = None,
config: Optional[ValidPath] = None,
platforms: Optional[List[str]] = None,
Expand All @@ -466,6 +467,7 @@ def create(
Parameters:
context_or_endpoint:
bootstrap: Boot builder after creation
buildkitd_flags: Flags for buildkitd daemon
config: BuildKit config file
platforms: Comma-separated list of platforms of the form OS/architecture/variant. Ex:
Expand All @@ -481,6 +483,7 @@ def create(
"""
full_cmd = self.docker_cmd + ["buildx", "create"]

full_cmd.add_flag("--bootstrap", bootstrap)
full_cmd.add_simple_arg("--buildkitd-flags", buildkitd_flags)
full_cmd.add_simple_arg("--config", config)
if platforms is not None:
Expand All @@ -501,16 +504,25 @@ def disk_usage(self):
"""Not yet implemented"""
raise NotImplementedError

def inspect(self, x: Optional[str] = None) -> Builder:
def inspect(
self,
x: Optional[str] = None,
bootstrap: Optional[bool] = False,
) -> Builder:
"""Returns a builder instance from the name.
Parameters:
x: If `None` (the default), returns the current builder. If a string is provided,
the builder that has this name is returned.
bootstrap: If set to True, ensure builder has booted before inspecting.
# Returns
A `python_on_whales.Builder` object.
"""
if bootstrap:
full_cmd = self.docker_cmd + ["buildx", "inspect"]
full_cmd.add_flag("--bootstrap", bootstrap)
run(full_cmd)
return Builder(self.client_config, x, is_immutable_id=False)

def list(self) -> List[Builder]:
Expand Down

0 comments on commit b1ae92f

Please sign in to comment.