Skip to content

Commit

Permalink
support windows
Browse files Browse the repository at this point in the history
  • Loading branch information
smurawski committed Feb 9, 2024
1 parent 5cd8071 commit 5832c81
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 12 deletions.
22 changes: 22 additions & 0 deletions azd-hooks/postprovision.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env pwsh

$services=@("ai-service", "makeline-service", "order-service", "product-service", "store-admin", "store-front", "virtual-customer", "virtual-worker")

if (($env:DEPLOY_AZURE_CONTAINER_REGISTRY -like "true") -and ($env:BUILD_CONTAINERS -like "true")) {
echo "Build container images"
foreach ($service in $services) {
echo "Building aks-store-demo/${service}:latest"
az acr build --registry $env:AZURE_REGISTRY_NAME --image aks-store-demo/${service}:latest ./src/${service}/
}
}
elseif (($env:DEPLOY_AZURE_CONTAINER_REGISTRY -like "true") -and ($env:BUILD_CONTAINERS -like "false")) {
echo "Import container images"
foreach ($service in $services) {
echo "Importing aks-store-demo/${service}:latest"
az acr import --name $env:AZURE_REGISTRY_NAME --source ghcr.io/azure-samples/aks-store-demo/${service}:latest --image aks-store-demo/${service}:latest
}
}
else {
echo "No BUILD_CONTAINERS variable set, skipping container build/import"
}

39 changes: 39 additions & 0 deletions azd-hooks/predeploy.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env pwsh

echo "Retrieving cluster credentials"
az aks get-credentials --resource-group $env:AZURE_RESOURCEGROUP_NAME --name $env:AZURE_AKS_CLUSTER_NAME --overwrite-existing

$makelineUseSqlApi = "false"
if ($env:AZURE_DATABASE_API -eq "cosmosdbsql") {
$makelineUseSqlApi = "true"
}

echo "Deploy Helm chart"
helm upgrade aks-store-demo ./charts/aks-store-demo `
--install `
--set aiService.create=true `
--set aiService.modelDeploymentName=$env:AZURE_OPENAI_MODEL_NAME `
--set aiService.openAiEndpoint=$env:AZURE_OPENAI_ENDPOINT `
--set aiService.managedIdentityClientId=$env:AZURE_IDENTITY_CLIENT_ID `
--set aiService.image.repository=$env:AZURE_REGISTRY_URI/aks-store-demo/ai-service `
--set orderService.useAzureServiceBus=true `
--set orderService.queueHost=$env:AZURE_SERVICE_BUS_HOST `
--set orderService.queuePort=5671 `
--set orderService.queueUsername=$env:AZURE_SERVICE_BUS_SENDER_NAME `
--set orderService.queuePassword=$(az keyvault secret show --name $env:AZURE_SERVICE_BUS_SENDER_KEY --vault-name $env:AZURE_KEY_VAULT_NAME --query value -o tsv) `
--set orderService.queueTransport=tls `
--set orderService.image.repository=$env:AZURE_REGISTRY_URI/aks-store-demo/order-service `
--set makelineService.useAzureCosmosDB=true `
--set makelineService.orderQueueUri=$env:AZURE_SERVICE_BUS_URI `
--set makelineService.orderQueueUsername=$env:AZURE_SERVICE_BUS_LISTENER_NAME `
--set makelineService.orderQueuePassword=$(az keyvault secret show --name $env:AZURE_SERVICE_BUS_LISTENER_KEY --vault-name $env:AZURE_KEY_VAULT_NAME --query value -o tsv) `
--set makelineService.orderDBUri=$env:AZURE_COSMOS_DATABASE_URI `
--set makelineService.orderDBUsername=$env:AZURE_COSMOS_DATABASE_NAME `
--set makelineService.orderDBPassword=$(az keyvault secret show --name $env:AZURE_COSMOS_DATABASE_KEY --vault-name $env:AZURE_KEY_VAULT_NAME --query value -o tsv) `
--set makelineService.image.repository=$env:AZURE_REGISTRY_URI/aks-store-demo/makeline-service `
--set productService.image.repository=$env:AZURE_REGISTRY_URI/aks-store-demo/product-service `
--set storeAdmin.image.repository=$env:AZURE_REGISTRY_URI/aks-store-demo/store-admin `
--set storeFront.image.repository=$env:AZURE_REGISTRY_URI/aks-store-demo/store-front `
--set virtualCustomer.image.repository=$env:AZURE_REGISTRY_URI/aks-store-demo/virtual-customer `
--set virtualWorker.image.repository=$env:AZURE_REGISTRY_URI/aks-store-demo/virtual-worker `
--set makelineService.useSqlApi=$makelineUseSqlApi
10 changes: 10 additions & 0 deletions azd-hooks/preprovision.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env pwsh

echo "Ensuring Azure CLI extensions and dependencies are installed"
az provider register --namespace Microsoft.ContainerService
az feature register --namespace Microsoft.ContainerService --name AKS-KedaPreview
az feature register --namespace Microsoft.ContainerService --name AKS-PrometheusAddonPreview
az feature register --namespace Microsoft.ContainerService --name EnableWorkloadIdentityPreview
az feature register --namespace Microsoft.ContainerService --name NetworkObservabilityPreview
az extension add --upgrade --name aks-preview
az extension add --upgrade --name amg
42 changes: 30 additions & 12 deletions azure.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,38 @@ metadata:
template: [email protected]
hooks:
preprovision:
shell: sh
continueOnError: false
interactive: false
run: azd-hooks/preprovision.sh
posix:
shell: sh
continueOnError: false
interactive: false
run: azd-hooks/preprovision.sh
windows:
shell: pwsh
continueOnError: false
interactive: false
run: azd-hooks/preprovision.ps1
postprovision:
shell: sh
continueOnError: false
interactive: false
run: azd-hooks/postprovision.sh
posix:
shell: sh
continueOnError: false
interactive: false
run: azd-hooks/postprovision.sh
windows:
shell: pwsh
continueOnError: false
interactive: false
run: azd-hooks/postprovision.ps1
predeploy: # This is a hack until Helm is supported in azd (https://github.com/Azure/azure-dev/issues/1618)
shell: sh
continueOnError: false
interactive: false
run: azd-hooks/predeploy.sh
posix:
shell: sh
continueOnError: false
interactive: false
run: azd-hooks/predeploy.sh
windows:
shell: pwsh
continueOnError: false
interactive: false
run: azd-hooks/predeploy.ps1
infra:
provider: terraform
path: infra/terraform

0 comments on commit 5832c81

Please sign in to comment.