|
| 1 | +name: Cloud Deployment Example Test |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + pull_request: |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | +# Only run the latest job |
| 9 | +concurrency: |
| 10 | + group: '${{ github.workflow }} @ ${{ github.head_ref || github.ref }}' |
| 11 | + cancel-in-progress: true |
| 12 | + |
| 13 | +jobs: |
| 14 | + test-cloud-deployment: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + timeout-minutes: 30 |
| 17 | + steps: |
| 18 | + - name: Checkout code |
| 19 | + uses: actions/checkout@v4 |
| 20 | + |
| 21 | + - name: Set up JDK 17 |
| 22 | + uses: actions/setup-java@v5 |
| 23 | + with: |
| 24 | + java-version: '17' |
| 25 | + distribution: 'temurin' |
| 26 | + cache: maven |
| 27 | + |
| 28 | + - name: Install Kind |
| 29 | + run: | |
| 30 | + curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.20.0/kind-linux-amd64 |
| 31 | + chmod +x ./kind |
| 32 | + sudo mv ./kind /usr/local/bin/kind |
| 33 | + kind version |
| 34 | +
|
| 35 | + - name: Build project |
| 36 | + run: mvn -B clean install -DskipTests -f pom.xml |
| 37 | + |
| 38 | + - name: Deploy with Kind |
| 39 | + working-directory: examples/cloud-deployment/scripts |
| 40 | + run: | |
| 41 | + chmod +x deploy.sh |
| 42 | + ./deploy.sh --container-tool docker |
| 43 | +
|
| 44 | + - name: Verify deployment |
| 45 | + working-directory: examples/cloud-deployment/scripts |
| 46 | + run: | |
| 47 | + chmod +x verify.sh |
| 48 | + ./verify.sh |
| 49 | +
|
| 50 | + - name: Verify agent card is accessible |
| 51 | + run: | |
| 52 | + echo "Testing agent card endpoint at http://localhost:8080/.well-known/agent-card.json" |
| 53 | + curl -f http://localhost:8080/.well-known/agent-card.json || (echo "Agent card not accessible" && exit 1) |
| 54 | +
|
| 55 | + - name: Run test client |
| 56 | + working-directory: examples/cloud-deployment/server |
| 57 | + run: | |
| 58 | + mvn test-compile exec:java \ |
| 59 | + -Dexec.mainClass="io.a2a.examples.cloud.A2ACloudExampleClient" \ |
| 60 | + -Dexec.classpathScope=test \ |
| 61 | + -Dagent.url=http://localhost:8080 |
| 62 | +
|
| 63 | + - name: Show diagnostics on failure |
| 64 | + if: failure() |
| 65 | + run: | |
| 66 | + echo "=== Agent Pod Status ===" |
| 67 | + kubectl get pods -n a2a-demo -l app=a2a-agent -o wide |
| 68 | +
|
| 69 | + echo "" |
| 70 | + echo "=== Agent Pod Descriptions ===" |
| 71 | + for pod in $(kubectl get pods -n a2a-demo -l app=a2a-agent -o jsonpath='{.items[*].metadata.name}'); do |
| 72 | + echo "--- Pod: $pod ---" |
| 73 | + kubectl describe pod $pod -n a2a-demo | tail -30 |
| 74 | + done |
| 75 | +
|
| 76 | + echo "" |
| 77 | + echo "=== Recent Events ===" |
| 78 | + kubectl get events -n a2a-demo --sort-by='.lastTimestamp' | tail -20 |
| 79 | +
|
| 80 | + echo "" |
| 81 | + echo "=== Agent Pod Logs ===" |
| 82 | + for pod in $(kubectl get pods -n a2a-demo -l app=a2a-agent -o jsonpath='{.items[*].metadata.name}'); do |
| 83 | + echo "--- Logs for $pod ---" |
| 84 | + kubectl logs -n a2a-demo $pod --tail=100 || true |
| 85 | + done |
| 86 | +
|
| 87 | + echo "" |
| 88 | + echo "=== PostgreSQL Logs ===" |
| 89 | + kubectl logs -n a2a-demo postgres-0 --tail=50 || true |
| 90 | +
|
| 91 | + echo "" |
| 92 | + echo "=== Kafka Logs ===" |
| 93 | + kubectl logs -n kafka -l strimzi.io/cluster=a2a-kafka --tail=50 || true |
| 94 | +
|
| 95 | + - name: Cleanup |
| 96 | + if: always() |
| 97 | + run: | |
| 98 | + cd examples/cloud-deployment/scripts |
| 99 | + echo "y" | ./cleanup.sh --container-tool docker || true |
| 100 | +
|
| 101 | +
|
0 commit comments