Upload logs on cmake generate/build failure (#5293)

* Upload logs on cmake generate/build failure

* Copy relevant files to staging location, clean up after publishing

* Update cspell words

* Test: break cmake generate in a way that'll produce SOME log files.

* Revert "Test: break cmake generate in a way that'll produce SOME log files."

This reverts commit d5a300587b3359ed3f2bf7be5abea40868f958a7.

* Show failure logs instead of uploading artifacts. Only show log files for vcpkg at this time

* Reapply "Test: break cmake generate in a way that'll produce SOME log files."

This reverts commit 582629ad587f3c9b652ac1f8a7eda5e12d46843a.

* Revert "Reapply "Test: break cmake generate in a way that'll produce SOME log files.""

This reverts commit 7a35250c7e598fc6e1c060f896cbc952704e40bf.

* Another type of test

* Revert inadvertent whitespace changes

* Revert "Another type of test"

This reverts commit e38013f95b152e4e2a3b9d27ccf1eb9b63fa1817.

* More logging
This commit is contained in:
Daniel Jurek 2024-02-06 22:36:36 -08:00 committed by GitHub
parent 5a70fcabce
commit ce4f25da23
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 41 additions and 0 deletions

2
.vscode/cspell.json vendored
View File

@ -201,6 +201,7 @@
"rtti",
"rwxrw",
"sasia",
"sbom",
"Schonberger",
"scus",
"SDDL",
@ -251,6 +252,7 @@
"Wunused",
"xbox",
"Xclang",
"xcode",
"XSMB",
"zulu"
],

View File

@ -184,6 +184,8 @@ jobs:
VcpkgArgs: "$(VcpkgArgs)"
Env: "$(CmakeEnvArg)"
- template: /eng/pipelines/templates/steps/show-failure-logs.yml
- template: /eng/common/testproxy/test-proxy-tool.yml
parameters:
runProxy: true

View File

@ -92,3 +92,5 @@ jobs:
GenerateArgs: ${{ cmakeOption.Value }}
Env: "$(CmakeEnvArg)"
PackageName: ${{ artifact.Name }}
- template: /eng/pipelines/templates/steps/show-failure-logs.yml

View File

@ -125,6 +125,8 @@ jobs:
BuildArgs: "$(BuildArgs)"
Env: "$(CmakeEnvArg)"
- template: /eng/pipelines/templates/steps/show-failure-logs.yml
- template: /eng/common/TestResources/build-test-resource-config.yml
parameters:
SubscriptionConfiguration: ${{ parameters.CloudConfig.SubscriptionConfiguration }}

View File

@ -24,6 +24,8 @@ steps:
env:
VCPKG_BINARY_SOURCES: $(VCPKG_BINARY_SOURCES_SECRET)
# The calling job will attempt to upload logs on failure. To that end this
# step should ONLY run on success.
- script: rm -rf build
workingDirectory: ${{ parameters.CmakeGeneratePath }}
displayName: clean build folder for ${{ parameters.PackageName }}

View File

@ -0,0 +1,6 @@
steps:
- task: PowerShell@2
condition: failed()
displayName: Show build failure logs
inputs:
filePath: eng/scripts/Show-FailureLogs.ps1

View File

@ -0,0 +1,25 @@
# Only show contents of particular vcpkg log files whose potentially sensitive
# information will be redacted by DevOps (if it's included).
# Before adding other expressions to output ensure that those logs will not
# contain sensitive information or that DevOps is properly configured to remove
# sensitive information.
$logFiles = Get-ChildItem -Recurse -Filter *.log
$filteredLogs = $logFiles.Where({ $_.Name -in ('vcpkg-bootstrap.log', 'vcpkg-manifest-install.log') })
if (!$filteredLogs) {
Write-Host "No logs found"
exit 0
}
foreach ($logFile in $filteredLogs)
{
Write-Host "//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////"
Write-Host "=============================================================================================================================="
Write-Host "Log file: $logFile"
Write-Host "=============================================================================================================================="
Get-Content $logFile | Write-Host
}
exit 0