-
Notifications
You must be signed in to change notification settings - Fork 931
Add common languages SDKs #13978
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
Merged
Merged
Add common languages SDKs #13978
Changes from 47 commits
Commits
Show all changes
62 commits
Select commit
Hold shift + click to select a range
40e8537
Add python support
sebastienros 5759866
Add go support
sebastienros c9e8de9
Add Java code generator support
sebastienros c8ce76e
Add Rust code generator support for polyglot AppHosts (WIP)
sebastienros ef59cd9
Fix Rust code generator issues
sebastienros 9b40815
Fix Java and Rust code generators - Fix RuntimeSpec timing: InstallDe…
sebastienros 46ad57f
Fix Go code generator RuntimeSpec and module config
sebastienros 5865a70
Add E2E test
sebastienros adb0fae
Fix named pipes for rust/java
sebastienros cffe834
Merge main - adopt additionalProjectReferences approach for code gene…
sebastienros 467ddf4
Run PolyglotPythonTests as E2E
sebastienros 9cffcc0
Move PolyglotPythonTests to correct E2E test folder for CI discovery
sebastienros b4f8139
Add comprehensive Python code generator tests with Verify snapshots
sebastienros 2f1fc9f
Add unit tests for Go, Java, and Rust code generators
sebastienros 5dbb4bd
Merge remote-tracking branch 'origin/main' into sebros/poly
sebastienros 9505fcf
Apply list property improvements from TypeScript to Python, Go, Java,…
sebastienros 1ee5bb8
Enable polyglot support feature flag before init -l in E2E test
sebastienros f85aca2
Fix MethodAccessException when calling AtsConstants.IsDict from code …
sebastienros cf6be2e
Simplify Python E2E test to not require Python runtime
sebastienros e70b1d1
Add file content verification to Python E2E test
sebastienros 82f21f8
Merge remote-tracking branch 'origin/main' into sebros/poly
sebastienros d4f50d7
Add instructions
sebastienros 443c51e
Fix Python E2E test to handle version selection prompt in CI
sebastienros 600f52b
Fix Python E2E test pattern to match actual CLI output
sebastienros cbf1b51
Fix Python E2E test: verify settings.json instead of .modules (code g…
sebastienros b3c5110
Fix Python E2E test: verify .modules exists after init, settings.json…
sebastienros e96f8bf
Fix: Continue SDK code generation even if dependency install fails
sebastienros 10f8acc
Add polyglot E2E tests for Go, Rust, and Java
sebastienros 1137f4a
Fix polyglot E2E tests with correct code patterns
sebastienros 358da78
Simplify polyglot E2E test assertions for SDK patterns
sebastienros f0c026f
Remove static base/transport snapshot tests and add missing polyglot …
sebastienros 5e8525c
Fix Rust
sebastienros 03c070d
Detect local python command
sebastienros 41515b8
Fix Rust
sebastienros 4d8e786
Add build checks
sebastienros 3edd328
Add polyglot validation to CI workflow
sebastienros 9e00e43
Use Docker containers from mcr.microsoft.com for polyglot validation
sebastienros fa4be8a
Remove ASPIRE_CLI_PATH requirement from validation scripts
sebastienros 92e964e
Use native CLI archive for polyglot validation with .NET SDK for AppH…
sebastienros 3081dc2
Merge branch 'main' into sebros/poly
sebastienros befcfa2
Update codegen snapshots for AppHostFilePath property
sebastienros 4dffab0
Fix CLI archive path with find command
sebastienros 8eb84ca
Use dogfood script to install CLI and NuGet packages from PR
sebastienros 44009a0
TEMP: Install gh CLI in Docker, disable other tests for faster polygl…
sebastienros 891d9b0
Merge branch 'main' into sebros/poly
sebastienros 8b10909
Fix polyglot validation workflow to include Docker CLI
sebastienros a17c100
Update polyglot test scripts to use aspire run --detach and aspire stop
sebastienros 1e75f6a
Update polyglot test scripts to use aspire run --detach and aspire stop
sebastienros b9eecd9
Make channel config setting non-fatal in get-aspire-cli-pr.sh
sebastienros e115c18
Fix aspire add --non-interactive to auto-select latest version
sebastienros 762d7d6
Add -d flag to aspire run --detach for debug logging
sebastienros ca76992
Use local get-aspire-cli-pr.sh script instead of downloading from main
sebastienros 734040b
Use background job for aspire run instead of --detach
sebastienros 1581358
Use kill -9 and remove wait to prevent blocking on cleanup
sebastienros 1e76779
Use go:1-trixie image for GLIBC 2.38 support
sebastienros e77122f
Re-enable all tests that were temporarily disabled
sebastienros 7bfa895
Add TypeScript polyglot SDK validation
sebastienros f38a13c
Remove Base.verified.java, Transport.verified.java and their tests
sebastienros 73392bc
Remove PolyglotPythonTests, PolyglotGoTests, PolyglotRustTests, Polyg…
sebastienros 0ba21de
Use setsid and kill process group to properly stop apphost
sebastienros 0b8cc23
Add Redis in a consistent way across scripts
sebastienros 58fd469
Add Dockerfiles for polyglot SDK validation
sebastienros 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
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,224 @@ | ||
| # Polyglot SDK Validation Tests (Reusable) | ||
| # Validates Python, Go, Java, and Rust AppHost SDKs with Redis integration | ||
| # Uses Docker containers from mcr.microsoft.com for security | ||
| # Uses dogfood script to install CLI and NuGet packages from the current PR | ||
| name: Polyglot SDK Validation | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| versionOverrideArg: | ||
| required: false | ||
| type: string | ||
|
|
||
| jobs: | ||
| validate_python: | ||
| name: Python SDK Validation | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
|
|
||
| - name: Run Python SDK validation in Docker | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| run: | | ||
| docker run --rm \ | ||
| -v "${{ github.workspace }}:/workspace" \ | ||
| -v /var/run/docker.sock:/var/run/docker.sock \ | ||
| -w /workspace \ | ||
| -e GH_TOKEN="${GH_TOKEN}" \ | ||
| mcr.microsoft.com/devcontainers/python:3.12 \ | ||
| bash -c ' | ||
| set -e | ||
| echo "=== Installing GitHub CLI ===" | ||
| (type -p wget >/dev/null || (sudo apt update && sudo apt-get install wget -y)) && sudo mkdir -p -m 755 /etc/apt/keyrings && wget -nv -O- https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null && sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg && echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null && sudo apt update && sudo apt install gh -y | ||
|
|
||
| echo "=== Installing Docker CLI ===" | ||
| sudo apt-get install -y docker.io | ||
|
|
||
| echo "=== Installing .NET SDK 10.0 ===" | ||
| curl -fsSL https://dot.net/v1/dotnet-install.sh | bash -s -- --channel 10.0 | ||
| export PATH="$HOME/.dotnet:$PATH" | ||
| export DOTNET_ROOT="$HOME/.dotnet" | ||
|
|
||
| echo "=== Installing uv package manager ===" | ||
| curl -LsSf https://astral.sh/uv/install.sh | sh | ||
| export PATH="$HOME/.local/bin:$PATH" | ||
|
|
||
| echo "=== Installing Aspire CLI from PR ===" | ||
| curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- ${{ github.event.pull_request.number }} | ||
| export PATH="$HOME/.aspire/bin:$PATH" | ||
| aspire --version | ||
|
|
||
| echo "=== Enabling polyglot support ===" | ||
| aspire config set features:polyglotSupportEnabled true --global | ||
|
|
||
| echo "=== Running validation ===" | ||
| chmod +x /workspace/.github/workflows/polyglot-validation/test-python.sh | ||
| /workspace/.github/workflows/polyglot-validation/test-python.sh | ||
| ' | ||
|
|
||
| validate_go: | ||
| name: Go SDK Validation | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
|
|
||
| - name: Run Go SDK validation in Docker | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| run: | | ||
| docker run --rm \ | ||
| -v "${{ github.workspace }}:/workspace" \ | ||
| -v /var/run/docker.sock:/var/run/docker.sock \ | ||
| -w /workspace \ | ||
| -e GH_TOKEN="${GH_TOKEN}" \ | ||
| mcr.microsoft.com/devcontainers/go:1.23 \ | ||
| bash -c ' | ||
| set -e | ||
| echo "=== Installing GitHub CLI ===" | ||
| (type -p wget >/dev/null || (sudo apt update && sudo apt-get install wget -y)) && sudo mkdir -p -m 755 /etc/apt/keyrings && wget -nv -O- https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null && sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg && echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null && sudo apt update && sudo apt install gh -y | ||
|
|
||
| echo "=== Installing Docker CLI ===" | ||
| sudo apt-get install -y docker.io | ||
|
|
||
| echo "=== Installing .NET SDK 10.0 ===" | ||
| curl -fsSL https://dot.net/v1/dotnet-install.sh | bash -s -- --channel 10.0 | ||
| export PATH="$HOME/.dotnet:$PATH" | ||
| export DOTNET_ROOT="$HOME/.dotnet" | ||
|
|
||
| echo "=== Installing Aspire CLI from PR ===" | ||
| curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- ${{ github.event.pull_request.number }} | ||
| export PATH="$HOME/.aspire/bin:$PATH" | ||
| aspire --version | ||
|
|
||
| echo "=== Enabling polyglot support ===" | ||
| aspire config set features:polyglotSupportEnabled true --global | ||
|
|
||
| echo "=== Running validation ===" | ||
| chmod +x /workspace/.github/workflows/polyglot-validation/test-go.sh | ||
| /workspace/.github/workflows/polyglot-validation/test-go.sh | ||
| ' | ||
|
|
||
| validate_java: | ||
| name: Java SDK Validation | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
|
|
||
| - name: Run Java SDK validation in Docker | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| run: | | ||
| docker run --rm \ | ||
| -v "${{ github.workspace }}:/workspace" \ | ||
| -v /var/run/docker.sock:/var/run/docker.sock \ | ||
| -w /workspace \ | ||
| -e GH_TOKEN="${GH_TOKEN}" \ | ||
| mcr.microsoft.com/devcontainers/java:17 \ | ||
| bash -c ' | ||
| set -e | ||
| echo "=== Installing GitHub CLI ===" | ||
| (type -p wget >/dev/null || (sudo apt update && sudo apt-get install wget -y)) && sudo mkdir -p -m 755 /etc/apt/keyrings && wget -nv -O- https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null && sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg && echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null && sudo apt update && sudo apt install gh -y | ||
|
|
||
| echo "=== Installing Docker CLI ===" | ||
| sudo apt-get install -y docker.io | ||
|
|
||
| echo "=== Installing .NET SDK 10.0 ===" | ||
| curl -fsSL https://dot.net/v1/dotnet-install.sh | bash -s -- --channel 10.0 | ||
| export PATH="$HOME/.dotnet:$PATH" | ||
| export DOTNET_ROOT="$HOME/.dotnet" | ||
|
|
||
| echo "=== Installing Aspire CLI from PR ===" | ||
| curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- ${{ github.event.pull_request.number }} | ||
| export PATH="$HOME/.aspire/bin:$PATH" | ||
| aspire --version | ||
|
|
||
| echo "=== Enabling polyglot support ===" | ||
| aspire config set features:polyglotSupportEnabled true --global | ||
|
|
||
| echo "=== Running validation ===" | ||
| chmod +x /workspace/.github/workflows/polyglot-validation/test-java.sh | ||
| /workspace/.github/workflows/polyglot-validation/test-java.sh | ||
| ' | ||
|
|
||
| validate_rust: | ||
| name: Rust SDK Validation | ||
| runs-on: ubuntu-latest | ||
| # Rust SDK has known issues - don't fail the workflow | ||
| continue-on-error: true | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
|
|
||
| - name: Run Rust SDK validation in Docker | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| run: | | ||
| docker run --rm \ | ||
| -v "${{ github.workspace }}:/workspace" \ | ||
| -v /var/run/docker.sock:/var/run/docker.sock \ | ||
| -w /workspace \ | ||
| -e GH_TOKEN="${GH_TOKEN}" \ | ||
| mcr.microsoft.com/devcontainers/rust:1 \ | ||
| bash -c ' | ||
| set -e | ||
| echo "=== Installing GitHub CLI ===" | ||
| (type -p wget >/dev/null || (sudo apt update && sudo apt-get install wget -y)) && sudo mkdir -p -m 755 /etc/apt/keyrings && wget -nv -O- https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null && sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg && echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null && sudo apt update && sudo apt install gh -y | ||
|
|
||
| echo "=== Installing Docker CLI ===" | ||
| sudo apt-get install -y docker.io | ||
|
|
||
| echo "=== Installing .NET SDK 10.0 ===" | ||
| curl -fsSL https://dot.net/v1/dotnet-install.sh | bash -s -- --channel 10.0 | ||
| export PATH="$HOME/.dotnet:$PATH" | ||
| export DOTNET_ROOT="$HOME/.dotnet" | ||
|
|
||
| echo "=== Installing Aspire CLI from PR ===" | ||
| curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- ${{ github.event.pull_request.number }} | ||
| export PATH="$HOME/.aspire/bin:$PATH" | ||
| aspire --version | ||
|
|
||
| echo "=== Enabling polyglot support ===" | ||
| aspire config set features:polyglotSupportEnabled true --global | ||
|
|
||
| echo "=== Running validation ===" | ||
| chmod +x /workspace/.github/workflows/polyglot-validation/test-rust.sh | ||
| /workspace/.github/workflows/polyglot-validation/test-rust.sh | ||
| ' | ||
|
|
||
| results: | ||
| if: always() | ||
| runs-on: ubuntu-latest | ||
| name: Polyglot Validation Results | ||
| needs: [validate_python, validate_go, validate_java, validate_rust] | ||
| steps: | ||
| - name: Check validation results | ||
| # Only fail on Python, Go, Java failures (Rust has continue-on-error) | ||
| if: >- | ||
| ${{ needs.validate_python.result == 'failure' || | ||
| needs.validate_go.result == 'failure' || | ||
| needs.validate_java.result == 'failure' || | ||
| needs.validate_python.result == 'cancelled' || | ||
| needs.validate_go.result == 'cancelled' || | ||
| needs.validate_java.result == 'cancelled' }} | ||
| run: | | ||
| echo "One or more polyglot SDK validations failed." | ||
| echo "Python: ${{ needs.validate_python.result }}" | ||
| echo "Go: ${{ needs.validate_go.result }}" | ||
| echo "Java: ${{ needs.validate_java.result }}" | ||
| exit 1 | ||
|
|
||
| - name: Report Rust status | ||
| if: always() | ||
| run: | | ||
| echo "Rust SDK validation: ${{ needs.validate_rust.result }}" | ||
| if [ "${{ needs.validate_rust.result }}" == "failure" ]; then | ||
| echo "⚠️ Rust SDK validation failed (known issues - not blocking)" | ||
| fi | ||
|
|
||
| - name: All validations passed | ||
| run: echo "✅ All required polyglot SDK validations passed!" |
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,85 @@ | ||
| #!/bin/bash | ||
| # Polyglot SDK Validation - Go | ||
| # This script validates the Go AppHost SDK with Redis integration | ||
| set -e | ||
|
|
||
| echo "=== Go AppHost SDK Validation ===" | ||
|
|
||
| # Verify aspire CLI is available | ||
| if ! command -v aspire &> /dev/null; then | ||
| echo "❌ Aspire CLI not found in PATH" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "Aspire CLI version:" | ||
| aspire --version | ||
|
|
||
| # Create project directory | ||
| WORK_DIR=$(mktemp -d) | ||
| echo "Working directory: $WORK_DIR" | ||
| cd "$WORK_DIR" | ||
|
|
||
| # Initialize Go AppHost | ||
| echo "Creating Go apphost project..." | ||
| aspire init -l go --non-interactive | ||
|
|
||
| # Add Redis integration | ||
| echo "Adding Redis integration..." | ||
| aspire add Aspire.Hosting.Redis --non-interactive 2>&1 || { | ||
| echo "aspire add failed, manually updating settings.json..." | ||
| PKG_VERSION=$(aspire --version | grep -oP '\d+\.\d+\.\d+-.*' | head -1) | ||
| if [ -f ".aspire/settings.json" ]; then | ||
| if command -v jq &> /dev/null; then | ||
| jq '.packages["Aspire.Hosting.Redis"] = "'"$PKG_VERSION"'"' .aspire/settings.json > .aspire/settings.json.tmp && mv .aspire/settings.json.tmp .aspire/settings.json | ||
| fi | ||
| echo "Settings.json updated" | ||
| cat .aspire/settings.json | ||
| fi | ||
| } | ||
|
|
||
| # Insert Redis code into apphost.go | ||
| echo "Configuring apphost.go with Redis..." | ||
| if grep -q "builder.Build()" apphost.go; then | ||
| sed -i '/builder.Build()/i\ | ||
| \t// Add Redis cache resource\ | ||
| \t_, err = builder.AddRedis("cache", 0, nil)\ | ||
| \tif err != nil {\ | ||
| \t\tlog.Fatalf("Failed to add Redis: %v", err)\ | ||
| \t}' apphost.go | ||
| echo "✅ Redis configuration added to apphost.go" | ||
| fi | ||
|
|
||
| echo "=== apphost.go ===" | ||
| cat apphost.go | ||
|
|
||
| # Run the apphost in detached mode | ||
| echo "Starting apphost in detached mode..." | ||
| aspire run --non-interactive --detach | ||
|
sebastienros marked this conversation as resolved.
Outdated
|
||
|
|
||
| # Poll for Redis container with retries | ||
| echo "Polling for Redis container..." | ||
| RESULT=1 | ||
| for i in {1..12}; do | ||
| echo "Attempt $i/12: Checking for Redis container..." | ||
| if docker ps | grep -q -i redis; then | ||
| echo "✅ SUCCESS: Redis container is running!" | ||
| docker ps | grep -i redis | ||
| RESULT=0 | ||
| break | ||
| fi | ||
| echo "Redis not found yet, waiting 10 seconds..." | ||
| sleep 10 | ||
| done | ||
|
|
||
| if [ $RESULT -ne 0 ]; then | ||
| echo "❌ FAILURE: Redis container not found after 2 minutes" | ||
| echo "=== Docker containers ===" | ||
| docker ps | ||
| fi | ||
|
|
||
| # Cleanup | ||
| echo "Stopping apphost..." | ||
| aspire stop --non-interactive 2>/dev/null || true | ||
| rm -rf "$WORK_DIR" | ||
|
|
||
| exit $RESULT | ||
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.
@sebastienros would this use the default docker registry? it might get rate limited.
Uh oh!
There was an error while loading. Please reload this page.
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.
That could be the case. To solve that we need to call
.WithImageRegistry("netaspireci.azurecr.io")when we addAddRedis(...)in the apphosts. #14113