Change VM size to Standard_D32ds_v4. For some reason they are cheaper than D16 right now??? (#18953)

Remove no longer used "unstable" scaffolding.
Use ephemeral OS disks for better latency.
Add ability to change whether temp disks are used or explicitly provisioned disks are used; explicitly provisioned disks turned out to be more expensive than expected before.
Disable Windows Updates in the scale set because the machines are very short lived; working on a mechanism of patching the images instead.
This commit is contained in:
Billy O'Neal 2021-07-15 13:47:58 -07:00 committed by GitHub
parent 071f53715b
commit f698b0e8be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 72 additions and 49 deletions

View File

@ -2,8 +2,8 @@
# SPDX-License-Identifier: MIT
#
variables:
windows-pool: 'PrWin-2021-07-09'
linux-pool: 'PrLin-2021-07-13'
windows-pool: 'PrWin-2021-07-14'
linux-pool: 'PrLin-2021-07-14'
osx-pool: 'PrOsx-2021-04-16'
stages:

View File

@ -20,9 +20,11 @@ This script assumes you have installed the OpenSSH Client optional Windows compo
$Location = 'westus2'
$Prefix = 'PrLin-' + (Get-Date -Format 'yyyy-MM-dd')
$VMSize = 'Standard_D32_v4'
$VMSize = 'Standard_D32ds_v4'
$ProtoVMName = 'PROTOTYPE'
$LiveVMPrefix = 'BUILD'
$MakeInstalledDisk = $false
$InstalledDiskSizeInGB = 1024
$ErrorActionPreference = 'Stop'
$ProgressActivity = 'Creating Scale Set'
@ -189,6 +191,12 @@ $SasToken = New-AzStorageAccountSASToken `
$SasToken = $SasToken.Substring(1) # strip leading ?
Write-Progress `
-Activity $ProgressActivity `
-Status 'Creating storage account' `
-CurrentOperation 'Locking down network' `
-PercentComplete (100 / $TotalProgress * $CurrentProgress) # note no ++
# Note that we put the storage account into the firewall after creating the above SAS token or we
# would be denied since the person running this script isn't one of the VMs we're creating here.
Set-AzStorageAccount `
@ -292,7 +300,8 @@ Set-AzVM `
$VM = Get-AzVM -ResourceGroupName $ResourceGroupName -Name $ProtoVMName
$PrototypeOSDiskName = $VM.StorageProfile.OsDisk.Name
$ImageConfig = New-AzImageConfig -Location $Location -SourceVirtualMachineId $VM.ID
$Image = New-AzImage -Image $ImageConfig -ImageName $ProtoVMName -ResourceGroupName $ResourceGroupName
$ImageName = "$Prefix-BaseImage"
$Image = New-AzImage -Image $ImageConfig -ImageName $ImageName -ResourceGroupName $ResourceGroupName
####################################################################################################
Write-Progress `
@ -333,28 +342,41 @@ $Vmss = Add-AzVmssNetworkInterfaceConfiguration `
$VmssPublicKey = New-Object -TypeName 'Microsoft.Azure.Management.Compute.Models.SshPublicKey' `
-ArgumentList @('/home/AdminUser/.ssh/authorized_keys', $sshPublicKey)
$Vmss = Set-AzVmssOsProfile `
-VirtualMachineScaleSet $Vmss `
-ComputerNamePrefix $LiveVMPrefix `
-AdminUsername AdminUser `
-AdminPassword $AdminPW `
-LinuxConfigurationDisablePasswordAuthentication $true `
-PublicKey @($VmssPublicKey) `
-CustomData ([Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("#!/bin/bash`n/etc/provision-disks.sh`n")))
if ($MakeInstalledDisk) {
$Vmss = Set-AzVmssOsProfile `
-VirtualMachineScaleSet $Vmss `
-ComputerNamePrefix $LiveVMPrefix `
-AdminUsername AdminUser `
-AdminPassword $AdminPW `
-LinuxConfigurationDisablePasswordAuthentication $true `
-PublicKey @($VmssPublicKey) `
-CustomData ([Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("#!/bin/bash`n/etc/provision-disks.sh`n")))
} else {
$Vmss = Set-AzVmssOsProfile `
-VirtualMachineScaleSet $Vmss `
-ComputerNamePrefix $LiveVMPrefix `
-AdminUsername AdminUser `
-AdminPassword $AdminPW `
-LinuxConfigurationDisablePasswordAuthentication $true `
-PublicKey @($VmssPublicKey)
}
$Vmss = Set-AzVmssStorageProfile `
-VirtualMachineScaleSet $Vmss `
-OsDiskCreateOption 'FromImage' `
-OsDiskCaching ReadWrite `
-OsDiskCaching ReadOnly `
-DiffDiskSetting Local `
-ImageReferenceId $Image.Id
$Vmss = Add-AzVmssDataDisk `
-VirtualMachineScaleSet $Vmss `
-Lun 0 `
-Caching 'ReadWrite' `
-CreateOption Empty `
-DiskSizeGB 1024 `
-StorageAccountType 'StandardSSD_LRS'
if ($MakeInstalledDisk) {
$Vmss = Add-AzVmssDataDisk `
-VirtualMachineScaleSet $Vmss `
-Lun 0 `
-Caching 'ReadWrite' `
-CreateOption Empty `
-DiskSizeGB $InstalledDiskSizeInGB `
-StorageAccountType 'StandardSSD_LRS'
}
New-AzVmss `
-ResourceGroupName $ResourceGroupName `

View File

