Skip to content

Commit 022893e

Browse files
updated test automation pipeline with bicep
1 parent 8a07b98 commit 022893e

4 files changed

Lines changed: 33 additions & 41 deletions

File tree

.github/workflows/test-automation.yml

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,6 @@ jobs:
3333
with:
3434
creds: '{"clientId":"${{ secrets.AZURE_CLIENT_ID }}","clientSecret":"${{ secrets.AZURE_CLIENT_SECRET }}","subscriptionId":"${{ secrets.AZURE_SUBSCRIPTION_ID }}","tenantId":"${{ secrets.AZURE_TENANT_ID }}"}'
3535

36-
- name: Start Container App
37-
id: start-container-app
38-
uses: azure/cli@v2
39-
with:
40-
azcliversion: 'latest'
41-
inlineScript: |
42-
az rest -m post -u "/subscriptions/${{ secrets.AZURE_SUBSCRIPTION_ID }}/resourceGroups/${{ vars.CODEMOD_RG }}/providers/Microsoft.App/containerApps/${{ vars.CODEMOD_FRONTEND_CONTAINER_NAME }}/start?api-version=2025-01-01"
43-
az rest -m post -u "/subscriptions/${{ secrets.AZURE_SUBSCRIPTION_ID }}/resourceGroups/${{ vars.CODEMOD_RG }}/providers/Microsoft.App/containerApps/${{ vars.CODEMOD_BACKEND_CONTAINER_NAME }}/start?api-version=2025-01-01"
44-
4536
- name: Install dependencies
4637
run: |
4738
python -m pip install --upgrade pip
@@ -123,14 +114,4 @@ jobs:
123114
# Send the notification
124115
curl -X POST "${{ secrets.EMAILNOTIFICATION_LOGICAPP_URL_TA }}" \
125116
-H "Content-Type: application/json" \
126-
-d "$EMAIL_BODY" || echo "Failed to send notification"
127-
128-
- name: Stop Container App
129-
if: always()
130-
uses: azure/cli@v2
131-
with:
132-
azcliversion: 'latest'
133-
inlineScript: |
134-
az rest -m post -u "/subscriptions/${{ secrets.AZURE_SUBSCRIPTION_ID }}/resourceGroups/${{ vars.CODEMOD_RG }}/providers/Microsoft.App/containerApps/${{ vars.CODEMOD_FRONTEND_CONTAINER_NAME }}/stop?api-version=2025-01-01"
135-
az rest -m post -u "/subscriptions/${{ secrets.AZURE_SUBSCRIPTION_ID }}/resourceGroups/${{ vars.CODEMOD_RG }}/providers/Microsoft.App/containerApps/${{ vars.CODEMOD_BACKEND_CONTAINER_NAME }}/stop?api-version=2025-01-01"
136-
az logout
117+
-d "$EMAIL_BODY" || echo "Failed to send notification"

infra/deploy_keyvault.bicep

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
@minLength(3)
2-
@maxLength(15)
3-
@description('Solution Name')
4-
param solutionName string
51
param solutionLocation string
62
param managedIdentityObjectId string
73

infra/main.bicep

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ module kvault 'deploy_keyvault.bicep' = {
123123
name: 'deploy_keyvault'
124124
params: {
125125
keyvaultName: '${abbrs.security.keyVault}${ResourcePrefix}'
126-
solutionName: ResourcePrefix
127126
solutionLocation: solutionLocation
128127
managedIdentityObjectId:managedIdentityModule.outputs.managedIdentityOutput.objectId
129128
}
@@ -508,3 +507,4 @@ module deploymentScriptCLI 'br/public:avm/res/resources/deployment-script:0.5.1'
508507
}
509508

510509
output AZURE_AIFOUNDRY_NAME string = azureAiServices.name
510+
output WEB_APP_URL string = 'https://${containerAppFrontend.outputs.fqdn}'

