Skip to content

Commit

Permalink
Create load test resource using ARM Template (#11)
Browse files Browse the repository at this point in the history
* Add template.json file

* Create parameters.json

* Update azure-pipelines.yml

* Update azure-pipelines.yml

* Update workflow.yml
  • Loading branch information
ninallam authored Jan 27, 2022
1 parent 0ff6fc5 commit 5618e58
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 1 deletion.
17 changes: 16 additions & 1 deletion .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,22 @@ jobs:
continue-on-error: false
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}


- name: Create Resource Group
uses: azure/powershell@v1
continue-on-error: false
with:
inlineScript: |
az group create --name "${{ env.LOAD_TEST_RESOURCE_GROUP }}" --location "${{ env.LOCATION }}"
azPSVersion: "latest"

- name: Create Azure Load Testing resource
uses: azure/arm-deploy@v1
with:
resourceGroupName: ${{ env.LOAD_TEST_RESOURCE_GROUP }}
template: ./ARMTemplate/template.json
parameters: ./ARMTemplate/parameters.json name=${{ env.LOAD_TEST_RESOURCE }} location="${{ env.LOCATION }}"

- name: 'Azure Load Testing'
uses: azure/load-testing@v1
with:
Expand Down
15 changes: 15 additions & 0 deletions ARMTemplate/parameters.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"name": {
"value": ""
},
"location": {
"value": ""
},
"tags": {
"value": {}
}
}
}
24 changes: 24 additions & 0 deletions ARMTemplate/template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"$schema": "http://schema.management.azure.com/schemas/2019-08-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"name": {
"type": "String"
},
"location": {
"type": "String"
},
"tags": {
"type": "Object"
}
},
"resources": [
{
"type": "Microsoft.LoadTestService/loadtests",
"apiVersion": "2021-12-01-preview",
"name": "[parameters('name')]",
"location": "[parameters('location')]",
"tags": "[parameters('tags')]"
}
]
}
15 changes: 15 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,21 @@ stages:
pool:
vmImage: ubuntu-latest
steps:

- task: AzureResourceManagerTemplateDeployment@3
inputs:
deploymentScope: 'Resource Group'
azureResourceManagerConnection: $(serviceConnection)
subscriptionId: $(azureSubscriptionId)
action: 'Create Or Update Resource Group'
resourceGroupName: $(loadTestResourceGroup)
location: '$(location)'
templateLocation: 'Linked artifact'
csmFile: '$(System.DefaultWorkingDirectory)/ARMTemplate/template.json'
csmParametersFile: '$(System.DefaultWorkingDirectory)/ARMTemplate/parameters.json'
overrideParameters: '-name $(loadTestResource) -location "$(location)"'
deploymentMode: 'Incremental'

- task: AzureLoadTest@1
inputs:
azureSubscription: $(serviceConnection)
Expand Down

0 comments on commit 5618e58

Please sign in to comment.