Skip to content

Commit d796596

Browse files
fix(ci): push tutorial images from buildx instead of re-pushing a stale local tag
The publish path built a multi-platform image without --push, then a separate 'docker push' step shipped ':latest'. But a multi-arch buildx build can't be loaded into the local Docker image store, so no fresh local ':latest' exists; the preceding validation step's 'docker run' pulls the *existing* (stale) ':latest' from ghcr, and 'docker push' then re-pushes that same stale image. Result: ':latest' has been frozen at a Dec-2025 build, re-pushed unchanged on every run, which is why the 020_state_machine agent's mcp<2 pin never reached the published image and the scale-agentex integration test kept failing. Fix: on the publish path, pass --push to 'agentex agents build' so buildx sends the freshly-built multi-arch image straight to the registry, and drop the now-redundant separate 'docker push' step. Validation still runs and now exercises the freshly-pushed image. Also revert the CLI build cache default back to True (keep the --cache/--no-cache flag): the staleness was never a layer-cache problem, so forcing --no-cache globally only slowed builds without fixing anything. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent c0566d9 commit d796596

3 files changed

Lines changed: 14 additions & 18 deletions

File tree

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,16 @@ jobs:
196196
echo "SKIP_VALIDATION=true" >> $GITHUB_ENV
197197
fi
198198
199-
# Always build locally first (without push)
199+
# Build the image. On the publish path, push straight from buildx.
200+
# A multi-platform build cannot be loaded into the local Docker image
201+
# store, so a subsequent `docker push` has no freshly-built image to send
202+
# and ends up re-pushing whatever :latest was pulled during validation —
203+
# i.e. the previous, stale image. Pushing from the build itself is the
204+
# only way the newly-built multi-arch image actually lands on the tag.
200205
BUILD_ARGS="--manifest ${{ matrix.agent_path }}/manifest.yaml --registry ${REGISTRY} --tag ${VERSION_TAG} --platforms linux/amd64,linux/arm64 --repository-name ${REPOSITORY_NAME}"
206+
if [ "$SHOULD_PUSH" = "true" ]; then
207+
BUILD_ARGS="$BUILD_ARGS --push"
208+
fi
201209
202210
agentex agents build $BUILD_ARGS
203211
echo "✅ Successfully built: ${REGISTRY}/${REPOSITORY_NAME}:${VERSION_TAG}"
@@ -279,14 +287,6 @@ jobs:
279287
280288
echo "✅ All validations passed for: $FULL_IMAGE"
281289
282-
- name: Push Agent Image
283-
if: env.SHOULD_PUSH == 'true'
284-
run: |
285-
FULL_IMAGE="${{ env.FULL_IMAGE }}"
286-
echo "🚀 Pushing validated image: $FULL_IMAGE"
287-
docker push "$FULL_IMAGE"
288-
echo "✅ Successfully pushed: $FULL_IMAGE"
289-
290290
deprecate-agents:
291291
name: "Deprecate Removed Agents"
292292
runs-on: ubuntu-latest

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,9 @@ def build(
128128
help="Docker build argument in the format 'KEY=VALUE' (can be used multiple times)",
129129
),
130130
cache: bool = typer.Option(
131-
False,
131+
True,
132132
"--cache/--no-cache",
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.",
133+
help="Whether to use the build cache (default on). Pass --no-cache for a clean rebuild.",
136134
),
137135
):
138136
"""

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

Lines changed: 3 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 = False,
42+
cache: bool = True,
4343
) -> str:
4444
"""Build the agent locally and optionally push to registry
4545
@@ -50,10 +50,8 @@ 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 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.
53+
cache: Whether to use the build cache. Defaults to True. Set to False to pass
54+
--no-cache to buildx for a clean rebuild.
5755
5856
Returns:
5957
The image URL

0 commit comments

Comments
 (0)