Skip to content

Commit 9795b66

Browse files
author
Roxanne Farhad
committed
integrating the real polling wf
1 parent e1fc485 commit 9795b66

1 file changed

Lines changed: 78 additions & 48 deletions

File tree

.github/workflows/integration-tests.yml

Lines changed: 78 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -35,52 +35,58 @@ jobs:
3535
username: ${{ github.repository_owner }}
3636
password: ${{ secrets.GITHUB_TOKEN }}
3737

38-
# - name: Generate GitHub App Token
39-
# id: generate-token
40-
# uses: actions/create-github-app-token@v1
41-
# with:
42-
# app-id: ${{ secrets.GITHUB_APP_ID }}
43-
# private-key: ${{ secrets.GITHUB_APP_PRIVATE_KEY }}
44-
# owner: scaleapi
45-
4638
- name: Discover tutorial agent images
4739
id: discover
48-
# env:
49-
# GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.PACKAGE_TOKEN }}
42+
5043
run: |
51-
echo "🔍 Building agent matrix from known tutorial agent images..."
52-
53-
# Define the list of known tutorial agent packages
54-
PACKAGES=(
55-
"scale-agentex-python/tutorial-agents/00_sync-000_hello_acp"
56-
"scale-agentex-python/tutorial-agents/00_sync-010_multiturn"
57-
"scale-agentex-python/tutorial-agents/00_sync-020_streaming"
58-
"scale-agentex-python/tutorial-agents/10_async-00_base-000_hello_acp"
59-
"scale-agentex-python/tutorial-agents/10_async-00_base-010_multiturn"
60-
"scale-agentex-python/tutorial-agents/10_async-00_base-020_streaming"
61-
"scale-agentex-python/tutorial-agents/10_async-00_base-030_tracing"
62-
"scale-agentex-python/tutorial-agents/10_async-00_base-040_other_sdks"
63-
"scale-agentex-python/tutorial-agents/10_async-00_base-080_batch_events"
64-
"scale-agentex-python/tutorial-agents/10_async-10_temporal-000_hello_acp"
65-
"scale-agentex-python/tutorial-agents/10_async-10_temporal-010_agent_chat"
66-
"scale-agentex-python/tutorial-agents/10_async-10_temporal-020_state_machine"
67-
"scale-agentex-python/tutorial-agents/10_async-10_temporal-030_custom_activities"
68-
"scale-agentex-python/tutorial-agents/10_async-10_temporal-050_agent_chat_guardrails"
69-
"scale-agentex-python/tutorial-agents/10_async-10_temporal-060_open_ai_agents_sdk_hello_world"
70-
"scale-agentex-python/tutorial-agents/10_async-10_temporal-070_open_ai_agents_sdk_tools"
71-
"scale-agentex-python/tutorial-agents/10_async-10_temporal-080_open_ai_agents_sdk_human_in_the_loop"
72-
"scale-agentex-python/tutorial-agents/10_async-10_temporal-090_claude_agents_sdk_mvp"
73-
)
74-
75-
# Build agent matrix from the package list
44+
echo "🔍 Discovering tutorial agent images from GitHub Packages API..."
45+
46+
# Query GitHub API for container packages in the scaleapi org
47+
API_RESPONSE=$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \
48+
-H "Accept: application/vnd.github+json" \
49+
"https://api.github.com/orgs/scaleapi/packages?package_type=container&per_page=100")
50+
51+
# Check if response is an error
52+
if echo "$API_RESPONSE" | jq -e '.message' > /dev/null 2>&1; then
53+
echo "❌ GitHub API error:"
54+
echo "$API_RESPONSE" | jq '.'
55+
exit 1
56+
fi
57+
58+
# Check if response is an array
59+
if ! echo "$API_RESPONSE" | jq -e 'type == "array"' > /dev/null 2>&1; then
60+
echo "❌ Unexpected API response format:"
61+
echo "$API_RESPONSE" | head -c 500
62+
exit 1
63+
fi
64+
65+
# Filter for: public packages, from scale-agentex-python repo, with tutorial-agents in the name, excluding deprecated agentic agents
66+
# TODO: Remove the "agentic" exclusion filter once we have delete:packages permissions to clean up deprecated packages
67+
PACKAGES=$(echo "$API_RESPONSE" | \
68+
jq -r '[.[] | select(.visibility == "public" and .repository.name == "scale-agentex-python" and (.name | contains("tutorial-agents")) and (.name | contains("agentic") | not))] | .[].name')
69+
70+
if [ -z "$PACKAGES" ]; then
71+
echo "❌ No tutorial agent packages found"
72+
echo "📋 Available packages in response:"
73+
echo "$API_RESPONSE" | jq -r '.[].name' | head -20
74+
exit 1
75+
fi
76+
77+
echo "📦 Found packages:"
78+
echo "$PACKAGES"
79+
80+
# Build agent matrix from discovered packages
7681
AGENT_IMAGES="["
7782
78-
for package_name in "${PACKAGES[@]}"; do
83+
while IFS= read -r package_name; do
84+
[ -z "$package_name" ] && continue
7985
echo "Processing package: $package_name"
8086
81-
# Extract agent directory name and convert to agent name format (e.g., "000-hello-acp")
82-
# Pattern: [digits]_[type]-[digits]_[rest] -> [digits]-[rest]
83-
agent_name=$(basename "$package_name" | sed -E 's/^[0-9]+_[^-]+-([0-9]+)_(.*)$/\1-\2/' | tr '_' '-')
87+
# Extract everything after "tutorial-agents/" and convert underscores to dashes
88+
# e.g., "scale-agentex-python/tutorial-agents/10_async-00_base-000_hello_acp" -> "10-async-00-base-000-hello-acp"
89+
agent_name=$(echo "$package_name" | sed 's|.*/tutorial-agents/||' | tr '_' '-')
8490
echo " - Agent name: $agent_name"
8591
8692
# Add to JSON array
@@ -89,7 +95,7 @@ jobs:
8995
fi
9096
9197
AGENT_IMAGES+='{"image":"ghcr.io/scaleapi/'"$package_name"':latest","agent_name":"'"$agent_name"'"}'
92-
done
98+
done <<< "$PACKAGES"
9399
94100
AGENT_IMAGES+="]"
95101
@@ -179,7 +185,8 @@ jobs:
179185
# Set variables for this agent
180186
AGENT_NAME="${{ matrix.agent.agent_name }}"
181187
AGENT_IMAGE="${{ matrix.agent.image }}"
182-
CONTAINER_NAME="agent-test-${AGENT_NAME}"
188+
# Truncate container name to max 63 chars for DNS compatibility
189+
CONTAINER_NAME="$(echo "${AGENT_NAME}" | cut -c1-63)"
183190
184191
echo "🧪 Running integration test for agent: ${AGENT_NAME}"
185192
echo "🐳 Using image: ${AGENT_IMAGE}"
@@ -296,25 +303,48 @@ jobs:
296303
exit 1
297304
fi
298305
299-
echo "🔍 Waiting for agent registration with AgentEx..."
300-
REGISTRATION_TIMEOUT=30
306+
echo "🔍 Waiting for agent to successfully register (checking container logs)..."
307+
REGISTRATION_TIMEOUT=60
301308
REGISTRATION_ELAPSED=0
302309
303310
while [ $REGISTRATION_ELAPSED -lt $REGISTRATION_TIMEOUT ]; do
304-
if curl -s http://localhost:5003/agents | grep -q "${AGENT_NAME}"; then
305-
echo "✅ Agent registered successfully"
311+
# Check for successful registration message in agent logs
312+
if docker logs "${CONTAINER_NAME}" 2>&1 | grep -q "Successfully registered agent"; then
313+
echo "✅ Agent successfully registered (confirmed from container logs)"
306314
break
307315
fi
308-
echo "⏳ Waiting for registration... (${REGISTRATION_ELAPSED}s/${REGISTRATION_TIMEOUT}s)"
309-
sleep 5
310-
REGISTRATION_ELAPSED=$((REGISTRATION_ELAPSED + 5))
316+
echo "⏳ Waiting for successful registration... (${REGISTRATION_ELAPSED}s/${REGISTRATION_TIMEOUT}s)"
317+
sleep 2
318+
REGISTRATION_ELAPSED=$((REGISTRATION_ELAPSED + 2))
311319
done
312320
313321
if [ $REGISTRATION_ELAPSED -ge $REGISTRATION_TIMEOUT ]; then
314322
echo "❌ Agent registration timeout after ${REGISTRATION_TIMEOUT}s"
323+
echo "📋 Container logs:"
324+
docker logs "${CONTAINER_NAME}"
315325
exit 1
316326
fi
317327
328+
# Verify agent is visible in AgentEx API
329+
echo "🔍 Verifying agent is listed in AgentEx..."
330+
if ! curl -s http://localhost:5003/agents | grep -q "${AGENT_NAME}"; then
331+
echo "⚠️ Agent not found in AgentEx API yet, continuing anyway..."
332+
fi
333+
334+
# Wait for Temporal worker to be fully ready
335+
echo "⏳ Waiting for Temporal worker to start processing..."
336+
WORKER_TIMEOUT=30
337+
WORKER_ELAPSED=0
338+
339+
while [ $WORKER_ELAPSED -lt $WORKER_TIMEOUT ]; do
340+
if docker logs "${CONTAINER_NAME}" 2>&1 | grep -q "Running workers for task queue"; then
341+
echo "✅ Temporal worker is running"
342+
break
343+
fi
344+
echo "⏳ Waiting for worker... (${WORKER_ELAPSED}s/${WORKER_TIMEOUT}s)"
345+
sleep 2
346+
WORKER_ELAPSED=$((WORKER_ELAPSED + 2))
347+
done
318348
319349
# Run the test inside the container with retry logic for resilience
320350
echo "🧪 Running tests inside the agent container with retry logic..."

0 commit comments

Comments
 (0)