Skip to content

Commit 3757809

Browse files
committed
feat: enable Azure Container Apps as optional execution method (#5646)
- Add Azure Container Apps executor with job management and monitoring - Implement pluggable execution method architecture via HOST_EXECUTION_METHOD - Add Azure SDK dependencies (@azure/arm-appcontainers, @azure/identity) - Create Bicep templates for Azure infrastructure deployment - Add comprehensive test coverage for Azure Container Apps functionality - Update environment detection utilities for Azure Container Apps - Add documentation and setup guides for Azure Container Apps - Maintain backward compatibility with existing Docker execution - Support multi-language runtimes (Node.js, Python, Go, Java, Rust) - Include Azure Monitor integration and secrets management
1 parent e84dd0a commit 3757809

File tree

12 files changed

+1262
-4
lines changed

12 files changed

+1262
-4
lines changed

packages/evals/azure/deploy.sh

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
#!/bin/bash
2+
3+
# Azure Container Apps Deployment Script for Roo Code Evals
4+
# This script deploys the Azure infrastructure needed for Azure Container Apps execution
5+
6+
set -e
7+
8+
# Configuration
9+
RESOURCE_GROUP_NAME="${AZURE_RESOURCE_GROUP_NAME:-roo-code-evals}"
10+
LOCATION="${AZURE_LOCATION:-eastus}"
11+
SUBSCRIPTION_ID="${AZURE_SUBSCRIPTION_ID}"
12+
13+
# Validate required environment variables
14+
if [ -z "$SUBSCRIPTION_ID" ]; then
15+
echo "Error: AZURE_SUBSCRIPTION_ID environment variable is required"
16+
exit 1
17+
fi
18+
19+
echo "🚀 Starting Azure Container Apps deployment..."
20+
echo "📍 Resource Group: $RESOURCE_GROUP_NAME"
21+
echo "🌍 Location: $LOCATION"
22+
echo "🔑 Subscription: $SUBSCRIPTION_ID"
23+
24+
# Login to Azure (if not already logged in)
25+
echo "🔐 Checking Azure login status..."
26+
if ! az account show &>/dev/null; then
27+
echo "Please log in to Azure:"
28+
az login
29+
fi
30+
31+
# Set the subscription
32+
echo "📋 Setting Azure subscription..."
33+
az account set --subscription "$SUBSCRIPTION_ID"
34+
35+
# Create resource group if it doesn't exist
36+
echo "📦 Creating resource group..."
37+
az group create \
38+
--name "$RESOURCE_GROUP_NAME" \
39+
--location "$LOCATION" \
40+
--output table
41+
42+
# Deploy the Bicep template
43+
echo "🏗️ Deploying Azure Container Apps infrastructure..."
44+
az deployment group create \
45+
--resource-group "$RESOURCE_GROUP_NAME" \
46+
--template-file main.bicep \
47+
--parameters main.bicepparam \
48+
--output table
49+
50+
# Get deployment outputs
51+
echo "📤 Retrieving deployment outputs..."
52+
CONTAINER_APP_ENV_ID=$(az deployment group show \
53+
--resource-group "$RESOURCE_GROUP_NAME" \
54+
--name main \
55+
--query 'properties.outputs.containerAppEnvironmentId.value' \
56+
--output tsv)
57+
58+
CONTAINER_APP_ENV_NAME=$(az deployment group show \
59+
--resource-group "$RESOURCE_GROUP_NAME" \
60+
--name main \
61+
--query 'properties.outputs.containerAppEnvironmentName.value' \
62+
--output tsv)
63+
64+
echo "✅ Deployment completed successfully!"
65+
echo ""
66+
echo "📋 Deployment Summary:"
67+
echo " Resource Group: $RESOURCE_GROUP_NAME"
68+
echo " Container App Environment: $CONTAINER_APP_ENV_NAME"
69+
echo " Container App Environment ID: $CONTAINER_APP_ENV_ID"
70+
echo ""
71+
echo "🔧 To use Azure Container Apps execution, set these environment variables:"
72+
echo " export AZURE_SUBSCRIPTION_ID=$SUBSCRIPTION_ID"
73+
echo " export AZURE_RESOURCE_GROUP_NAME=$RESOURCE_GROUP_NAME"
74+
echo " export AZURE_CONTAINER_APP_ENVIRONMENT_NAME=$CONTAINER_APP_ENV_NAME"
75+
echo " export HOST_EXECUTION_METHOD=azure-container-apps"
76+
echo ""
77+
echo "📚 For more information, see the Azure Container Apps documentation."

packages/evals/azure/main.bicep

Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
@description('The name of the Container App Environment')
2+
param containerAppEnvironmentName string = 'evals-env'
3+
4+
@description('The name of the Container App')
5+
param containerAppName string = 'evals-runner'
6+
7+
@description('The location for all resources')
8+
param location string = resourceGroup().location
9+
10+
@description('The container registry server')
11+
param containerRegistryServer string
12+
13+
@description('The container image')
14+
param containerImage string
15+
16+
@description('The container registry username')
17+
@secure()
18+
param containerRegistryUsername string
19+
20+
@description('The container registry password')
21+
@secure()
22+
param containerRegistryPassword string
23+
24+
@description('The database connection string')
25+
@secure()
26+
param databaseUrl string
27+
28+
@description('The Redis connection string')
29+
@secure()
30+
param redisUrl string
31+
32+
@description('The OpenRouter API key')
33+
@secure()
34+
param openRouterApiKey string
35+
36+
// Log Analytics Workspace
37+
resource logAnalyticsWorkspace 'Microsoft.OperationalInsights/workspaces@2022-10-01' = {
38+
name: '${containerAppEnvironmentName}-logs'
39+
location: location
40+
properties: {
41+
sku: {
42+
name: 'PerGB2018'
43+
}
44+
retentionInDays: 30
45+
}
46+
}
47+
48+
// Container App Environment
49+
resource containerAppEnvironment 'Microsoft.App/managedEnvironments@2023-05-01' = {
50+
name: containerAppEnvironmentName
51+
location: location
52+
properties: {
53+
appLogsConfiguration: {
54+
destination: 'log-analytics'
55+
logAnalyticsConfiguration: {
56+
customerId: logAnalyticsWorkspace.properties.customerId
57+
sharedKey: logAnalyticsWorkspace.listKeys().primarySharedKey
58+
}
59+
}
60+
}
61+
}
62+
63+
// Container Registry Secret
64+
resource containerRegistrySecret 'Microsoft.App/managedEnvironments/secrets@2023-05-01' = {
65+
parent: containerAppEnvironment
66+
name: 'container-registry-password'
67+
properties: {
68+
value: containerRegistryPassword
69+
}
70+
}
71+
72+
// Database URL Secret
73+
resource databaseUrlSecret 'Microsoft.App/managedEnvironments/secrets@2023-05-01' = {
74+
parent: containerAppEnvironment
75+
name: 'database-url'
76+
properties: {
77+
value: databaseUrl
78+
}
79+
}
80+
81+
// Redis URL Secret
82+
resource redisUrlSecret 'Microsoft.App/managedEnvironments/secrets@2023-05-01' = {
83+
parent: containerAppEnvironment
84+
name: 'redis-url'
85+
properties: {
86+
value: redisUrl
87+
}
88+
}
89+
90+
// OpenRouter API Key Secret
91+
resource openRouterApiKeySecret 'Microsoft.App/managedEnvironments/secrets@2023-05-01' = {
92+
parent: containerAppEnvironment
93+
name: 'openrouter-api-key'
94+
properties: {
95+
value: openRouterApiKey
96+
}
97+
}
98+
99+
// Container App for Jobs (this will be used as a template for job executions)
100+
resource containerApp 'Microsoft.App/containerApps@2023-05-01' = {
101+
name: containerAppName
102+
location: location
103+
properties: {
104+
managedEnvironmentId: containerAppEnvironment.id
105+
configuration: {
106+
secrets: [
107+
{
108+
name: 'container-registry-password'
109+
value: containerRegistryPassword
110+
}
111+
{
112+
name: 'database-url'
113+
value: databaseUrl
114+
}
115+
{
116+
name: 'redis-url'
117+
value: redisUrl
118+
}
119+
{
120+
name: 'openrouter-api-key'
121+
value: openRouterApiKey
122+
}
123+
]
124+
registries: [
125+
{
126+
server: containerRegistryServer
127+
username: containerRegistryUsername
128+
passwordSecretRef: 'container-registry-password'
129+
}
130+
]
131+
}
132+
template: {
133+
containers: [
134+
{
135+
name: 'evals-runner'
136+
image: containerImage
137+
env: [
138+
{
139+
name: 'HOST_EXECUTION_METHOD'
140+
value: 'azure-container-apps'
141+
}
142+
{
143+
name: 'DATABASE_URL'
144+
secretRef: 'database-url'
145+
}
146+
{
147+
name: 'REDIS_URL'
148+
secretRef: 'redis-url'
149+
}
150+
{
151+
name: 'OPENROUTER_API_KEY'
152+
secretRef: 'openrouter-api-key'
153+
}
154+
]
155+
resources: {
156+
cpu: 1
157+
memory: '2Gi'
158+
}
159+
}
160+
]
161+
scale: {
162+
minReplicas: 0
163+
maxReplicas: 10
164+
}
165+
}
166+
}
167+
}
168+
169+
// Output values
170+
output containerAppEnvironmentId string = containerAppEnvironment.id
171+
output containerAppEnvironmentName string = containerAppEnvironment.name
172+
output containerAppId string = containerApp.id
173+
output containerAppName string = containerApp.name
174+
output logAnalyticsWorkspaceId string = logAnalyticsWorkspace.id
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using './main.bicep'
2+
3+
param containerAppEnvironmentName = 'evals-env'
4+
param containerAppName = 'evals-runner'
5+
param location = 'East US'
6+
param containerRegistryServer = 'your-registry.azurecr.io'
7+
param containerImage = 'your-registry.azurecr.io/evals-runner:latest'
8+
param containerRegistryUsername = 'your-registry-username'
9+
param containerRegistryPassword = 'your-registry-password'
10+
param databaseUrl = 'postgres://username:password@hostname:5432/database'
11+
param redisUrl = 'redis://hostname:6379'
12+
param openRouterApiKey = 'your-openrouter-api-key'

packages/evals/docker-compose.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
#
1313
# To enable docker execution, run:
1414
# docker run -it --rm --network evals_default -v /var/run/docker.sock:/var/run/docker.sock -e HOST_EXECUTION_METHOD=docker evals-runner bash
15+
#
16+
# To enable Azure Container Apps execution, run:
17+
# docker run -it --rm --network evals_default -e HOST_EXECUTION_METHOD=azure-container-apps evals-runner bash
1518

1619
services:
1720
db:

0 commit comments

Comments
 (0)