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
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -855,5 +855,5 @@
/eng/versioning/external_dependencies.txt @alzimmermsft @samvaity @g2vinay @jonathangiles @chenrujun @netyyyy @saragluna @moarychan

# Add owners for notifications for specific pipelines
/eng/pipelines/aggregate-reports.yml @joshfree @jonathangiles
/eng/pipelines/aggregate-reports.yml @joshfree @jonathangiles @Mrayyan
/eng/common/pipelines/codeowners-linter.yml @alzimmermsft @srnagar @lmolkova
1 change: 0 additions & 1 deletion .github/CODEOWNERS_baseline_errors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ besh2014 is an invalid user. Ensure the user exists, is public member of Azure a
phermanov-msft is not a public member of Azure.
ilyapaliakou-msft is not a public member of Azure.
alexokun is an invalid user. Ensure the user exists, is public member of Azure and has write permissions.
Mrayyan is an invalid user. Ensure the user exists, is public member of Azure and has write permissions.
shwali-msft is not a public member of Azure.
allchiang-msft is not a public member of Azure.
mikehang-msft is not a public member of Azure.
Expand Down
38 changes: 28 additions & 10 deletions eng/common/pipelines/codeowners-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ stages:
variables:
skipComponentGovernanceDetection: true
nugetMultiFeedWarnLevel: 'none'
baseBranchBaseline: ''

jobs:
- job: Run
Expand All @@ -30,29 +31,46 @@ stages:
vmImage: ubuntu-22.04

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

steps:
# Skip sparse checkout for the `azure-sdk-for-<lang>-pr` private mirrored repositories
# as we require the github service connection to be loaded.
- ${{ if not(contains(variables['Build.DefinitionName'], '-pr - ')) }}:
- template: /eng/common/pipelines/templates/steps/sparse-checkout.yml
parameters:
Paths:
- '/*'

- task: DotNetCoreCLI@2
displayName: 'Install CodeownersLinter'
inputs:
command: custom
custom: 'tool'
arguments: 'install --global --add-source "$(DotNetDevOpsFeed)" --version "$(CodeownersLinterVersion)" "Azure.Sdk.Tools.CodeownersLinter"'
workingDirectory: '$(Build.SourcesDirectory)/eng/common'

- ${{if eq(variables['Build.Reason'], 'PullRequest') }}:
- pwsh: |
Write-Host "git checkout $ENV:SYSTEM_PULLREQUEST_TARGETBRANCH"
git checkout $ENV:SYSTEM_PULLREQUEST_TARGETBRANCH
displayName: Checkout the base branch

- pwsh: |
# Generate the base branch baseline file to the Build.BinariesDirectory. This will create
# a baseline error file against the CODEOWNERS in the base branch
$baseBranchBaselineFile = "$(Build.BinariesDirectory)/CODEOWNERS_BaseBranch_Baseline_errors.txt"
Write-Host "codeowners-linter --repoRoot $(Build.SourcesDirectory) --repoName $(Build.Repository.Name) -gbl -rUri ""$(RepoLabelUri)"" -tUri ""$(TeamUserUri)"" -uUri ""$(UserOrgUri)"" -bbf ""$baseBranchBaselineFile"""
codeowners-linter --repoRoot $(Build.SourcesDirectory) --repoName $(Build.Repository.Name) -gbl -rUri "$(RepoLabelUri)" -tUri "$(TeamUserUri)" -uUri "$(UserOrgUri)" -bbf "$baseBranchBaselineFile"
echo "##vso[task.setvariable variable=baseBranchBaseline]$baseBranchBaselineFile"
displayName: 'Generate baseline file for base branch'
workingDirectory: '$(Build.SourcesDirectory)/eng/common'

- pwsh: |
Write-Host "git checkout refs/remotes/pull/$ENV:SYSTEM_PULLREQUEST_PULLREQUESTNUMBER/merge"
git checkout refs/remotes/pull/$ENV:SYSTEM_PULLREQUEST_PULLREQUESTNUMBER/merge
displayName: Checkout the PR branch

- pwsh: |
codeowners-linter --repoRoot $(Build.SourcesDirectory) --repoName $(Build.Repository.Name) -fbl -rUri "$(RepoLabelUri)" -tUri "$(TeamUserUri)" -uUri "$(UserOrgUri)"
# In the case of a PR, the baseBranchBaseline will be set which will be used to further filter results.
# For scheduled runs, the baseBranchBaseline won't be set and only the existing baseline file will be used to filter
Write-Host "codeowners-linter --repoRoot $(Build.SourcesDirectory) --repoName $(Build.Repository.Name) -fbl -rUri ""$(RepoLabelUri)"" -tUri ""$(TeamUserUri)"" -uUri ""$(UserOrgUri)"" -bbf ""$(baseBranchBaseline)"""
codeowners-linter --repoRoot $(Build.SourcesDirectory) --repoName $(Build.Repository.Name) -fbl -rUri "$(RepoLabelUri)" -tUri "$(TeamUserUri)" -uUri "$(UserOrgUri)" -bbf "$(baseBranchBaseline)"
displayName: 'Lint CODEOWNERS and filter using baseline'
workingDirectory: '$(Build.SourcesDirectory)/eng/common'