Skip to content

Commit 9001134

Browse files
Sync eng/common directory with azure-sdk-tools for PR 8267 (#35660)
* CODEOWNERS linter yml updates * commit to add a space --------- Co-authored-by: James Suplizio <[email protected]>
1 parent d86c42f commit 9001134

File tree

1 file changed

+28
-10
lines changed

1 file changed

+28
-10
lines changed

eng/common/pipelines/codeowners-linter.yml

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ stages:
2121
variables:
2222
skipComponentGovernanceDetection: true
2323
nugetMultiFeedWarnLevel: 'none'
24+
baseBranchBaseline: ''
2425

2526
jobs:
2627
- job: Run
@@ -30,29 +31,46 @@ stages:
3031
vmImage: ubuntu-22.04
3132

3233
variables:
33-
CodeownersLinterVersion: '1.0.0-dev.20240227.2'
34+
CodeownersLinterVersion: '1.0.0-dev.20240514.2'
3435
DotNetDevOpsFeed: "https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-net/nuget/v3/index.json"
3536
RepoLabelUri: "https://azuresdkartifacts.blob.core.windows.net/azure-sdk-write-teams/repository-labels-blob"
3637
TeamUserUri: "https://azuresdkartifacts.blob.core.windows.net/azure-sdk-write-teams/azure-sdk-write-teams-blob"
3738
UserOrgUri: "https://azuresdkartifacts.blob.core.windows.net/azure-sdk-write-teams/user-org-visibility-blob"
3839

3940
steps:
40-
# Skip sparse checkout for the `azure-sdk-for-<lang>-pr` private mirrored repositories
41-
# as we require the github service connection to be loaded.
42-
- ${{ if not(contains(variables['Build.DefinitionName'], '-pr - ')) }}:
43-
- template: /eng/common/pipelines/templates/steps/sparse-checkout.yml
44-
parameters:
45-
Paths:
46-
- '/*'
47-
4841
- task: DotNetCoreCLI@2
4942
displayName: 'Install CodeownersLinter'
5043
inputs:
5144
command: custom
5245
custom: 'tool'
5346
arguments: 'install --global --add-source "$(DotNetDevOpsFeed)" --version "$(CodeownersLinterVersion)" "Azure.Sdk.Tools.CodeownersLinter"'
5447
workingDirectory: '$(Build.SourcesDirectory)/eng/common'
48+
49+
- ${{ if eq(variables['Build.Reason'], 'PullRequest') }}:
50+
- pwsh: |
51+
Write-Host "git checkout $ENV:SYSTEM_PULLREQUEST_TARGETBRANCH"
52+
git checkout $ENV:SYSTEM_PULLREQUEST_TARGETBRANCH
53+
displayName: Checkout the base branch
54+
55+
- pwsh: |
56+
# Generate the base branch baseline file to the Build.BinariesDirectory. This will create
57+
# a baseline error file against the CODEOWNERS in the base branch
58+
$baseBranchBaselineFile = "$(Build.BinariesDirectory)/CODEOWNERS_BaseBranch_Baseline_errors.txt"
59+
Write-Host "codeowners-linter --repoRoot $(Build.SourcesDirectory) --repoName $(Build.Repository.Name) -gbl -rUri ""$(RepoLabelUri)"" -tUri ""$(TeamUserUri)"" -uUri ""$(UserOrgUri)"" -bbf ""$baseBranchBaselineFile"""
60+
codeowners-linter --repoRoot $(Build.SourcesDirectory) --repoName $(Build.Repository.Name) -gbl -rUri "$(RepoLabelUri)" -tUri "$(TeamUserUri)" -uUri "$(UserOrgUri)" -bbf "$baseBranchBaselineFile"
61+
echo "##vso[task.setvariable variable=baseBranchBaseline]$baseBranchBaselineFile"
62+
displayName: 'Generate baseline file for base branch'
63+
workingDirectory: '$(Build.SourcesDirectory)/eng/common'
64+
65+
- pwsh: |
66+
Write-Host "git checkout refs/remotes/pull/$ENV:SYSTEM_PULLREQUEST_PULLREQUESTNUMBER/merge"
67+
git checkout refs/remotes/pull/$ENV:SYSTEM_PULLREQUEST_PULLREQUESTNUMBER/merge
68+
displayName: Checkout the PR branch
69+
5570
- pwsh: |
56-
codeowners-linter --repoRoot $(Build.SourcesDirectory) --repoName $(Build.Repository.Name) -fbl -rUri "$(RepoLabelUri)" -tUri "$(TeamUserUri)" -uUri "$(UserOrgUri)"
71+
# In the case of a PR, the baseBranchBaseline will be set which will be used to further filter results.
72+
# For scheduled runs, the baseBranchBaseline won't be set and only the existing baseline file will be used to filter
73+
Write-Host "codeowners-linter --repoRoot $(Build.SourcesDirectory) --repoName $(Build.Repository.Name) -fbl -rUri ""$(RepoLabelUri)"" -tUri ""$(TeamUserUri)"" -uUri ""$(UserOrgUri)"" -bbf ""$(baseBranchBaseline)"""
74+
codeowners-linter --repoRoot $(Build.SourcesDirectory) --repoName $(Build.Repository.Name) -fbl -rUri "$(RepoLabelUri)" -tUri "$(TeamUserUri)" -uUri "$(UserOrgUri)" -bbf "$(baseBranchBaseline)"
5775
displayName: 'Lint CODEOWNERS and filter using baseline'
5876
workingDirectory: '$(Build.SourcesDirectory)/eng/common'

0 commit comments

Comments
 (0)