Skip to content

Commit e3cfbe0

Browse files
committed
fix validation
1 parent c29afd0 commit e3cfbe0

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

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

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -168,15 +168,13 @@ jobs:
168168
echo "Agent name set to $AGENT_NAME"
169169
170170
- name: Login to GitHub Container Registry
171-
# Only login if we're going to push (main branch or rebuild_all)
172-
if: ${{ github.event_name == 'push' || inputs.rebuild_all }}
173171
uses: docker/login-action@v3
174172
with:
175173
registry: ghcr.io
176174
username: ${{ github.actor }}
177175
password: ${{ secrets.GITHUB_TOKEN }}
178176

179-
- name: Build and Conditionally Push Agent Image
177+
- name: Build Agent Image
180178
env:
181179
REGISTRY: ghcr.io
182180
run: |
@@ -187,27 +185,22 @@ jobs:
187185
if [ "${{ github.event_name }}" = "push" ] || [ "${{ inputs.rebuild_all }}" = "true" ]; then
188186
SHOULD_PUSH=true
189187
VERSION_TAG="latest"
190-
echo "🚀 Building and pushing agent: ${{ matrix.agent_path }}"
188+
echo "🚀 Building agent (will push after validation): ${{ matrix.agent_path }}"
191189
else
192190
SHOULD_PUSH=false
193191
VERSION_TAG="${{ github.sha }}"
194-
echo "🔍 Validating build for agent: ${{ matrix.agent_path }}"
192+
echo "🔍 Building agent for validation: ${{ matrix.agent_path }}"
195193
fi
196194
197-
# Build command - add --push only if we should push
195+
# Always build locally first (without push)
198196
BUILD_ARGS="--manifest ${{ matrix.agent_path }}/manifest.yaml --registry ${REGISTRY} --tag ${VERSION_TAG} --platforms linux/amd64,linux/arm64 --repository-name ${REPOSITORY_NAME}"
199197
200-
if [ "$SHOULD_PUSH" = "true" ]; then
201-
agentex agents build $BUILD_ARGS --push
202-
echo "✅ Successfully built and pushed: ${REGISTRY}/${REPOSITORY_NAME}:${VERSION_TAG}"
203-
# Set full image name for validation step
204-
echo "FULL_IMAGE=${REGISTRY}/${REPOSITORY_NAME}:${VERSION_TAG}" >> $GITHUB_ENV
205-
else
206-
agentex agents build $BUILD_ARGS
207-
echo "✅ Build validation successful for: ${{ matrix.agent_path }}"
208-
# Set full image name for validation step (local build)
209-
echo "FULL_IMAGE=${REGISTRY}/${REPOSITORY_NAME}:${VERSION_TAG}" >> $GITHUB_ENV
210-
fi
198+
agentex agents build $BUILD_ARGS --load
199+
echo "✅ Successfully built: ${REGISTRY}/${REPOSITORY_NAME}:${VERSION_TAG}"
200+
201+
# Set environment variables for subsequent steps
202+
echo "FULL_IMAGE=${REGISTRY}/${REPOSITORY_NAME}:${VERSION_TAG}" >> $GITHUB_ENV
203+
echo "SHOULD_PUSH=${SHOULD_PUSH}" >> $GITHUB_ENV
211204
212205
- name: Validate agent image
213206
run: |
@@ -281,6 +274,14 @@ jobs:
281274
282275
echo "✅ All validations passed for: $FULL_IMAGE"
283276
277+
- name: Push Agent Image
278+
if: env.SHOULD_PUSH == 'true'
279+
run: |
280+
FULL_IMAGE="${{ env.FULL_IMAGE }}"
281+
echo "🚀 Pushing validated image: $FULL_IMAGE"
282+
docker push "$FULL_IMAGE"
283+
echo "✅ Successfully pushed: $FULL_IMAGE"
284+
284285
deprecate-agents:
285286
name: "Deprecate Removed Agents"
286287
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)