Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync eng/common directory with azure-sdk-tools for PR 2086 #21867

Merged
merged 5 commits into from
Nov 24, 2021
Merged
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
54 changes: 0 additions & 54 deletions eng/common/pipelines/templates/steps/get-pr-owners.yml

This file was deleted.

19 changes: 16 additions & 3 deletions eng/common/scripts/Update-DocsMsMetadata.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ GitHub repository ID of the SDK. Typically of the form: 'Azure/azure-sdk-for-js'
param(
[Parameter(Mandatory = $true)]
[array]$PackageInfoJsonLocations,

[Parameter(Mandatory = $true)]
[string]$DocRepoLocation,

Expand Down Expand Up @@ -78,12 +78,25 @@ function GetAdjustedReadmeContent($ReadmeContent, $PackageInfo, $PackageMetadata
$ReadmeContent = $ReadmeContent -replace $releaseReplaceRegex, $replacementPattern
}

# Get the first code owners of the package.
$author = "ramya-rao-a"
$msauthor = "ramyar"
Write-Host "Retrieve the code owner from $($PackageInfo.DirectoryPath)."
$codeOwnerArray = ."$PSScriptRoot/get-codeowners.ps1" `
-TargetDirectory $PackageInfo.DirectoryPath
if ($codeOwnerArray) {
Write-Host "Code Owners are $($codeOwnerArray -join ",")"
$author = $codeOwnerArray[0]
$msauthor = $author # This is a placeholder for now. Will change to the right ms alias.
}
Write-Host "The author of package: $author"
Write-Host "The ms author of package: $msauthor"
$header = @"
---
title: $foundTitle
keywords: Azure, $Language, SDK, API, $($PackageInfo.Name), $service
author: maggiepint
ms.author: magpint
author: $author
ms.author: $msauthor
ms.date: $date
ms.topic: reference
ms.prod: azure
Expand Down
8 changes: 4 additions & 4 deletions eng/common/scripts/get-codeowners.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
param (
[string]$TargetDirectory = "", # Code path to code owners. e.g sdk/core/azure-amqp
[string]$CodeOwnerFileLocation = "$PSSCriptRoot/../../../.github/CODEOWNERS", # The absolute path of CODEOWNERS file.
[string]$ToolVersion = "1.0.0-dev.20211122.14", # Placeholder. Will update in next PR
[string]$CodeOwnerFileLocation = (Resolve-Path $PSScriptRoot/../../../.github/CODEOWNERS), # The absolute path of CODEOWNERS file.
[string]$ToolVersion = "1.0.0-dev.20211123.13", # Placeholder. Will update in next PR
[string]$ToolPath = (Join-Path ([System.IO.Path]::GetTempPath()) "codeowners-tool-path"), # The place to check the tool existence. Put temp path as default
[string]$DevOpsFeed = "https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-net/nuget/v3/index.json", # DevOp tool feeds.
[string]$VsoVariable = "", # Option of write code owners into devop variable
Expand Down Expand Up @@ -34,7 +34,6 @@ function Get-CodeOwners ([string]$targetDirectory, [string]$codeOwnerFileLocatio
{
$command = Get-CodeOwnersTool
# Filter out the non user alias from code owner list.
Write-Host "Testing on $targetDirectory..."
if($includeNonUserAliases) {
$codeOwnersString = & $command --target-directory $targetDirectory --code-owner-file-path $codeOwnerFileLocation 2>&1
}
Expand Down Expand Up @@ -62,6 +61,7 @@ function Get-CodeOwners ([string]$targetDirectory, [string]$codeOwnerFileLocatio
}

function TestGetCodeOwner([string]$targetDirectory, [string]$codeOwnerFileLocation, [bool]$includeNonUserAliases = $false, [string[]]$expectReturn) {
Write-Host "Testing on $targetDirectory..."
$actualReturn = Get-CodeOwners -targetDirectory $targetDirectory -codeOwnerFileLocation $codeOwnerFileLocation -includeNonUserAliases $IncludeNonUserAliases

if ($actualReturn.Count -ne $expectReturn.Count) {
Expand All @@ -77,7 +77,7 @@ function TestGetCodeOwner([string]$targetDirectory, [string]$codeOwnerFileLocati
}

if($Test) {
$testFile = "$PSSCriptRoot/../../../tools/code-owners-parser/Azure.Sdk.Tools.RetrieveCodeOwners.Tests/CODEOWNERS"
$testFile = (Resolve-Path $PSScriptRoot/../../../tools/code-owners-parser/Azure.Sdk.Tools.RetrieveCodeOwners.Tests/CODEOWNERS)
TestGetCodeOwner -targetDirectory "sdk" -codeOwnerFileLocation $testFile -includeNonUserAliases $true -expectReturn @("person1", "person2")
TestGetCodeOwner -targetDirectory "sdk/noPath" -codeOwnerFileLocation $testFile -includeNonUserAliases $true -expectReturn @("person1", "person2")
TestGetCodeOwner -targetDirectory "/sdk/azconfig" -codeOwnerFileLocation $testFile -includeNonUserAliases $true -expectReturn @("person3", "person4")
Expand Down