Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions eng/common/pipelines/templates/steps/set-default-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
steps:
- pwsh: |
$setDefaultBranch = (git remote show origin | Out-String) -replace "(?ms).*HEAD branch: (\w+).*", '$1'
Write-Host $setDefaultBranch
echo "##vso[task.setvariable variable=DefaultBranch]$setDefaultBranch"
displayName: "Setup Default Branch"
condition: eq(variables['DefaultBranch'], '')
5 changes: 3 additions & 2 deletions eng/common/pipelines/templates/steps/verify-links.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ parameters:
Recursive: $false
CheckLinkGuidance: $true
Urls: '(Get-ChildItem -Path ./ -Recurse -Include *.md)'
BranchReplaceRegex: "^(${env:SYSTEM_PULLREQUEST_SOURCEREPOSITORYURI}.*/(?:blob|tree)/)master(/.*)$"
BranchReplaceRegex: "(^${env:SYSTEM_PULLREQUEST_SOURCEREPOSITORYURI}.*/(?:blob|tree)/)$(DefaultBranch)(/.*)$"
BranchReplacementName: "${env:SYSTEM_PULLREQUEST_SOURCECOMMITID}"
Condition: succeeded() # If you want to run on failure for the link checker, set it to `Condition: succeededOrFailed()`.

steps:
- template: /eng/common/pipelines/templates/steps/set-default-branch.yml
- task: PowerShell@2
displayName: Link verification check
condition: ${{ parameters.Condition }}
Expand All @@ -26,4 +27,4 @@ steps:
-branchReplaceRegex "${{ parameters.BranchReplaceRegex }}"
-branchReplacementName ${{ parameters.BranchReplacementName }}
-devOpsLogging: $true
-checkLinkGuidance: ${{ parameters.CheckLinkGuidance }}
-checkLinkGuidance: ${{ parameters.CheckLinkGuidance }}
3 changes: 2 additions & 1 deletion eng/common/scripts/Verify-Links.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,8 @@ function GetLinks([System.Uri]$pageUri)

return $links;
}

Write-Host "Here is the place to look into default branch."
Write-Host $branchReplaceRegex
if ($urls) {
if ($urls.Count -eq 0) {
Write-Host "Usage $($MyInvocation.MyCommand.Name) <urls>";
Expand Down
14 changes: 7 additions & 7 deletions eng/pipelines/aggregate-reports.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,13 @@ jobs:
# Only run if building all libraries succeeded.
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
displayName: 'Component Detection'
# Run link verification at the end as it will run no matter the pipeline passing or failing.
# If this task fails with an error it shouldn't prevent aggregate reports from being generated.
- template: ../common/pipelines/templates/steps/verify-links.yml
parameters:
Directory: ""
CheckLinkGuidance: $true
Condition: succeededOrFailed()

# Put cred scan step before install and build packages to avoid the tool scans generated folder like /target.
- task: securedevelopmentteam.vss-secure-development-tools.build-task-credscan.CredScan@3
Expand All @@ -126,10 +133,3 @@ jobs:
# GdnBreakOutputBaseline: baseline
condition: succeededOrFailed()
continueOnError: true
# Run link verification at the end as it will run no matter the pipeline passing or failing.
# If this task fails with an error it shouldn't prevent aggregate reports from being generated.
- template: ../common/pipelines/templates/steps/verify-links.yml
parameters:
Directory: ""
CheckLinkGuidance: $true
Condition: succeededOrFailed()
2 changes: 1 addition & 1 deletion eng/pipelines/templates/jobs/archetype-sdk-client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ jobs:
${{ if ne(variables['Build.Reason'], 'PullRequest') }}:
Directory: sdk/${{ parameters.ServiceDirectory }}
CheckLinkGuidance: $true

Condition: succeededOrFailed()
# Use BasePathLength of 38 instead of the default 49 as some GA'd files fail when the number is higher.
- template: /eng/common/pipelines/templates/steps/verify-path-length.yml
parameters:
Expand Down