Skip to content

More WIP

More WIP #6

name: Cloud Deployment Example Test
on:
# Handle all branches for now
push:
pull_request:
workflow_dispatch:
jobs:
cloud-deployment-test:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
cache: 'maven'
- name: Setup Minikube
uses: medyagh/setup-minikube@latest
with:
cpus: 4
memory: 8192
kubernetes-version: 'v1.28.0'
driver: docker
start-args: '--wait=all'
- name: Verify Minikube
run: |
minikube status
kubectl get nodes
kubectl version --client
- name: Build Project
run: |
mvn clean install -DskipTests -B -V
echo "Project built successfully"
- name: Deploy Stack
run: |
cd examples/cloud-deployment/scripts
./deploy.sh --container-tool docker
- name: Setup Port Forward
run: |
kubectl port-forward -n a2a-demo svc/a2a-agent-service 8080:8080 &
PF_PID=$!
echo "PF_PID=$PF_PID" >> $GITHUB_ENV
# Wait for port-forward to be ready
echo "Waiting for port-forward to be ready..."
for i in {1..30}; do
if curl -s http://localhost:8080/health/ready > /dev/null 2>&1; then
echo "Port-forward is ready"
break
fi
if [ $i -eq 30 ]; then
echo "ERROR: Port-forward failed to become ready"
exit 1
fi
sleep 2
done
- name: Test Agent Endpoint
run: |
echo "Testing agent card endpoint..."
curl -f http://localhost:8080/a2a/agent-card | jq .
echo "Testing health endpoints..."
curl -f http://localhost:8080/health/live
curl -f http://localhost:8080/health/ready
- name: Run Integration Test
run: |
cd examples/cloud-deployment/server
timeout 120 mvn test-compile exec:java -Dexec.mainClass="io.a2a.examples.cloud.A2ACloudExampleClient" -Dagent.url=http://localhost:8080
env:
MAVEN_OPTS: "-Xmx1024m"
- name: Collect Logs
if: always()
run: |
mkdir -p logs
echo "=== Collecting Agent Pod Logs ==="
kubectl logs -n a2a-demo -l app=a2a-agent --all-containers --tail=500 > logs/agent-pods.log 2>&1 || echo "Failed to collect agent logs"
echo "=== Collecting PostgreSQL Logs ==="
kubectl logs -n a2a-demo -l app=postgres --tail=200 > logs/postgres.log 2>&1 || echo "Failed to collect postgres logs"
echo "=== Collecting Kafka Logs ==="
kubectl logs -n a2a-demo -l strimzi.io/cluster=a2a-kafka --tail=200 > logs/kafka.log 2>&1 || echo "Failed to collect kafka logs"
echo "=== Collecting Strimzi Operator Logs ==="
kubectl logs -n kafka -l name=strimzi-cluster-operator --tail=200 > logs/strimzi-operator.log 2>&1 || echo "Failed to collect strimzi logs"
echo "=== Collecting Pod Status ==="
kubectl get pods -n a2a-demo -o wide > logs/pod-status.txt 2>&1 || echo "Failed to collect pod status"
kubectl describe pods -n a2a-demo > logs/pod-describe.txt 2>&1 || echo "Failed to describe pods"
echo "=== Collecting Events ==="
kubectl get events -n a2a-demo --sort-by='.lastTimestamp' > logs/events.txt 2>&1 || echo "Failed to collect events"
echo "=== Collecting Minikube Status ==="
minikube status > logs/minikube-status.txt 2>&1 || echo "Failed to collect minikube status"
echo "Logs collected successfully"
ls -lah logs/
- name: Upload Logs
if: always()
uses: actions/upload-artifact@v4
with:
name: cloud-deployment-logs
path: logs/
retention-days: 5
- name: Cleanup
if: always()
run: |
# Kill port-forward if still running
if [ -n "$PF_PID" ]; then
kill $PF_PID || true
fi
# Delete resources
kubectl delete namespace a2a-demo --ignore-not-found=true --timeout=60s || true
kubectl delete namespace kafka --ignore-not-found=true --timeout=60s || true