Sync eng/common directory with azure-sdk-tools for PR 2086 (#3138)
This commit is contained in:
parent
74a764a88b
commit
f0a743e02b
@ -1,54 +0,0 @@
|
||||
parameters:
|
||||
TargetVariable: ''
|
||||
TargetUserVariable: 'notspecified'
|
||||
TargetTeamVariable: 'notspecified'
|
||||
TargetLabelVariable: 'notspecified'
|
||||
ServiceDirectory: ''
|
||||
DevOpsFeed: "https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-net/nuget/v3/index.json"
|
||||
|
||||
steps:
|
||||
- task: DotNetCoreCLI@2
|
||||
displayName: 'Install Identity Resolver'
|
||||
inputs:
|
||||
command: custom
|
||||
custom: 'tool'
|
||||
arguments: 'install --global --add-source "${{ parameters.DevOpsFeed }}" --version "1.0.0-dev.20211018.1" "Azure.Sdk.Tools.IdentityResolver"'
|
||||
workingDirectory: '$(Agent.BuildDirectory)'
|
||||
|
||||
- task: DotNetCoreCLI@2
|
||||
displayName: 'Install CodeOwners Retriever'
|
||||
inputs:
|
||||
command: custom
|
||||
custom: 'tool'
|
||||
arguments: 'install --global --add-source "${{ parameters.DevOpsFeed }}" --version "1.0.0-dev.20211019.1" "Azure.Sdk.Tools.RetrieveCodeOwners"'
|
||||
workingDirectory: '$(Agent.BuildDirectory)'
|
||||
|
||||
- pwsh: |
|
||||
identity-resolver `
|
||||
--aad-app-id-var APP_ID `
|
||||
--aad-app-secret-var APP_SECRET `
|
||||
--aad-tenant-var AAD_TENANT `
|
||||
--kusto-url-var KUSTO_URL `
|
||||
--kusto-database-var KUSTO_DB `
|
||||
--kusto-table-var KUSTO_TABLE `
|
||||
--identity-name "$(Build.QueuedBy)" `
|
||||
--identity-email "$(Build.RequestedForEmail)" `
|
||||
--targetvar "${{ coalesce(parameters.TargetVariable, parameters.TargetUserVariable) }}"
|
||||
displayName: 'Resolving Queuing User'
|
||||
continueOnError: true
|
||||
env:
|
||||
APP_ID: $(notification-aad-app-id)
|
||||
APP_SECRET: $(notification-aad-secret)
|
||||
AAD_TENANT: $(notification-aad-tenant)
|
||||
KUSTO_URL: $(notification-kusto-url)
|
||||
KUSTO_DB: $(notification-kusto-db)
|
||||
KUSTO_TABLE: $(notification-kusto-table)
|
||||
|
||||
- pwsh: |
|
||||
retrieve-codeowners `
|
||||
--target-directory "/sdk/${{ parameters.ServiceDirectory }}/" `
|
||||
--root-directory "$(Build.SourcesDirectory)" `
|
||||
--vso-owning-users "${{ coalesce(parameters.TargetVariable, parameters.TargetUserVariable) }}" `
|
||||
--vso-owning-teams "${{ parameters.TargetTeamVariable }}" `
|
||||
--vso-owning-labels "${{ parameters.TargetLabelVariable }}"
|
||||
displayName: 'Add CodeOwners if Present'
|
||||
@ -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,
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
@ -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
|
||||
}
|
||||
@ -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) {
|
||||
@ -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")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user