Skip to content

Commit 13e2b9c

Browse files
committed
Add dry run flag to install Win 10 SDK script
1 parent 8ab9c4f commit 13e2b9c

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

.buildkite/pipeline.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ steps:
124124
- label: ":windows: install_windows_10_sdk Tests - Standard version file"
125125
command: |
126126
echo '20348' > .windows-10-sdk-version
127-
bin/install_windows_10_sdk.ps1
127+
bin/install_windows_10_sdk.ps1 -DryRun
128128
agents:
129129
queue: windows
130130
notify:
@@ -134,7 +134,7 @@ steps:
134134
- label: ":windows: install_windows_10_sdk Tests - Version file with new lines"
135135
command: |
136136
echo "20348\n\n" > .windows-10-sdk-version
137-
bin/install_windows_10_sdk.ps1
137+
bin/install_windows_10_sdk.ps1 -DryRun
138138
agents:
139139
queue: windows
140140
notify:
@@ -144,7 +144,7 @@ steps:
144144
- label: ":windows: install_windows_10_sdk Tests - Version file with a word"
145145
command: |
146146
echo "not an integer" > .windows-10-sdk-version
147-
bin/install_windows_10_sdk.ps1
147+
bin/install_windows_10_sdk.ps1 -DryRun
148148
agents:
149149
queue: windows
150150
notify:

bin/install_windows_10_sdk.ps1

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
param ( # parameters need to be defined at the top of the script
2+
[switch]$DryRun = $false
3+
)
4+
15
# Stop script execution when a non-terminating error occurs
26
$ErrorActionPreference = "Stop"
37

@@ -27,6 +31,11 @@ if ($windows10SDKVersion -notmatch '^\d+$') {
2731

2832
Write-Host "Will attempt to set up Windows 10 ($windows10SDKVersion) SDK and Visual Studio Build Tools..."
2933

34+
if ($DryRun) {
35+
Write-Output "Running in dry run mode, finishing here."
36+
exit 0
37+
}
38+
3039
# Download the Visual Studio Build Tools Bootstrapper
3140
Write-Output "~~~ Downloading Visual Studio Build Tools..."
3241

0 commit comments

Comments
 (0)