Skip to content

Commit a3ae936

Browse files
authored
Sync eng/common directory with azure-sdk-tools repository for Tools PR 916 (#13374)
1 parent 1c9980c commit a3ae936

File tree

2 files changed

+25
-23
lines changed

2 files changed

+25
-23
lines changed

eng/common/pipelines/templates/steps/get-pr-owners.yml

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,19 @@ steps:
66
- pwsh: |
77
git clone https://github.com/Azure/azure-sdk-tools.git $(Build.SourcesDirectory)/tools_repo
88
cd $(Build.SourcesDirectory)/tools_repo
9-
git checkout 564ad63ae72d18422533fa1da9d396e7703c1cb5
9+
git checkout 35ad98f821913eb0e8872f861ee60589b563c865
1010
displayName: Setup Identity Resolver
1111
1212
- pwsh: |
13-
$result = dotnet run -v q -- `
13+
dotnet run -v q -- `
1414
--aad-app-id-var APP_ID `
1515
--aad-app-secret-var APP_SECRET `
1616
--aad-tenant-var AAD_TENANT `
1717
--kusto-url-var KUSTO_URL `
1818
--kusto-database-var KUSTO_DB `
1919
--kusto-table-var KUSTO_TABLE `
20-
--identity "$(Build.QueuedBy)"
21-
22-
$resolvedIdentity = ""
23-
try { $resolvedIdentity = $result[-1] | ConvertFrom-Json } catch {}
24-
25-
if($resolvedIdentity) {
26-
Write-Host $resolvedIdentity
27-
28-
Write-Host "##vso[task.setvariable variable=${{ parameters.TargetVariable }}]$($resolvedIdentity.GithubUserName)"
29-
}
30-
else {
31-
Write-Host "Unable to locate a github user for identity $(Build.QueuedBy)"
32-
}
20+
--identity "$(Build.QueuedBy)" `
21+
--targetvar "${{ parameters.TargetVariable }}"
3322
displayName: 'Resolving Queuing User'
3423
continueOnError: true
3524
workingDirectory: $(Build.SourcesDirectory)/tools_repo/tools/notification-configuration/identity-resolver
@@ -45,10 +34,12 @@ steps:
4534
Remove-Item -Force -Recurse $(Build.SourcesDirectory)/tools_repo
4635
displayName: Clean Up Cloned Tools Repo
4736
48-
- pwsh: |
49-
$originalValue = "$(${{ parameters.TargetVariable }})"
50-
$result = $(Build.SourcesDirectory)/eng/common/scripts/get-codeowners.ps1 -TargetDirectory /sdk/${{ parameters.ServiceDirectory }}/ -RootDirectory $(Build.SourcesDirectory)
51-
if ($result) {
52-
Write-Host "##vso[task.setvariable variable=${{ parameters.TargetVariable }}]$originalValue,$result"
53-
}
54-
displayName: Add CodeOwners if Present
37+
- task: PowerShell@2
38+
displayName: Add CodeOwners if Present
39+
inputs:
40+
pwsh: true
41+
filePath: $(Build.SourcesDirectory)/eng/common/scripts/get-codeowners.ps1
42+
arguments: >
43+
-TargetDirectory "/sdk/${{ parameters.ServiceDirectory }}/"
44+
-RootDirectory "$(Build.SourcesDirectory)"
45+
-VsoVariable "${{ parameters.TargetVariable }}"

eng/common/scripts/get-codeowners.ps1

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
param (
22
$TargetDirectory, # should be in relative form from root of repo. EG: sdk/servicebus
3-
$RootDirectory # ideally $(Build.SourcesDirectory)
3+
$RootDirectory, # ideally $(Build.SourcesDirectory)
4+
$VsoVariable = "" # target devops output variable
45
)
56
$target = $TargetDirectory.ToLower().Trim("/")
67
$codeOwnersLocation = Join-Path $RootDirectory -ChildPath ".github/CODEOWNERS"
@@ -29,6 +30,16 @@ $results = $ownedFolders[$target]
2930

3031
if ($results) {
3132
Write-Host "Found a folder $results to match $target"
33+
34+
if ($VsoVariable) {
35+
$alreadyPresent = [System.Environment]::GetEnvironmentVariable($VsoVariable)
36+
37+
if ($alreadyPresent) {
38+
$results += ",$alreadyPresent"
39+
}
40+
Write-Host "##vso[task.setvariable variable=$VsoVariable;]$results"
41+
}
42+
3243
return $results
3344
}
3445
else {

0 commit comments

Comments
 (0)