From 33e19c8934b26a2508f79353a5c20ba259a9dcac Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 12 Apr 2022 08:29:59 -0600 Subject: [PATCH] Improve pipeline verbosity --- azure-pipelines/Convert-PDB.ps1 | 57 +++++++++++------------ azure-pipelines/artifacts/VSInsertion.ps1 | 17 ++++++- azure-pipelines/microbuild.after.yml | 2 +- 3 files changed, 44 insertions(+), 32 deletions(-) diff --git a/azure-pipelines/Convert-PDB.ps1 b/azure-pipelines/Convert-PDB.ps1 index 2d394e7..f119a16 100644 --- a/azure-pipelines/Convert-PDB.ps1 +++ b/azure-pipelines/Convert-PDB.ps1 @@ -8,36 +8,35 @@ .PARAMETER OutputPath The path of the output PDB to write. #> -#Function Convert-PortableToWindowsPDB() { - Param( - [Parameter(Mandatory=$true,Position=0)] - [string]$DllPath, - [Parameter()] - [string]$PdbPath, - [Parameter(Mandatory=$true,Position=1)] - [string]$OutputPath - ) +[CmdletBinding()] +Param( + [Parameter(Mandatory=$true,Position=0)] + [string]$DllPath, + [Parameter()] + [string]$PdbPath, + [Parameter(Mandatory=$true,Position=1)] + [string]$OutputPath +) - if ($IsMacOS -or $IsLinux) { - Write-Error "This script only works on Windows" - return - } +if ($IsMacOS -or $IsLinux) { + Write-Error "This script only works on Windows" + return +} - $version = '1.1.0-beta2-21101-01' - $baseDir = "$PSScriptRoot/../obj/tools" - $pdb2pdbpath = "$baseDir/Microsoft.DiaSymReader.Pdb2Pdb.$version/tools/Pdb2Pdb.exe" - if (-not (Test-Path $pdb2pdbpath)) { - if (-not (Test-Path $baseDir)) { New-Item -Type Directory -Path $baseDir | Out-Null } - $baseDir = (Resolve-Path $baseDir).Path # Normalize it - Write-Verbose "& (& $PSScriptRoot/Get-NuGetTool.ps1) install Microsoft.DiaSymReader.Pdb2Pdb -version $version -PackageSaveMode nuspec -OutputDirectory $baseDir -Source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json | Out-Null" - & (& $PSScriptRoot/Get-NuGetTool.ps1) install Microsoft.DiaSymReader.Pdb2Pdb -version $version -PackageSaveMode nuspec -OutputDirectory $baseDir -Source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json | Out-Null - } +$version = '1.1.0-beta2-21101-01' +$baseDir = "$PSScriptRoot/../obj/tools" +$pdb2pdbpath = "$baseDir/Microsoft.DiaSymReader.Pdb2Pdb.$version/tools/Pdb2Pdb.exe" +if (-not (Test-Path $pdb2pdbpath)) { + if (-not (Test-Path $baseDir)) { New-Item -Type Directory -Path $baseDir | Out-Null } + $baseDir = (Resolve-Path $baseDir).Path # Normalize it + Write-Verbose "& (& $PSScriptRoot/Get-NuGetTool.ps1) install Microsoft.DiaSymReader.Pdb2Pdb -version $version -PackageSaveMode nuspec -OutputDirectory $baseDir -Source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json | Out-Null" + & (& $PSScriptRoot/Get-NuGetTool.ps1) install Microsoft.DiaSymReader.Pdb2Pdb -version $version -PackageSaveMode nuspec -OutputDirectory $baseDir -Source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json | Out-Null +} - $args = $DllPath,'/out',$OutputPath,'/nowarn','0021' - if ($PdbPath) { - $args += '/pdb',$PdbPath - } +$args = $DllPath,'/out',$OutputPath,'/nowarn','0021' +if ($PdbPath) { + $args += '/pdb',$PdbPath +} - Write-Verbose "$pdb2pdbpath $args" - & $pdb2pdbpath $args -#} +Write-Verbose "$pdb2pdbpath $args" +& $pdb2pdbpath $args diff --git a/azure-pipelines/artifacts/VSInsertion.ps1 b/azure-pipelines/artifacts/VSInsertion.ps1 index 4c56dea..0d1cb37 100644 --- a/azure-pipelines/artifacts/VSInsertion.ps1 +++ b/azure-pipelines/artifacts/VSInsertion.ps1 @@ -4,10 +4,17 @@ .PARAMETER SbomNotRequired Indicates that returning the artifacts available is preferable to nothing at all when the SBOM has not yet been generated. #> +[CmdletBinding()] Param ( [switch]$SbomNotRequired ) +if ($IsMacOS -or $IsLinux) { + # We only package up for insertions on Windows agents since they are where optprof can happen. + Write-Verbose "Skipping VSInsertion artifact since we're not on Windows." + return @{} +} + $RepoRoot = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..") $BuildConfiguration = $env:BUILDCONFIGURATION if (!$BuildConfiguration) { @@ -17,9 +24,15 @@ if (!$BuildConfiguration) { $PackagesRoot = "$RepoRoot/bin/Packages/$BuildConfiguration/NuGet" # This artifact is not ready if we're running on the devdiv AzDO account and we don't have an SBOM yet. -if ($env:SYSTEM_COLLECTIONID -eq '011b8bdf-6d56-4f87-be0d-0092136884d9' -and -not (Test-Path $PackagesRoot/_manifest) -and -not $SbomNotRequired) { return @{} } +if ($env:SYSTEM_COLLECTIONID -eq '011b8bdf-6d56-4f87-be0d-0092136884d9' -and -not (Test-Path $PackagesRoot/_manifest) -and -not $SbomNotRequired) { + Write-Host "Skipping because SBOM isn't generated yet." + return @{} +} -if (!(Test-Path $PackagesRoot)) { return @{} } +if (!(Test-Path $PackagesRoot)) { + Write-Warning "Skipping because packages haven't been built yet." + return @{} +} @{ "$PackagesRoot" = (Get-ChildItem $PackagesRoot -Recurse) diff --git a/azure-pipelines/microbuild.after.yml b/azure-pipelines/microbuild.after.yml index e889a46..8763480 100644 --- a/azure-pipelines/microbuild.after.yml +++ b/azure-pipelines/microbuild.after.yml @@ -19,7 +19,7 @@ steps: BuildDropPath: $(System.DefaultWorkingDirectory)/bin/Library/$(BuildConfiguration) BuildComponentPath: $(System.DefaultWorkingDirectory)/obj/src/Library -- powershell: Copy-Item -Recurse "$(System.DefaultWorkingDirectory)/bin/Library/$(BuildConfiguration)/_manifest" "$(System.DefaultWorkingDirectory)/bin/Packages/$(BuildConfiguration)/NuGet" +- powershell: Copy-Item -Recurse -Verbose "$(System.DefaultWorkingDirectory)/bin/Library/$(BuildConfiguration)/_manifest" "$(System.DefaultWorkingDirectory)/bin/Packages/$(BuildConfiguration)/NuGet" displayName: Publish Software Bill of Materials - task: Ref12Analyze@0