azure-sdk-for-cpp icon indicating copy to clipboard operation
azure-sdk-for-cpp copied to clipboard

QoL improvement: When a build step fails in CI and there is no `vcpkg-bootstrap.log` file, the `Show build failure logs` step should fail gracefully

Open ahsonkhan opened this issue 1 year ago • 0 comments

See the following: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=3569785&view=logs&j=cf190778-6463-53b7-8403-1b11d749bb88&t=8df7dc72-aaf4-5a02-38f9-efaf86efd0b7

The following pipeline failed on the step above (cmake build All) due to some build issue unrelated to vcpkg. Therefore, there was no vcpkg-bootstrap.log file generated. However, the next step Show build failure logs expects such a file to exist and fails. It should be written to handle that case, gracefully, and probably pass, to avoid chasing red herrings on what went wrong.

Log file: vcpkg-bootstrap.log
==============================================================================================================================
Get-Content : Cannot find path 'D:\a\_work\1\s\vcpkg-bootstrap.log' because it does not exist.
At D:\a\_work\1\s\eng\scripts\Show-FailureLogs.ps1:22 char:5
+     Get-Content $logFile | Write-Host
+     ~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (D:\a\_work\1\s\vcpkg-bootstrap.log:String) [Get-Content], ItemNotFoundE 
   xception
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetContentCommand
 
##[error]PowerShell exited with code '1'.

cc @danieljurek

ahsonkhan avatar Mar 08 '24 02:03 ahsonkhan