Sync eng/common directory with azure-sdk-tools repository for Tools PR 916 (#547)
This commit is contained in:
parent
fa63edb51f
commit
1d1913e94f
@ -6,30 +6,19 @@ steps:
|
||||
- pwsh: |
|
||||
git clone https://github.com/Azure/azure-sdk-tools.git $(Build.SourcesDirectory)/tools_repo
|
||||
cd $(Build.SourcesDirectory)/tools_repo
|
||||
git checkout 564ad63ae72d18422533fa1da9d396e7703c1cb5
|
||||
git checkout 35ad98f821913eb0e8872f861ee60589b563c865
|
||||
displayName: Setup Identity Resolver
|
||||
|
||||
- pwsh: |
|
||||
$result = dotnet run -v q -- `
|
||||
dotnet run -v q -- `
|
||||
--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 "$(Build.QueuedBy)"
|
||||
|
||||
$resolvedIdentity = ""
|
||||
try { $resolvedIdentity = $result[-1] | ConvertFrom-Json } catch {}
|
||||
|
||||
if($resolvedIdentity) {
|
||||
Write-Host $resolvedIdentity
|
||||
|
||||
Write-Host "##vso[task.setvariable variable=${{ parameters.TargetVariable }}]$($resolvedIdentity.GithubUserName)"
|
||||
}
|
||||
else {
|
||||
Write-Host "Unable to locate a github user for identity $(Build.QueuedBy)"
|
||||
}
|
||||
--identity "$(Build.QueuedBy)" `
|
||||
--targetvar "${{ parameters.TargetVariable }}"
|
||||
displayName: 'Resolving Queuing User'
|
||||
continueOnError: true
|
||||
workingDirectory: $(Build.SourcesDirectory)/tools_repo/tools/notification-configuration/identity-resolver
|
||||
@ -45,10 +34,12 @@ steps:
|
||||
Remove-Item -Force -Recurse $(Build.SourcesDirectory)/tools_repo
|
||||
displayName: Clean Up Cloned Tools Repo
|
||||
|
||||
- pwsh: |
|
||||
$originalValue = "$(${{ parameters.TargetVariable }})"
|
||||
$result = $(Build.SourcesDirectory)/eng/common/scripts/get-codeowners.ps1 -TargetDirectory /sdk/${{ parameters.ServiceDirectory }}/ -RootDirectory $(Build.SourcesDirectory)
|
||||
if ($result) {
|
||||
Write-Host "##vso[task.setvariable variable=${{ parameters.TargetVariable }}]$originalValue,$result"
|
||||
}
|
||||
displayName: Add CodeOwners if Present
|
||||
- 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 }}"
|
||||
@ -1,6 +1,7 @@
|
||||
param (
|
||||
$TargetDirectory, # should be in relative form from root of repo. EG: sdk/servicebus
|
||||
$RootDirectory # ideally $(Build.SourcesDirectory)
|
||||
$RootDirectory, # ideally $(Build.SourcesDirectory)
|
||||
$VsoVariable = "" # target devops output variable
|
||||
)
|
||||
$target = $TargetDirectory.ToLower().Trim("/")
|
||||
$codeOwnersLocation = Join-Path $RootDirectory -ChildPath ".github/CODEOWNERS"
|
||||
@ -29,6 +30,16 @@ $results = $ownedFolders[$target]
|
||||
|
||||
if ($results) {
|
||||
Write-Host "Found a folder $results to match $target"
|
||||
|
||||
if ($VsoVariable) {
|
||||
$alreadyPresent = [System.Environment]::GetEnvironmentVariable($VsoVariable)
|
||||
|
||||
if ($alreadyPresent) {
|
||||
$results += ",$alreadyPresent"
|
||||
}
|
||||
Write-Host "##vso[task.setvariable variable=$VsoVariable;]$results"
|
||||
}
|
||||
|
||||
return $results
|
||||
}
|
||||
else {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user