Skip to content

Commit 44eb93b

Browse files
azure-sdkweshaggardCopilot
authored
Sync eng/common directory with azure-sdk-tools for PR 10895 (#41582)
* Update logging for verify-links script * Update verify-links.yml * Update eng/common/scripts/Verify-Links.ps1 Co-authored-by: Copilot <[email protected]> * Update eng/common/scripts/Verify-Links.ps1 --------- Co-authored-by: Wes Haggard <[email protected]> Co-authored-by: Copilot <[email protected]>
1 parent 0ee065f commit 44eb93b

File tree

2 files changed

+5
-35
lines changed

2 files changed

+5
-35
lines changed

eng/common/pipelines/templates/steps/verify-links.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ steps:
2828
-ignoreLinksFile ${{ parameters.IgnoreLinksFile }}
2929
-branchReplaceRegex "${{ parameters.BranchReplaceRegex }}"
3030
-branchReplacementName ${{ parameters.BranchReplacementName }}
31-
-devOpsLogging: $true
3231
-checkLinkGuidance: ${{ parameters.CheckLinkGuidance }}
3332
-localBuildRepoName "$env:BUILD_REPOSITORY_NAME"
3433
-localBuildRepoPath $(Build.SourcesDirectory)

eng/common/scripts/Verify-Links.ps1

Lines changed: 5 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@
1111
.PARAMETER ignoreLinksFile
1212
Specifies the file that contains a set of links to ignore when verifying.
1313
14-
.PARAMETER devOpsLogging
15-
Switch that will enable devops specific logging for warnings.
16-
1714
.PARAMETER recursive
1815
Check the links recurisvely. Applies to links starting with 'baseUrl' parameter. Defaults to true.
1916
@@ -70,7 +67,6 @@
7067
param (
7168
[string[]] $urls,
7269
[string] $ignoreLinksFile = "$PSScriptRoot/ignore-links.txt",
73-
[switch] $devOpsLogging = $false,
7470
[switch] $recursive = $true,
7571
[string] $baseUrl = "",
7672
[string] $rootUrl = "",
@@ -89,6 +85,8 @@ param (
8985

9086
Set-StrictMode -Version 3.0
9187

88+
. "$PSScriptRoot/logging.ps1"
89+
9290
$ProgressPreference = "SilentlyContinue"; # Disable invoke-webrequest progress dialog
9391

9492
function ProcessLink([System.Uri]$linkUri) {
@@ -211,30 +209,6 @@ function NormalizeUrl([string]$url) {
211209
return $uri
212210
}
213211

214-
function LogWarning
215-
{
216-
if ($devOpsLogging)
217-
{
218-
Write-Host "##vso[task.LogIssue type=warning;]$args"
219-
}
220-
else
221-
{
222-
Write-Warning "$args"
223-
}
224-
}
225-
226-
function LogError
227-
{
228-
if ($devOpsLogging)
229-
{
230-
Write-Host "##vso[task.logissue type=error]$args"
231-
}
232-
else
233-
{
234-
Write-Error "$args"
235-
}
236-
}
237-
238212
function ResolveUri ([System.Uri]$referralUri, [string]$link)
239213
{
240214
# If the link is mailto, skip it.
@@ -554,9 +528,8 @@ foreach ($url in $urls) {
554528
$pageUrisToCheck.Enqueue($uri);
555529
}
556530

557-
if ($devOpsLogging) {
558-
Write-Host "##[group]Link checking details"
559-
}
531+
LogGroupStart "Link checking details"
532+
560533
while ($pageUrisToCheck.Count -ne 0)
561534
{
562535
$pageUri = $pageUrisToCheck.Dequeue();
@@ -592,9 +565,7 @@ while ($pageUrisToCheck.Count -ne 0)
592565
}
593566

594567
try {
595-
if ($devOpsLogging) {
596-
Write-Host "##[endgroup]"
597-
}
568+
LogGroupEnd
598569

599570
if ($badLinks.Count -gt 0) {
600571
Write-Host "Summary of broken links:"

0 commit comments

Comments
 (0)