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 <weshaggard@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
parent
c0327ee775
commit
7d47e89859
@ -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)
|
||||
|
||||
@ -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:"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user