Add exit 1 to each error case (#5092)

This commit is contained in:
Mikhail Timofeev
2022-02-16 19:56:48 +03:00
committed by GitHub
parent 5e8049b8dc
commit 000b805803

View File

@@ -71,6 +71,7 @@ if ($env:AGENT_JOBSTATUS -eq 'Failed') {
Write-Host "VM has been successfully powered off and renamed to [${VMName}_failed]"
} catch {
Write-Host "##vso[task.LogIssue type=error;]Failed to power off and rename VM '$VMName'"
exit 1
}
}
@@ -79,6 +80,7 @@ try {
Write-Host "VM has been moved successfully to target datastore '$TargetDataStore'"
} catch {
Write-Host "##vso[task.LogIssue type=error;]Failed to move VM '$VMName' to target datastore '$TargetDataStore'"
exit 1
}
try {
@@ -86,4 +88,5 @@ try {
$vm | Set-VM -NumCPU $CpuCount -CoresPerSocket $CoresPerSocketCount -MemoryMB $Memory -Confirm:$false -ErrorAction Stop | Out-Null
} catch {
Write-Host "##vso[task.LogIssue type=error;]Failed to change specs for VM '$VMName'"
exit 1
}