@ -15,13 +15,6 @@ This script assumes you have installed Azure tools into PowerShell by following
at https://docs.microsoft.com/en-us/powershell/azure/install-az-ps?view=azps-3.6.1
or are running from Azure Cloud Shell.
.PARAMETER Unstable
If this parameter is set, the machine is configured for use in the "unstable" pool used for testing
the compiler rather than for testing vcpkg. Differences:
* The machine prefix is changed to VcpkgUnstable instead of PrWin.
* No storage account or "archives" share is provisioned.
* The firewall is not opened to allow communication with Azure Storage.
.PARAMETER CudnnPath
The path to a CUDNN zip file downloaded from NVidia official sources
(e.g. https://developer.nvidia.com/compute/machine-learning/cudnn/secure/8.1.1.33/11.2_20210301/cudnn-11.2-windows-x64-v8.1.1.33.zip
@ -30,28 +23,28 @@ downloaded in a browser with an NVidia account logged in.)
[CmdLetBinding()]
Param(
[switch]$Unstable = $false,
[parameter(Mandatory=$true)]
[string]$CudnnPath
)
$Location = 'westus2'
if ($Unstable) {
$Prefix = 'VcpkgUnstable-'
} else {
$Prefix = 'PrWin-'
}
$Prefix = 'PrWin-'
$Prefix += (Get-Date -Format 'yyyy-MM-dd')
$VMSize = 'Standard_D32_v4'
$VMSize = 'Standard_D32ds_v4'
$ProtoVMName = 'PROTOTYPE'
$LiveVMPrefix = 'BUILD'
$WindowsServerSku = '2019-Datacenter'
$MakeInstalledDisk = $false
$InstalledDiskSizeInGB = 1024
$ErrorActionPreference = 'Stop'
$ProgressActivity = 'Creating Scale Set'
$TotalProgress = 21
$TotalProgress = 20
if ($MakeInstalledDisk) {
$TotalProgress++
}
$CurrentProgress = 1
Import-Module "$PSScriptRoot/../create-vmss-helpers.psm1" -DisableNameChecking
@ -274,14 +267,16 @@ $VM = Set-AzVMSourceImage `
-Version latest
$InstallDiskName = $ProtoVMName + "InstallDisk"
$VM = Add-AzVMDataDisk `
-Vm $VM `
-Name $InstallDiskName `
-Lun 0 `
-Caching ReadWrite `
-CreateOption Empty `
-DiskSizeInGB $InstalledDiskSizeInGB `
-StorageAccountType 'StandardSSD_LRS'
if ($MakeInstalledDisk) {
$VM = Add-AzVMDataDisk `
-Vm $VM `
-Name $InstallDiskName `
-Lun 0 `
-Caching ReadWrite `
-CreateOption Empty `
-DiskSizeInGB $InstalledDiskSizeInGB `
-StorageAccountType 'StandardSSD_LRS'
}
$VM = Set-AzVMBootDiagnostic -VM $VM -Disable
New-AzVm `
@ -437,8 +432,10 @@ try {
Restart-AzVM -ResourceGroupName $ResourceGroupName -Name $ProtoVMName
####################################################################################################
Invoke-ScriptWithPrefix -ScriptName 'deploy-install-disk.ps1'
Restart-AzVM -ResourceGroupName $ResourceGroupName -Name $ProtoVMName
if ($MakeInstalledDisk) {
Invoke-ScriptWithPrefix -ScriptName 'deploy-install-disk.ps1'
Restart-AzVM -ResourceGroupName $ResourceGroupName -Name $ProtoVMName
}
####################################################################################################
Write-Progress `
@ -481,7 +478,8 @@ Set-AzVM `
$VM = Get-AzVM -ResourceGroupName $ResourceGroupName -Name $ProtoVMName
$PrototypeOSDiskName = $VM.StorageProfile.OsDisk.Name
$ImageConfig = New-AzImageConfig -Location $Location -SourceVirtualMachineId $VM.ID
$Image = New-AzImage -Image $ImageConfig -ImageName $ProtoVMName -ResourceGroupName $ResourceGroupName
$ImageName = "$Prefix-BaseImage"
$Image = New-AzImage -Image $ImageConfig -ImageName $ImageName -ResourceGroupName $ResourceGroupName
####################################################################################################
Write-Progress `
@ -491,7 +489,9 @@ Write-Progress `
Remove-AzVM -Id $VM.ID -Force
Remove-AzDisk -ResourceGroupName $ResourceGroupName -DiskName $PrototypeOSDiskName -Force
Remove-AzDisk -ResourceGroupName $ResourceGroupName -DiskName $InstallDiskName -Force
if ($MakeInstalledDisk) {
Remove-AzDisk -ResourceGroupName $ResourceGroupName -DiskName $InstallDiskName -Force
}
####################################################################################################
Write-Progress `
@ -526,12 +526,13 @@ $Vmss = Set-AzVmssOsProfile `
-AdminUsername 'AdminUser' `
-AdminPassword $AdminPW `
-WindowsConfigurationProvisionVMAgent $true `
-WindowsConfigurationEnableAutomaticUpdate $true
-WindowsConfigurationEnableAutomaticUpdate $false
$Vmss = Set-AzVmssStorageProfile `
-VirtualMachineScaleSet $Vmss `
-OsDiskCreateOption 'FromImage' `
-OsDiskCaching ReadWrite `
-OsDiskCaching ReadOnly `
-DiffDiskSetting Local `
-ImageReferenceId $Image.Id
New-AzVmss `