diff options
| author | Billy O'Neal <bion@microsoft.com> | 2020-09-28 13:54:10 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-09-28 13:54:10 -0700 |
| commit | 4dc9ecd32b972af1da00d7011f9b9822b4254ef7 (patch) | |
| tree | c4f582ebb51528084dcdfb21a648b4922c03da41 /scripts/azure-pipelines/windows | |
| parent | f25ffef6bf0ea5a28f36b6abcef57d2d1cfc6882 (diff) | |
| download | vcpkg-4dc9ecd32b972af1da00d7011f9b9822b4254ef7.tar.gz vcpkg-4dc9ecd32b972af1da00d7011f9b9822b4254ef7.zip | |
Add MSVC-internal testing scripts to public GitHub. (#13748)
Diffstat (limited to 'scripts/azure-pipelines/windows')
| -rw-r--r-- | scripts/azure-pipelines/windows/create-vmss.ps1 | 109 | ||||
| -rw-r--r-- | scripts/azure-pipelines/windows/initialize-environment.ps1 | 23 |
2 files changed, 82 insertions, 50 deletions
diff --git a/scripts/azure-pipelines/windows/create-vmss.ps1 b/scripts/azure-pipelines/windows/create-vmss.ps1 index 3bb89ee25..1fcec50ed 100644 --- a/scripts/azure-pipelines/windows/create-vmss.ps1 +++ b/scripts/azure-pipelines/windows/create-vmss.ps1 @@ -14,10 +14,28 @@ for more information. This script assumes you have installed Azure tools into PowerShell by following the instructions
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.
#>
+[CmdLetBinding()]
+Param(
+ [switch]$Unstable = $false
+)
+
$Location = 'westus2'
-$Prefix = 'PrWin-' + (Get-Date -Format 'yyyy-MM-dd')
+if ($Unstable) {
+ $Prefix = 'VcpkgUnstable-'
+} else {
+ $Prefix = 'PrWin-'
+}
+
+$Prefix += (Get-Date -Format 'yyyy-MM-dd')
$VMSize = 'Standard_D16a_v4'
$ProtoVMName = 'PROTOTYPE'
$LiveVMPrefix = 'BUILD'
@@ -26,6 +44,10 @@ $ErrorActionPreference = 'Stop' $ProgressActivity = 'Creating Scale Set'
$TotalProgress = 12
+if ($Unstable) {
+ $TotalProgress -= 1 # skipping the archives share part
+}
+
$CurrentProgress = 1
Import-Module "$PSScriptRoot/../create-vmss-helpers.psm1" -DisableNameChecking
@@ -84,17 +106,19 @@ $allowGit = New-AzNetworkSecurityRuleConfig ` -DestinationAddressPrefix * `
-DestinationPortRange 9418
-$allowStorage = New-AzNetworkSecurityRuleConfig `
- -Name AllowStorage `
- -Description 'Allow Storage' `
- -Access Allow `
- -Protocol * `
- -Direction Outbound `
- -Priority 1011 `
- -SourceAddressPrefix VirtualNetwork `
- -SourcePortRange * `
- -DestinationAddressPrefix Storage `
- -DestinationPortRange *
+if (-Not $Unstable) {
+ $allowStorage = New-AzNetworkSecurityRuleConfig `
+ -Name AllowStorage `
+ -Description 'Allow Storage' `
+ -Access Allow `
+ -Protocol * `
+ -Direction Outbound `
+ -Priority 1011 `
+ -SourceAddressPrefix VirtualNetwork `
+ -SourcePortRange * `
+ -DestinationAddressPrefix Storage `
+ -DestinationPortRange *
+}
$denyEverythingElse = New-AzNetworkSecurityRuleConfig `
-Name DenyElse `
@@ -109,11 +133,18 @@ $denyEverythingElse = New-AzNetworkSecurityRuleConfig ` -DestinationPortRange *
$NetworkSecurityGroupName = $ResourceGroupName + 'NetworkSecurity'
+$securityRules = @($allowHttp, $allowDns, $allowGit);
+if (-Not $Unstable) {
+ $securityRules += @($allowStorage)
+}
+
+$securityRules += @($denyEverythingElse)
+
$NetworkSecurityGroup = New-AzNetworkSecurityGroup `
-Name $NetworkSecurityGroupName `
-ResourceGroupName $ResourceGroupName `
-Location $Location `
- -SecurityRules @($allowHttp, $allowDns, $allowGit, $allowStorage, $denyEverythingElse)
+ -SecurityRules $securityRules
$SubnetName = $ResourceGroupName + 'Subnet'
$Subnet = New-AzVirtualNetworkSubnetConfig `
@@ -130,32 +161,34 @@ $VirtualNetwork = New-AzVirtualNetwork ` -Subnet $Subnet
####################################################################################################
-Write-Progress `
- -Activity $ProgressActivity `
- -Status 'Creating archives storage account' `
- -PercentComplete (100 / $TotalProgress * $CurrentProgress++)
+if (-Not $Unstable) {
+ Write-Progress `
+ -Activity $ProgressActivity `
+ -Status 'Creating archives storage account' `
+ -PercentComplete (100 / $TotalProgress * $CurrentProgress++)
-$StorageAccountName = Sanitize-Name $ResourceGroupName
+ $StorageAccountName = Sanitize-Name $ResourceGroupName
-New-AzStorageAccount `
- -ResourceGroupName $ResourceGroupName `
- -Location $Location `
- -Name $StorageAccountName `
- -SkuName 'Standard_LRS' `
- -Kind StorageV2
+ New-AzStorageAccount `
+ -ResourceGroupName $ResourceGroupName `
+ -Location $Location `
+ -Name $StorageAccountName `
+ -SkuName 'Standard_LRS' `
+ -Kind StorageV2
-$StorageAccountKeys = Get-AzStorageAccountKey `
- -ResourceGroupName $ResourceGroupName `
- -Name $StorageAccountName
+ $StorageAccountKeys = Get-AzStorageAccountKey `
+ -ResourceGroupName $ResourceGroupName `
+ -Name $StorageAccountName
-$StorageAccountKey = $StorageAccountKeys[0].Value
+ $StorageAccountKey = $StorageAccountKeys[0].Value
-$StorageContext = New-AzStorageContext `
- -StorageAccountName $StorageAccountName `
- -StorageAccountKey $StorageAccountKey
+ $StorageContext = New-AzStorageContext `
+ -StorageAccountName $StorageAccountName `
+ -StorageAccountKey $StorageAccountKey
-New-AzStorageShare -Name 'archives' -Context $StorageContext
-Set-AzStorageShareQuota -ShareName 'archives' -Context $StorageContext -Quota 2048
+ New-AzStorageShare -Name 'archives' -Context $StorageContext
+ Set-AzStorageShareQuota -ShareName 'archives' -Context $StorageContext -Quota 2048
+}
####################################################################################################
Write-Progress `
@@ -198,14 +231,18 @@ Write-Progress ` -Status 'Running provisioning script provision-image.txt (as a .ps1) in VM' `
-PercentComplete (100 / $TotalProgress * $CurrentProgress++)
+$provisionParameters = @{AdminUserPassword = $AdminPW;}
+if (-Not $Unstable) {
+ $provisionParameters['StorageAccountName'] = $StorageAccountName
+ $provisionParameters['StorageAccountKey'] = $StorageAccountKey
+}
+
$ProvisionImageResult = Invoke-AzVMRunCommand `
-ResourceGroupName $ResourceGroupName `
-VMName $ProtoVMName `
-CommandId 'RunPowerShellScript' `
-ScriptPath "$PSScriptRoot\provision-image.txt" `
- -Parameter @{AdminUserPassword = $AdminPW; `
- StorageAccountName=$StorageAccountName; `
- StorageAccountKey=$StorageAccountKey;}
+ -Parameter $provisionParameters
Write-Host "provision-image.ps1 output: $($ProvisionImageResult.value.Message)"
diff --git a/scripts/azure-pipelines/windows/initialize-environment.ps1 b/scripts/azure-pipelines/windows/initialize-environment.ps1 index 4a252df49..24520802e 100644 --- a/scripts/azure-pipelines/windows/initialize-environment.ps1 +++ b/scripts/azure-pipelines/windows/initialize-environment.ps1 @@ -8,23 +8,18 @@ Sets up the environment to run other vcpkg CI steps in an Azure Pipelines job. .DESCRIPTION
This script maps network drives from infrastructure and cleans out anything that
might have been leftover from a previous run.
-
-.PARAMETER ForceAllPortsToRebuildKey
-A subdirectory / key to use to force a build without any previous run caching,
-if necessary.
#>
-[CmdletBinding()]
-Param(
- [string]$ForceAllPortsToRebuildKey = ''
-)
-
-$StorageAccountName = $env:StorageAccountName
-$StorageAccountKey = $env:StorageAccountKey
+if ([string]::IsNullOrWhiteSpace($env:StorageAccountName) -or [string]::IsNullOrWhiteSpace($env:StorageAccountKey)) {
+ Write-Host 'No storage account and/or key set, skipping mount of W:\'
+} else {
+ $StorageAccountName = $env:StorageAccountName
+ $StorageAccountKey = $env:StorageAccountKey
-Write-Host 'Setting up archives mount'
-if (-Not (Test-Path W:)) {
- net use W: "\\$StorageAccountName.file.core.windows.net\archives" /u:"AZURE\$StorageAccountName" $StorageAccountKey
+ Write-Host 'Setting up archives mount'
+ if (-Not (Test-Path W:)) {
+ net use W: "\\$StorageAccountName.file.core.windows.net\archives" /u:"AZURE\$StorageAccountName" $StorageAccountKey
+ }
}
Write-Host 'Creating downloads directory'
|
