Skip to content

Commit ef03bb7

Browse files
Sync eng/common directory with azure-sdk-tools for PR 15310 (#46555)
* Add ability to exclude artifacts from CODEOWNERS verification in ci.yml * Review feedback --------- Co-authored-by: Daniel Jurek <djurek@microsoft.com>
1 parent 8762b2e commit ef03bb7

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ parameters:
22
- name: ArtifactPath
33
type: string
44
default: $(Build.ArtifactStagingDirectory)/PackageInfo
5+
- name: Artifacts
6+
type: object
7+
default: []
58
- name: Repo
69
type: string
710
default: $(Build.Repository.Name)
@@ -29,4 +32,5 @@ steps:
2932
-AzsdkPath '$(AZSDK)'
3033
-PackageInfoDirectory '${{ parameters.ArtifactPath }}'
3134
-SdkTypes ${{ join(',', parameters.SdkTypes) }}
35+
-ArtifactsJson '${{ convertToJson(parameters.Artifacts) }}'
3236
-Repo '${{ parameters.Repo }}'

eng/common/scripts/Test-CodeownersForArtifacts.ps1

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ param(
33
[string] $AzsdkPath,
44
[string] $PackageInfoDirectory,
55
[array] $SdkTypes,
6+
[string] $ArtifactsJson,
67
[string] $Repo
78
)
89

@@ -12,9 +13,24 @@ Set-StrictMode -Version 3
1213
$ErrorActionPreference = 'Stop'
1314

1415
$failedPackages = @()
16+
$excludedArtifacts = @()
17+
$artifacts = $ArtifactsJson | ConvertFrom-Json
18+
19+
foreach ($artifact in $artifacts) {
20+
if ($artifact.PSObject.Properties.Name -contains "skipCodeownersVerification" -and $artifact.skipCodeownersVerification) {
21+
$excludedArtifacts += $artifact.Name
22+
}
23+
}
24+
25+
Write-Host "Excluded artifacts: $($excludedArtifacts -join ', ')"
1526

1627
foreach ($pkgPropertiesFile in Get-ChildItem -Path $PackageInfoDirectory -Filter '*.json' -File) {
1728
$pkgProperties = Get-Content -Raw -Path $pkgPropertiesFile | ConvertFrom-Json
29+
30+
if ($excludedArtifacts -contains $pkgProperties.Name) {
31+
Write-Host "Skipping package: $($pkgProperties.Name) $($pkgProperties.DirectoryPath) because it is in the list of artifacts to exclude from validation."
32+
continue
33+
}
1834
if ($SdkTypes -notcontains $pkgProperties.SdkType) {
1935
Write-Host "Skipping package: $($pkgProperties.Name) $($pkgProperties.DirectoryPath) because its SdkType '$($pkgProperties.SdkType)' is not in the list of SdkTypes to validate."
2036
continue

0 commit comments

Comments
 (0)