From 7d47e89859251710d4deb01c8ace47766bed6b33 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Fri, 13 Jun 2025 15:25:00 -0700 Subject: [PATCH] Sync eng/common directory with azure-sdk-tools for PR 10895 (#6629) * Update logging for verify-links script * Update verify-links.yml * Update eng/common/scripts/Verify-Links.ps1 Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update eng/common/scripts/Verify-Links.ps1 --------- Co-authored-by: Wes Haggard Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .../templates/steps/verify-links.yml | 1 - eng/common/scripts/Verify-Links.ps1 | 39 +++---------------- 2 files changed, 5 insertions(+), 35 deletions(-) diff --git a/eng/common/pipelines/templates/steps/verify-links.yml b/eng/common/pipelines/templates/steps/verify-links.yml index 9811b8a83..896b30d0f 100644 --- a/eng/common/pipelines/templates/steps/verify-links.yml +++ b/eng/common/pipelines/templates/steps/verify-links.yml @@ -28,7 +28,6 @@ steps: -ignoreLinksFile ${{ parameters.IgnoreLinksFile }} -branchReplaceRegex "${{ parameters.BranchReplaceRegex }}" -branchReplacementName ${{ parameters.BranchReplacementName }} - -devOpsLogging: $true -checkLinkGuidance: ${{ parameters.CheckLinkGuidance }} -localBuildRepoName "$env:BUILD_REPOSITORY_NAME" -localBuildRepoPath $(Build.SourcesDirectory) diff --git a/eng/common/scripts/Verify-Links.ps1 b/eng/common/scripts/Verify-Links.ps1 index 7bba07fe1..d4406c609 100644 --- a/eng/common/scripts/Verify-Links.ps1 +++ b/eng/common/scripts/Verify-Links.ps1 @@ -11,9 +11,6 @@ .PARAMETER ignoreLinksFile Specifies the file that contains a set of links to ignore when verifying. - .PARAMETER devOpsLogging - Switch that will enable devops specific logging for warnings. - .PARAMETER recursive Check the links recurisvely. Applies to links starting with 'baseUrl' parameter. Defaults to true. @@ -70,7 +67,6 @@ param ( [string[]] $urls, [string] $ignoreLinksFile = "$PSScriptRoot/ignore-links.txt", - [switch] $devOpsLogging = $false, [switch] $recursive = $true, [string] $baseUrl = "", [string] $rootUrl = "", @@ -89,6 +85,8 @@ param ( Set-StrictMode -Version 3.0 +. "$PSScriptRoot/logging.ps1" + $ProgressPreference = "SilentlyContinue"; # Disable invoke-webrequest progress dialog function ProcessLink([System.Uri]$linkUri) { @@ -211,30 +209,6 @@ function NormalizeUrl([string]$url) { return $uri } -function LogWarning -{ - if ($devOpsLogging) - { - Write-Host "##vso[task.LogIssue type=warning;]$args" - } - else - { - Write-Warning "$args" - } -} - -function LogError -{ - if ($devOpsLogging) - { - Write-Host "##vso[task.logissue type=error]$args" - } - else - { - Write-Error "$args" - } -} - function ResolveUri ([System.Uri]$referralUri, [string]$link) { # If the link is mailto, skip it. @@ -554,9 +528,8 @@ foreach ($url in $urls) { $pageUrisToCheck.Enqueue($uri); } -if ($devOpsLogging) { - Write-Host "##[group]Link checking details" -} +LogGroupStart "Link checking details" + while ($pageUrisToCheck.Count -ne 0) { $pageUri = $pageUrisToCheck.Dequeue(); @@ -592,9 +565,7 @@ while ($pageUrisToCheck.Count -ne 0) } try { - if ($devOpsLogging) { - Write-Host "##[endgroup]" - } + LogGroupEnd if ($badLinks.Count -gt 0) { Write-Host "Summary of broken links:"