Skip to content
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
48 changes: 28 additions & 20 deletions eng/common/pipelines/templates/steps/get-pr-owners.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,30 @@
parameters:
TargetVariable: ''
TargetUserVariable: 'notspecified'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should default to empty and if they are empty then we don't write any variable.

TargetTeamVariable: 'notspecified'
TargetLabelVariable: 'notspecified'
ServiceDirectory: ''
DevOpsFeed: "https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-net/nuget/v3/index.json"

steps:
- pwsh: |
git clone https://github.com/Azure/azure-sdk-tools.git $(Build.SourcesDirectory)/tools_repo
cd $(Build.SourcesDirectory)/tools_repo
git checkout azure-sdk-tools_20210114.1
displayName: Setup Identity Resolver
- 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"'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are these versions different? We should pull this version into a variable and share it across both of these.

We also can consider combining these tools into one tools package.

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: |
dotnet run -v q -- `
identity-resolver `
--aad-app-id-var APP_ID `
--aad-app-secret-var APP_SECRET `
--aad-tenant-var AAD_TENANT `
Expand All @@ -19,10 +33,9 @@ steps:
--kusto-table-var KUSTO_TABLE `
--identity-name "$(Build.QueuedBy)" `
--identity-email "$(Build.RequestedForEmail)" `
--targetvar "${{ parameters.TargetVariable }}"
--targetvar "${{ coalesce(parameters.TargetVariable, parameters.TargetUserVariable) }}"
displayName: 'Resolving Queuing User'
continueOnError: true
workingDirectory: $(Build.SourcesDirectory)/tools_repo/tools/notification-configuration/identity-resolver
env:
APP_ID: $(notification-aad-app-id)
APP_SECRET: $(notification-aad-secret)
Expand All @@ -32,15 +45,10 @@ steps:
KUSTO_TABLE: $(notification-kusto-table)

- pwsh: |
Remove-Item -Force -Recurse $(Build.SourcesDirectory)/tools_repo
displayName: Clean Up Cloned Tools Repo

- task: PowerShell@2
displayName: Add CodeOwners if Present
inputs:
pwsh: true
filePath: $(Build.SourcesDirectory)/eng/common/scripts/get-codeowners.ps1
arguments: >
-TargetDirectory "/sdk/${{ parameters.ServiceDirectory }}/"
-RootDirectory "$(Build.SourcesDirectory)"
-VsoVariable "${{ parameters.TargetVariable }}"
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'
50 changes: 0 additions & 50 deletions eng/common/scripts/get-codeowners.ps1

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ string vsoOwningLabels

var parsedEntries = CodeOwnersFile.ParseFile(codeOwnersLocation);
var filteredEntries = parsedEntries.Where(
entries => entries.PathExpression.Trim(new char[] {'/','\\' }).Equals(targetDirectory.Trim(new char[] { '/', '\\' })));
entries => entries.PathExpression.Trim(new char[] {'/','\\' }).Equals(target.Trim(new char[] { '/', '\\' })));

client.BaseAddress = new Uri("https://api.github.com/");
client.DefaultRequestHeaders.UserAgent.Add(new System.Net.Http.Headers.ProductInfoHeaderValue("CodeOwnerRetriever", "1.0"));
Expand Down