infra/main.json

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"_generator": {
66
"name": "bicep",
77
"version": "0.35.1.17967",
8-
"templateHash": "13571363186442322406"
8+
"templateHash": "11434822242315080162"
99
}
1010
},
1111
"parameters": {
@@ -50,6 +50,10 @@
5050
"description": "Capacity of the GPT deployment:"
5151
}
5252
},
53+
"existingLogAnalyticsWorkspaceId": {
54+
"type": "string",
55+
"defaultValue": ""
56+
},
5357
"deploymentType": {
5458
"type": "string",
5559
"defaultValue": "GlobalStandard",
@@ -727,9 +731,6 @@
727731
"keyvaultName": {
728732
"value": "[format('{0}{1}', variables('abbrs').security.keyVault, variables('ResourcePrefix'))]"
729733
},
730-
"solutionName": {
731-
"value": "[variables('ResourcePrefix')]"
732-
},
733734
"solutionLocation": {
734735
"value": "[parameters('solutionLocation')]"
735736
},
@@ -744,18 +745,10 @@
744745
"_generator": {
745746
"name": "bicep",
746747
"version": "0.35.1.17967",
747-
"templateHash": "14711167186840027914"
748+
"templateHash": "1503106947863889964"
748749
}
749750
},
750751
"parameters": {
751-
"solutionName": {
752-
"type": "string",
753-
"minLength": 3,
754-
"maxLength": 15,
755-
"metadata": {
756-
"description": "Solution Name"
757-
}
758-
},
759752
"solutionLocation": {
760753
"type": "string"
761754
},
@@ -871,6 +864,9 @@
871864
},
872865
"aiServicesId": {
873866
"value": "[resourceId('Microsoft.CognitiveServices/accounts', variables('azureAiServicesName'))]"
867+
},
868+
"existingLogAnalyticsWorkspaceId": {
869+
"value": "[parameters('existingLogAnalyticsWorkspaceId')]"
874870
}
875871
},
876872
"template": {
@@ -880,7 +876,7 @@
880876
"_generator": {
881877
"name": "bicep",
882878
"version": "0.35.1.17967",
883-
"templateHash": "6185941478702970428"
879+
"templateHash": "12979035986870693989"
884880
}
885881
},
886882
"parameters": {
@@ -915,6 +911,10 @@
915911
},
916912
"aiServicesId": {
917913
"type": "string"
914+
},
915+
"existingLogAnalyticsWorkspaceId": {
916+
"type": "string",
917+
"defaultValue": ""
918918
}
919919
},
920920
"variables": {
@@ -1145,6 +1145,10 @@
11451145
"virtualDesktopScalingPlan": "vdscaling-"
11461146
}
11471147
},
1148+
"useExisting": "[not(empty(parameters('existingLogAnalyticsWorkspaceId')))]",
1149+
"existingLawSubscription": "[if(variables('useExisting'), split(parameters('existingLogAnalyticsWorkspaceId'), '/')[2], '')]",
1150+
"existingLawResourceGroup": "[if(variables('useExisting'), split(parameters('existingLogAnalyticsWorkspaceId'), '/')[4], '')]",
1151+
"existingLawName": "[if(variables('useExisting'), split(parameters('existingLogAnalyticsWorkspaceId'), '/')[8], '')]",
11481152
"abbrs": "[variables('$fxv#0')]",
11491153
"storageName": "[format('{0}{1}', variables('abbrs').storage.storageAccount, parameters('solutionName'))]",
11501154
"storageSkuName": "Standard_LRS",
@@ -1184,6 +1188,7 @@
11841188
]
11851189
},
11861190
{
1191+
"condition": "[not(variables('useExisting'))]",
11871192
"type": "Microsoft.OperationalInsights/workspaces",
11881193
"apiVersion": "2023-09-01",
11891194
"name": "[variables('workspaceName')]",
@@ -1474,7 +1479,7 @@
14741479
},
14751480
"logAnalyticsId": {
14761481
"type": "string",
1477-
"value": "[resourceId('Microsoft.OperationalInsights/workspaces', variables('workspaceName'))]"
1482+
"value": "[if(variables('useExisting'), extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', variables('existingLawSubscription'), variables('existingLawResourceGroup')), 'Microsoft.OperationalInsights/workspaces', variables('existingLawName')), resourceId('Microsoft.OperationalInsights/workspaces', variables('workspaceName')))]"
14781483
},
14791484
"storageAccountId": {
14801485
"type": "string",
@@ -7725,5 +7730,15 @@
77257730
"[extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', 'deploy_managed_identity')]"
77267731
]
77277732
}
7728-
]
7733+
],
7734+
"outputs": {
7735+
"AZURE_AIFOUNDRY_NAME": {
7736+
"type": "string",
7737+
"value": "[variables('azureAiServicesName')]"
7738+
},
7739+
"WEB_APP_URL": {
7740+
"type": "string",
7741+
"value": "[format('https://{0}', reference(resourceId('Microsoft.Resources/deployments', toLower(format('{0}{1}containerAppFrontend', variables('abbrs').containers.containerApp, variables('ResourcePrefix')))), '2022-09-01').outputs.fqdn.value)]"
7742+
}
7743+
}
77297744
}

0 commit comments

Comments
 (0)