-
Notifications
You must be signed in to change notification settings - Fork 149
feat: add Windows PowerShell scripts for cloud-deployment example #900
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
spandey1702
wants to merge
4
commits into
a2aproject:main
Choose a base branch
from
spandey1702:fix/windows-support-issue-395
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
8ffc2fe
Add Windows PowerShell scripts for cloud-deployment example (#395)
spandey1702 89ae21e
fix: address Gemini Code Assist review comments
spandey1702 fe76a2a
feat: add Windows CI workflow and -Force flag to cleanup.ps1
spandey1702 1e2c5be
fix: skip resource deletion in cleanup.ps1 when cluster is unreachable
spandey1702 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| name: Cloud Deployment Example Test (Windows) | ||
|
|
||
| on: | ||
| push: | ||
| pull_request: | ||
| workflow_dispatch: | ||
|
|
||
| # Only run the latest job | ||
| concurrency: | ||
| group: '${{ github.workflow }} @ ${{ github.head_ref || github.ref }}' | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| test-cloud-deployment-windows: | ||
| runs-on: windows-latest | ||
| timeout-minutes: 45 | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Set up JDK 17 | ||
| uses: actions/setup-java@v5 | ||
| with: | ||
| java-version: '17' | ||
| distribution: 'temurin' | ||
| cache: maven | ||
|
|
||
| - name: Install Kind | ||
| shell: pwsh | ||
| run: | | ||
| curl.exe -Lo kind.exe https://kind.sigs.k8s.io/dl/v0.31.0/kind-windows-amd64.exe | ||
| Move-Item kind.exe "$env:SystemRoot\System32\kind.exe" | ||
| kind version | ||
|
|
||
| - name: Build project | ||
| run: mvn -B clean install -DskipTests -f pom.xml | ||
|
|
||
| - name: Deploy with Kind | ||
| working-directory: examples/cloud-deployment/scripts | ||
| shell: pwsh | ||
| run: .\deploy.ps1 | ||
|
|
||
| - name: Verify deployment | ||
| working-directory: examples/cloud-deployment/scripts | ||
| shell: pwsh | ||
| run: .\verify.ps1 | ||
|
|
||
| - name: Verify agent card is accessible | ||
| shell: pwsh | ||
| run: | | ||
| Write-Host "Testing agent card endpoint at http://localhost:8080/.well-known/agent-card.json" | ||
| curl.exe -f http://localhost:8080/.well-known/agent-card.json | ||
| if ($LASTEXITCODE -ne 0) { | ||
| Write-Host "Agent card not accessible" -ForegroundColor Red | ||
| exit 1 | ||
| } | ||
|
|
||
| - name: Run test client | ||
| working-directory: examples/cloud-deployment/server | ||
| shell: pwsh | ||
| run: | | ||
| mvn test-compile exec:java ` | ||
| -Dexec.mainClass="org.a2aproject.sdk.examples.cloud.A2ACloudExampleClient" ` | ||
| -Dexec.classpathScope=test ` | ||
| -Dagent.url=http://localhost:8080 ` | ||
| -Dci.mode=true | ||
|
|
||
| - name: Show diagnostics on failure | ||
| if: failure() | ||
| shell: pwsh | ||
| run: | | ||
| Write-Host "=== Agent Pod Status ===" | ||
| kubectl get pods -n a2a-demo -l app=a2a-agent -o wide | ||
|
|
||
| Write-Host "" | ||
| Write-Host "=== Recent Events ===" | ||
| kubectl get events -n a2a-demo --sort-by='.lastTimestamp' | Select-Object -Last 20 | ||
|
|
||
| Write-Host "" | ||
| Write-Host "=== Agent Pod Logs ===" | ||
| $pods = (kubectl get pods -n a2a-demo -l app=a2a-agent ` | ||
| -o jsonpath='{.items[*].metadata.name}') -split ' ' | ||
| foreach ($pod in $pods) { | ||
| if ($pod) { | ||
| Write-Host "--- Logs for $pod ---" | ||
| kubectl logs -n a2a-demo $pod --tail=100 | ||
| } | ||
| } | ||
|
|
||
| Write-Host "" | ||
| Write-Host "=== PostgreSQL Logs ===" | ||
| kubectl logs -n a2a-demo postgres-0 --tail=50 | ||
|
|
||
| Write-Host "" | ||
| Write-Host "=== Kafka Logs ===" | ||
| kubectl logs -n kafka -l strimzi.io/cluster=a2a-kafka --tail=50 | ||
|
|
||
| - name: Cleanup | ||
| if: always() | ||
| working-directory: examples/cloud-deployment/scripts | ||
| shell: pwsh | ||
| run: .\cleanup.ps1 -Force |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| <# | ||
| .SYNOPSIS | ||
| Tear down the A2A Cloud example Kubernetes deployment. | ||
| .DESCRIPTION | ||
| Deletes all deployed resources in reverse order, removes the Kind cluster | ||
| and local registry container. Windows equivalent of cleanup.sh. | ||
| .PARAMETER ContainerTool | ||
| Container runtime to use: 'docker' (default) or 'podman'. | ||
| .EXAMPLE | ||
| .\cleanup.ps1 | ||
| .\cleanup.ps1 -ContainerTool podman | ||
| .NOTES | ||
| Requires PowerShell 5.1 or later. Run with: | ||
| Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass | ||
| before running this script if your system policy blocks unsigned scripts. | ||
| #> | ||
| param( | ||
| [ValidateSet("docker", "podman")] | ||
| [string]$ContainerTool = "docker", | ||
| [switch]$Force | ||
| ) | ||
|
|
||
| Write-Host "============================================" | ||
| Write-Host "A2A Cloud Deployment - Cleanup Script" | ||
| Write-Host "============================================" | ||
| Write-Host "" | ||
|
|
||
| # Configure Kind to use podman if specified | ||
| if ($ContainerTool -eq "podman") { | ||
| $env:KIND_EXPERIMENTAL_PROVIDER = "podman" | ||
| } | ||
|
|
||
| Write-Host "This will delete all resources in the a2a-demo namespace and the Kind cluster" -ForegroundColor Yellow | ||
|
|
||
| if (-not $Force) { | ||
| $reply = Read-Host "Are you sure you want to continue? (y/N)" | ||
| if ($reply -notmatch "^[Yy]$") { | ||
| Write-Host "Cleanup cancelled" | ||
| exit 0 | ||
| } | ||
| } else { | ||
| Write-Host "Running in forced mode, skipping confirmation." -ForegroundColor Yellow | ||
| } | ||
|
|
||
| Write-Host "" | ||
| Write-Host "Checking cluster connectivity..." | ||
| $null = kubectl cluster-info 2>$null | ||
| if ($LASTEXITCODE -eq 0) { | ||
| Write-Host "✓ Cluster reachable, deleting resources..." -ForegroundColor Green | ||
|
|
||
| Write-Host "" | ||
| Write-Host "Deleting A2A Agent..." | ||
| kubectl delete -f "..\k8s\05-agent-deployment.yaml" --ignore-not-found=true | ||
|
|
||
| Write-Host "" | ||
| Write-Host "Deleting ConfigMap..." | ||
| kubectl delete -f "..\k8s\04-agent-configmap.yaml" --ignore-not-found=true | ||
|
|
||
| Write-Host "" | ||
| Write-Host "Deleting Kafka topic..." | ||
| kubectl delete -f "..\k8s\03-kafka-topic.yaml" --ignore-not-found=true | ||
|
|
||
| Write-Host "" | ||
| Write-Host "Deleting Kafka..." | ||
| kubectl delete -f "..\k8s\02-kafka.yaml" --ignore-not-found=true | ||
|
|
||
| Write-Host "" | ||
| Write-Host "Deleting PostgreSQL..." | ||
| kubectl delete -f "..\k8s\01-postgres.yaml" --ignore-not-found=true | ||
|
|
||
| Write-Host "" | ||
| Write-Host "Deleting namespace..." | ||
| kubectl delete -f "..\k8s\00-namespace.yaml" --ignore-not-found=true | ||
| } else { | ||
| Write-Host "⚠ Cluster not reachable, skipping resource deletion — resources will be removed with the cluster." -ForegroundColor Yellow | ||
| } | ||
|
|
||
| Write-Host "" | ||
| Write-Host "Deleting Kind cluster..." | ||
| kind delete cluster | ||
|
|
||
| Write-Host "" | ||
| Write-Host "Stopping and removing registry container..." | ||
| $null = & $ContainerTool stop kind-registry 2>$null | ||
| $null = & $ContainerTool rm kind-registry 2>$null | ||
|
|
||
| Write-Host "" | ||
| Write-Host "Cleanup completed" -ForegroundColor Green | ||
| Write-Host "" | ||
| Write-Host "Note: Strimzi operator was not removed" -ForegroundColor Yellow | ||
| Write-Host "To remove Strimzi operator, run:" | ||
| Write-Host " kubectl delete namespace kafka" | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If
kubectlis not installed or not in the system PATH, callingkubectl cluster-infowill throw a command-not-found exception in PowerShell. Since$LASTEXITCODEis not updated when a command-not-found error occurs, it will retain whatever value it had from the parent session. If that value was0, the script will incorrectly enter theifblock and attempt to run multiplekubectl deletecommands, throwing a series of noisy errors.Check if
kubectlis available usingGet-Commandbefore executing it, similar to how it is done indeploy.ps1.