Skip to content

Commit 6daaf31

Browse files
committed
ci: cleanup install-windows-updates script
1 parent 045c036 commit 6daaf31

File tree

1 file changed

+7
-10
lines changed
  • ci/tasks/install-windows-updates

1 file changed

+7
-10
lines changed

ci/tasks/install-windows-updates/run.sh

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,18 +56,20 @@ function run_powershell_command_with_logging() {
5656
echo "Started '${powershell_command}' with pid '${pid}'" >&2
5757

5858
exit_code=$(get_powershell_pid_exit_code "${pid}")
59-
echo "Exited '${powershell_command}' with exit code '${exit_code}'" >&2
59+
echo "Finished '${powershell_command}' with exit code '${exit_code}'" >&2
6060
}
6161

6262
function wait_for_vm_to_come_up() {
63+
echo "Checking if VM is up" >&2
6364
result=-1
64-
set +e
6565
while [[ result -ne 0 ]]; do
66-
start_powershell_command Get-ChildItem \\ 2> /dev/null # try to connect
66+
set +e
67+
start_powershell_command Get-ChildItem
6768
result=$?
68-
sleep 1
69+
set -e
70+
sleep 5
6971
done
70-
set -e
72+
echo "VM is up" >&2
7173
}
7274

7375
function get_windows_updates_remaining() {
@@ -91,14 +93,9 @@ while [[ updates_remaining -ne 0 ]]; do
9193
set +e # ignore unreachable agent if the vm just went down for reboot
9294
run_powershell_command_with_logging "Install-WindowsUpdate -AcceptAll -AutoReboot"
9395
set -e
94-
echo "Install-WU done"
9596

96-
# wait for VM to go down and poll for connectivity
97-
echo "Waiting for VM to come back after reboot, if necessary..."
98-
sleep 60
9997
wait_for_vm_to_come_up
10098

101-
echo "VM reachable"
10299
updates_remaining=
103100
while [[ -z "${updates_remaining}" ]] ; do
104101
echo "Trying to discover how many updates remain..."

0 commit comments

Comments
 (0)