diff --git a/.vscode/cspell.json b/.vscode/cspell.json index b1fdfae93c..3447e7d91e 100644 --- a/.vscode/cspell.json +++ b/.vscode/cspell.json @@ -201,6 +201,7 @@ "rtti", "rwxrw", "sasia", + "sbom", "Schonberger", "scus", "SDDL", @@ -251,6 +252,7 @@ "Wunused", "xbox", "Xclang", + "xcode", "XSMB", "zulu" ], diff --git a/eng/pipelines/templates/jobs/ci.tests.yml b/eng/pipelines/templates/jobs/ci.tests.yml index 0edd5b26e4..74844e3820 100644 --- a/eng/pipelines/templates/jobs/ci.tests.yml +++ b/eng/pipelines/templates/jobs/ci.tests.yml @@ -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 diff --git a/eng/pipelines/templates/jobs/cmake-generate.tests.yml b/eng/pipelines/templates/jobs/cmake-generate.tests.yml index 46d4149343..67c0382ae8 100644 --- a/eng/pipelines/templates/jobs/cmake-generate.tests.yml +++ b/eng/pipelines/templates/jobs/cmake-generate.tests.yml @@ -92,3 +92,5 @@ jobs: GenerateArgs: ${{ cmakeOption.Value }} Env: "$(CmakeEnvArg)" PackageName: ${{ artifact.Name }} + + - template: /eng/pipelines/templates/steps/show-failure-logs.yml diff --git a/eng/pipelines/templates/jobs/live.tests.yml b/eng/pipelines/templates/jobs/live.tests.yml index f3c1479de8..01efcb2925 100644 --- a/eng/pipelines/templates/jobs/live.tests.yml +++ b/eng/pipelines/templates/jobs/live.tests.yml @@ -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 }} diff --git a/eng/pipelines/templates/steps/cmake-generate.yml b/eng/pipelines/templates/steps/cmake-generate.yml index 124b869fe4..1d471284f4 100644 --- a/eng/pipelines/templates/steps/cmake-generate.yml +++ b/eng/pipelines/templates/steps/cmake-generate.yml @@ -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 }} diff --git a/eng/pipelines/templates/steps/show-failure-logs.yml b/eng/pipelines/templates/steps/show-failure-logs.yml new file mode 100644 index 0000000000..9d257a778e --- /dev/null +++ b/eng/pipelines/templates/steps/show-failure-logs.yml @@ -0,0 +1,6 @@ +steps: + - task: PowerShell@2 + condition: failed() + displayName: Show build failure logs + inputs: + filePath: eng/scripts/Show-FailureLogs.ps1 diff --git a/eng/scripts/Show-FailureLogs.ps1 b/eng/scripts/Show-FailureLogs.ps1 new file mode 100644 index 0000000000..d2ec123b0d --- /dev/null +++ b/eng/scripts/Show-FailureLogs.ps1 @@ -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 \ No newline at end of file