FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix(lib): default 'agentex agents build' to --no-cache so stale layers can't ship stale source by deepthi-rao-scale · Pull Request #476 · scaleapi/scale-agentex-python · GitHub

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (2) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
8 changes: 8 additions & 0 deletions src/agentex/lib/cli/commands/agents.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,13 @@ def build(
None,
help="Docker build argument in the format 'KEY=VALUE' (can be used multiple times)",
),
cache: bool = typer.Option(
False,
"--cache/--no-cache",
help="Whether to use the build cache. Defaults to off so a stale cached layer "
"can't silently ship source that no longer matches the checkout (notably when "
"republishing a moving tag like ':latest'). Pass --cache to opt back in.",
),
):
"""
Build an agent image locally from the given manifest.
Expand Down Expand Up @@ -155,6 +162,7 @@ def build(
secret=secret or "", # Provide default empty string
tag=tag or "latest", # Provide default
build_args=build_arg or [], # Provide default empty list
cache=cache,
)
if image_url:
typer.echo(f"Successfully built image: {image_url}")
Expand Down
8 changes: 8 additions & 0 deletions src/agentex/lib/cli/handlers/agent_handlers.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def build_agent(
secret: str | None = None,
tag: str | None = None,
build_args: list[str] | None = None,
cache: bool = False,
) -> str:
"""Build the agent locally and optionally push to registry

Expand All @@ -49,6 +50,10 @@ def build_agent(
secret: Docker build secret in format 'id=secret-id,src=path-to-secret-file'
tag: Image tag to use (defaults to 'latest')
build_args: List of Docker build arguments in format 'KEY=VALUE'
cache: Whether to use the build cache. Defaults to False (passes --no-cache to
buildx) so a stale cached layer can't silently ship source that no longer
matches the checkout, notably when republishing a moving tag like ':latest'.
Pass True to opt back in for faster local rebuilds.

Returns:
The image URL
Expand Down Expand Up @@ -85,7 +90,10 @@ def build_agent(
"file": str(build_context.path / build_context.dockerfile_path), # type: ignore[operator]
"tags": [image_name],
"platforms": platforms,
"cache": cache, # cache=False -> `docker buildx build --no-cache`
}
if not cache:
logger.info("Build cache disabled (--no-cache)")

# Add Docker build args if provided
if build_args:
Expand Down
Loading

Back | FazBrowse Home | New Git URL