Skip to content

Commit 951e7dc

Browse files
make no-cache the default and drop the workflow flag
Default 'agentex agents build' to --no-cache instead of forcing it in the publish workflow. A bare 'agentex agents build' is now cache-free, so the build-and-push workflow needs no change and the diff shrinks to the CLI. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 459ddac commit 951e7dc

3 files changed

Lines changed: 11 additions & 12 deletions

File tree

.github/workflows/build-and-push-tutorial-agent.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,8 @@ jobs:
196196
echo "SKIP_VALIDATION=true" >> $GITHUB_ENV
197197
fi
198198
199-
# Always build without cache: a stale cached layer must never silently ship
200-
# source that differs from the checkout (this is how a merged fix once failed
201-
# to reach ':latest'). Correctness over a few minutes of build time.
202-
BUILD_ARGS="--manifest ${{ matrix.agent_path }}/manifest.yaml --registry ${REGISTRY} --tag ${VERSION_TAG} --platforms linux/amd64,linux/arm64 --repository-name ${REPOSITORY_NAME} --no-cache"
199+
# Always build locally first (without push)
200+
BUILD_ARGS="--manifest ${{ matrix.agent_path }}/manifest.yaml --registry ${REGISTRY} --tag ${VERSION_TAG} --platforms linux/amd64,linux/arm64 --repository-name ${REPOSITORY_NAME}"
203201
204202
agentex agents build $BUILD_ARGS
205203
echo "✅ Successfully built: ${REGISTRY}/${REPOSITORY_NAME}:${VERSION_TAG}"

src/agentex/lib/cli/commands/agents.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,11 @@ def build(
128128
help="Docker build argument in the format 'KEY=VALUE' (can be used multiple times)",
129129
),
130130
cache: bool = typer.Option(
131-
True,
131+
False,
132132
"--cache/--no-cache",
133-
help="Use the build cache (default). Pass --no-cache when republishing a moving "
134-
"tag like ':latest' so a stale cached layer can't ship outdated source.",
133+
help="Whether to use the build cache. Defaults to off so a stale cached layer "
134+
"can't silently ship source that no longer matches the checkout (notably when "
135+
"republishing a moving tag like ':latest'). Pass --cache to opt back in.",
135136
),
136137
):
137138
"""

src/agentex/lib/cli/handlers/agent_handlers.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def build_agent(
3939
secret: str | None = None,
4040
tag: str | None = None,
4141
build_args: list[str] | None = None,
42-
cache: bool = True,
42+
cache: bool = False,
4343
) -> str:
4444
"""Build the agent locally and optionally push to registry
4545
@@ -50,10 +50,10 @@ def build_agent(
5050
secret: Docker build secret in format 'id=secret-id,src=path-to-secret-file'
5151
tag: Image tag to use (defaults to 'latest')
5252
build_args: List of Docker build arguments in format 'KEY=VALUE'
53-
cache: Whether to use the build cache. Defaults to True. Set to False (passes
54-
--no-cache to buildx) when republishing a moving tag like ':latest' so a
55-
stale cached layer can't silently ship source that no longer matches the
56-
checkout.
53+
cache: Whether to use the build cache. Defaults to False (passes --no-cache to
54+
buildx) so a stale cached layer can't silently ship source that no longer
55+
matches the checkout, notably when republishing a moving tag like ':latest'.
56+
Pass True to opt back in for faster local rebuilds.
5757
5858
Returns:
5959
The image URL

0 commit comments

Comments
 (0)