Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 3 additions & 31 deletions eng/pipelines/templates/stages/cosmos-sdk-client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,37 +126,9 @@ stages:
jdkVersionOption: $(JavaTestVersion)

PreRunSteps:
- powershell: |
Write-Host "Downloading Cosmos Emulator - $(EmulatorMsiUrl)"
Invoke-WebRequest "$(EmulatorMsiUrl)" -OutFile "$env:temp\azure-cosmosdb-emulator.msi"
Write-Host "Finished Downloading Cosmos Emulator - $env:temp\azure-cosmosdb-emulator.msi"
dir "$env:temp"
displayName: 'Download Public Cosmos DB Emulator'

- script: |
choco install lessmsi
choco upgrade lessmsi
mkdir "%TEMP%\Azure Cosmos DB Emulator"
lessmsi x "%TEMP%\azure-cosmosdb-emulator.msi" "%TEMP%\Azure Cosmos DB Emulator\"
displayName: 'Install Public Cosmos DB Emulator'

- powershell: |
Write-Host "Starting Comsos DB Emulator"
Start-Process "$env:Temp\Azure Cosmos DB Emulator\SourceDir\Azure Cosmos DB Emulator\CosmosDB.Emulator.exe" "/NoExplorer /NoUI /DisableRateLimiting /PartitionCount=100 /Consistency=Strong" -Verb RunAs
displayName: 'Run Public Cosmos DB Emulator'

- powershell: |
Import-Module "$env:Temp\Azure Cosmos DB Emulator\SourceDir\Azure Cosmos DB Emulator\PSModules\Microsoft.Azure.CosmosDB.Emulator"

Do {
sleep 5
$cosmosStatus = Get-CosmosDbEmulatorStatus
Write-Host "Cosmos Status: $cosmosStatus"
} While ($cosmosStatus -ne 'Running')

Write-Host "Done"
displayName: 'Check Public Cosmos DB Emulator Status'

- template: ../steps/cosmos-emulator.yml
parameters:
StartParameters: '-PartitionCount 100 -Consistency Strong -Timeout 600'
- powershell: |
$Key = 'C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw=='
$password = ConvertTo-SecureString -String $Key -Force -AsPlainText
Expand Down
16 changes: 16 additions & 0 deletions eng/pipelines/templates/steps/cosmos-emulator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
parameters:
EmulatorMsiUrl: "https://aka.ms/cosmosdb-emulator"
StartParameters: ''
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should have start parameters like the above mentioned ones...

"/DisableRateLimiting /PartitionCount=100 /Consistency=Strong"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just added them into the calling template:

/NoExplorer /NoUI /DisableRateLimiting /PartitionCount=100 /Consistency=Strong

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read through the implementation of the module. The /NoExplorer option is on by default, and /DisableRateLimiting is also the default in the PowerShell cmdlet. These changes should do the trick. I'll verify it runs green and then merge.


steps:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have the template in the tools repo see https://github.com/Azure/azure-sdk-tools/blob/master/eng/pipelines/templates/steps/cosmos-emulator.yml. We can either reference it directly or move it under eng/common.

- powershell: |
$targetDir = $env:temp
Write-Host "Downloading and extracting Cosmos DB Emulator - ${{ parameters.EmulatorMsiUrl }}"
Write-Host "Target Dir: $targetDir"
msiexec /a ${{ parameters.EmulatorMsiUrl }} TARGETDIR=$targetDir /qn | wait-process
displayName: Download and Extract Public Cosmos DB Emulator
- powershell: |
Write-Host "Launching Cosmos DB Emulator"
Import-Module "$env:temp\Azure Cosmos DB Emulator\PSModules\Microsoft.Azure.CosmosDB.Emulator"
Start-CosmosDbEmulator -NoUI ${{ parameters.StartParameters }}
displayName: Start Cosmos DB Emulator
1 change: 0 additions & 1 deletion eng/pipelines/templates/variables/globals.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ variables:
MemoryOptions: '-Xmx3072m'
#Agent.Source.Git.ShallowFetchDepth: 1
skipComponentGovernanceDetection: true
EmulatorMsiUrl: 'https://aka.ms/cosmosdb-emulator'
AdditionalOptions: ''
# format !<group1Id>:<artifact1Id>, !<group2Id>:<artifact2Id>,... no trailing comma is necessary
PLSkipOptions: ''
Expand Down