aboutsummaryrefslogtreecommitdiff
path: root/scripts/azure-pipelines/windows/deploy-install-disk.ps1
diff options
context:
space:
mode:
authorBilly O'Neal <bion@microsoft.com>2021-06-22 19:16:04 -0700
committerGitHub <noreply@github.com>2021-06-22 19:16:04 -0700
commit2ed44b4546ecc764c81db4fd16ea19d19ea0449d (patch)
tree62bddef170709b99b5ed4d8ed7455bc1f5c7a1ad /scripts/azure-pipelines/windows/deploy-install-disk.ps1
parent08690d82c11eaea801c103238cc2e948b1a60eb5 (diff)
downloadvcpkg-2ed44b4546ecc764c81db4fd16ea19d19ea0449d.tar.gz
vcpkg-2ed44b4546ecc764c81db4fd16ea19d19ea0449d.zip
Update VMs and pick up VS2019 16.10 (#18233)
* Cherry-pick https://github.com/microsoft/vcpkg/pull/15598 * Hook deploy-inteloneapi into create-vmss.ps1. * Add script to resolve https://github.com/microsoft/vcpkg/issues/17521 * Move tls settings deployment to the front and respond to script triggering a reboot. * Go back to provisioning an extra disk to workaround https://github.com/microsoft/vcpkg/issues/18379 * Disallow public access to blob storage and require TLS 1.2. * Update Pools. * Update tool to 2021-06-19 * [simage] Skip simage on uwp platforms as it appears broken by 16.10. * [tensorflow-cc] Skip because changes in our MacOS hardware broke the port.
Diffstat (limited to 'scripts/azure-pipelines/windows/deploy-install-disk.ps1')
-rw-r--r--scripts/azure-pipelines/windows/deploy-install-disk.ps160
1 files changed, 60 insertions, 0 deletions
diff --git a/scripts/azure-pipelines/windows/deploy-install-disk.ps1 b/scripts/azure-pipelines/windows/deploy-install-disk.ps1
new file mode 100644
index 000000000..6bbc17587
--- /dev/null
+++ b/scripts/azure-pipelines/windows/deploy-install-disk.ps1
@@ -0,0 +1,60 @@
+# Copyright (c) Microsoft Corporation.
+# SPDX-License-Identifier: MIT
+
+# REPLACE WITH UTILITY-PREFIX.ps1
+
+<#
+.SYNOPSIS
+Partitions a new physical disk.
+.DESCRIPTION
+Takes the disk $DiskNumber, turns it on, then partitions it for use with label
+$Label and drive letter $Letter.
+.PARAMETER DiskNumber
+The number of the disk to set up.
+.PARAMETER Letter
+The drive letter at which to mount the disk.
+.PARAMETER Label
+The label to give the disk.
+#>
+Function New-PhysicalDisk {
+Param(
+ [int]$DiskNumber,
+ [string]$Letter,
+ [string]$Label
+)
+ if ($Letter.Length -ne 1) {
+ throw "Bad drive letter $Letter, expected only one letter. (Did you accidentially add a : ?)"
+ }
+
+ try {
+ Write-Host "Attempting to online physical disk $DiskNumber"
+ [string]$diskpartScriptPath = Get-TempFilePath -Extension 'txt'
+ [string]$diskpartScriptContent =
+ "SELECT DISK $DiskNumber`r`n" +
+ "ONLINE DISK`r`n"
+
+ Write-Host "Writing diskpart script to $diskpartScriptPath with content:"
+ Write-Host $diskpartScriptContent
+ Set-Content -Path $diskpartScriptPath -Value $diskpartScriptContent
+ Write-Host 'Invoking DISKPART...'
+ & diskpart.exe /s $diskpartScriptPath
+
+ Write-Host "Provisioning physical disk $DiskNumber as drive $Letter"
+ [string]$diskpartScriptContent =
+ "SELECT DISK $DiskNumber`r`n" +
+ "ATTRIBUTES DISK CLEAR READONLY`r`n" +
+ "CREATE PARTITION PRIMARY`r`n" +
+ "FORMAT FS=NTFS LABEL=`"$Label`" QUICK`r`n" +
+ "ASSIGN LETTER=$Letter`r`n"
+ Write-Host "Writing diskpart script to $diskpartScriptPath with content:"
+ Write-Host $diskpartScriptContent
+ Set-Content -Path $diskpartScriptPath -Value $diskpartScriptContent
+ Write-Host 'Invoking DISKPART...'
+ & diskpart.exe /s $diskpartScriptPath
+ }
+ catch {
+ Write-Error "Failed to provision physical disk $DiskNumber as drive $Letter! $($_.Exception.Message)"
+ }
+}
+
+New-PhysicalDisk -DiskNumber 1 -Letter 'E' -Label 'install disk'