Skip to content

Commit 3dc64b9

Browse files
feat(terraform): add source registry variable and update outputs for container imports
Co-authored-by: Steven Murawski <steven.murawski@microsoft.com>
1 parent d7f50b9 commit 3dc64b9

9 files changed

Lines changed: 35 additions & 7 deletions

File tree

.github/workflows/test-e2e.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,12 @@ jobs:
4545
- name: Turn on Helm support for AKS
4646
run: azd config set alpha.aks.helm on
4747

48+
- name: Set helm chart location
49+
run: sed -i 's/azure-samples.github.io/${{ github.repository_owner }}.github.io/' azure.yaml
50+
4851
- name: Provision and deploy
49-
run: azd up --no-prompt
52+
run: |
53+
azd up --no-prompt
5054
env:
5155
AZURE_ENV_NAME: ${{ vars.AZURE_ENV_NAME }}
5256
AZURE_LOCATION: ${{ vars.AZURE_LOCATION }}

azd-hooks/postprovision.ps1

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@ if (($env:DEPLOY_AZURE_CONTAINER_REGISTRY -like "true") -and ($env:BUILD_CONTAIN
1111
}
1212
elseif (($env:DEPLOY_AZURE_CONTAINER_REGISTRY -like "true") -and ($env:BUILD_CONTAINERS -like "false")) {
1313
echo "Import container images"
14+
if ([string]::IsNullOrEmpty($env:SOURCE_REGISTRY)){
15+
$env:SOURCE_REGISTRY = 'ghrc.io/azure-samples'
16+
}
1417
foreach ($service in $services) {
1518
echo "Importing aks-store-demo/${service}:latest"
16-
az acr import --name $env:AZURE_REGISTRY_NAME --source ghcr.io/azure-samples/aks-store-demo/${service}:latest --image aks-store-demo/${service}:latest
19+
az acr import --name $env:AZURE_REGISTRY_NAME --source $env:SOURCE_REGISTRY/aks-store-demo/${service}:latest --image aks-store-demo/${service}:latest
1720
}
1821
}
1922
else {

azd-hooks/postprovision.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,17 @@ if [ "$DEPLOY_AZURE_CONTAINER_REGISTRY" == "true" ] && [ "$BUILD_CONTAINERS" ==
1010
done
1111
elif [ "$DEPLOY_AZURE_CONTAINER_REGISTRY" == "true" ] && ([ -z "$BUILD_CONTAINERS" ] || [ "$BUILD_CONTAINERS" == "false" ]); then
1212
echo "Import container images"
13+
# Default SOURCE_REGISTRY if empty or unset
14+
if [ -z "${SOURCE_REGISTRY}" ]; then
15+
SOURCE_REGISTRY="ghcr.io/azure-samples"
16+
fi
17+
1318
for service in "${services[@]}"; do
1419
echo "Importing aks-store-demo/${service}:latest"
15-
az acr import --name ${AZURE_REGISTRY_NAME} --source ghcr.io/pauldotyu/aks-store-demo/${service}:latest --image aks-store-demo/${service}:latest
20+
az acr import \
21+
--name "${AZURE_REGISTRY_NAME}" \
22+
--source "${SOURCE_REGISTRY}/aks-store-demo/${service}:latest" \
23+
--image "aks-store-demo/${service}:latest"
1624
done
1725
else
1826
echo "No BUILD_CONTAINERS variable set, skipping container build/import"

azure.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ services:
6161
helm:
6262
repositories:
6363
- name: aks-store-demo
64-
url: https://pauldotyu.github.io/aks-store-demo
64+
url: https://azure-samples.github.io/aks-store-demo
6565
releases:
6666
- name: demo
6767
chart: aks-store-demo/aks-store-demo-chart

infra/bicep/main.bicep

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ param imageGenerationModelCapacity int = 1
6464
@description('value of the current IP address for network access')
6565
param currentIpAddress string
6666

67+
@description('value of source registry to use for image imports')
68+
param sourceRegistry string = 'ghcr.io/azure-samples'
69+
6770
// generate a unique string based on the resource group id
6871
// this is used to ensure that each resource name is unique
6972
var name = '${appEnvironment}${take(uniqueString(subscription().id, appEnvironment), 4)}'
@@ -193,5 +196,5 @@ output AZURE_DATABASE_API string = cosmosDBAccountKind == 'MongoDB' ? 'mongodb'
193196
output AZURE_REGISTRY_NAME string = deployAzureContainerRegistry ? aks.outputs.registryName : ''
194197
output AZURE_REGISTRY_URI string = deployAzureContainerRegistry
195198
? aks.outputs.registryLoginServer
196-
: 'ghcr.io/azure-samples'
199+
: sourceRegistry
197200
output AZURE_TENANT_ID string = tenant().tenantId

infra/bicep/main.parameters.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@
4040
},
4141
"deployImageGenerationModel": {
4242
"value": "${DEPLOY_AZURE_OPENAI_DALL_E_MODEL=false}"
43+
},
44+
"source_registry": {
45+
"value": "${SOURCE_REGISTRY}"
4346
}
4447
}
4548
}

infra/terraform/main.tfvars.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@
99
"cosmosdb_account_kind": "${AZURE_COSMOSDB_ACCOUNT_KIND}",
1010
"deploy_azure_openai": "${DEPLOY_AZURE_OPENAI}",
1111
"azure_openai_location": "${AZURE_OPENAI_LOCATION}",
12-
"deploy_image_generation_model": "${DEPLOY_AZURE_OPENAI_DALL_E_MODEL}"
12+
"deploy_image_generation_model": "${DEPLOY_AZURE_OPENAI_DALL_E_MODEL}",
13+
"source_registry": "${SOURCE_REGISTRY}"
1314
}

infra/terraform/outputs.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ output "AZURE_REGISTRY_NAME" {
7676
}
7777

7878
output "AZURE_REGISTRY_URI" {
79-
value = local.deploy_azure_container_registry ? module.acr[0].resource.login_server : "ghcr.io/pauldotyu"
79+
value = local.deploy_azure_container_registry ? module.acr[0].resource.login_server : var.source_registry
8080
}
8181

8282
output "AZURE_TENANT_ID" {

infra/terraform/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,3 +120,9 @@ variable "image_generation_model_type" {
120120
type = string
121121
default = "Standard"
122122
}
123+
124+
variable "source_registry" {
125+
description = "value of source registry to use for image imports"
126+
type = string
127+
default = "ghcr.io/azure-samples"
128+
}

0 commit comments

Comments
 (0)