Sync eng/common directory with azure-sdk-tools for PR 13040 (#6842)
* Include groupId in the pkg name when create api view request * Used the package info in the function signature --------- Co-authored-by: ray chen <raychen@microsoft.com>
This commit is contained in:
parent
e54ff91062
commit
252cc3032d
@ -40,6 +40,7 @@ steps:
|
||||
- task: Powershell@2
|
||||
inputs:
|
||||
filePath: ${{ parameters.SourceRootPath }}/eng/common/scripts/Create-APIReview.ps1
|
||||
# PackageInfoFiles example: @('a/file1.json','a/file2.json')
|
||||
arguments: >
|
||||
-PackageInfoFiles @('${{ join(''',''', parameters.PackageInfoFiles) }}')
|
||||
-ArtifactList ('${{ convertToJson(parameters.Artifacts) }}' | ConvertFrom-Json | Select-Object Name)
|
||||
|
||||
@ -24,6 +24,7 @@ steps:
|
||||
azureSubscription: opensource-api-connection
|
||||
scriptType: pscore
|
||||
scriptLocation: inlineScript
|
||||
# PackageInfoFiles example: @('a/file1.json','a/file2.json')
|
||||
inlineScript: |
|
||||
$(Build.SourcesDirectory)/eng/common/scripts/Validate-All-Packages.ps1 `
|
||||
-ArtifactList ('${{ convertToJson(parameters.Artifacts) }}' | ConvertFrom-Json | Select-Object Name) `
|
||||
|
||||
@ -22,8 +22,16 @@ Param (
|
||||
$configFileDir = Join-Path -Path $ArtifactPath "PackageInfo"
|
||||
|
||||
# Submit API review request and return status whether current revision is approved or pending or failed to create review
|
||||
function Submit-Request($filePath, $packageName, $packageType)
|
||||
function Submit-Request($filePath, $packageInfo)
|
||||
{
|
||||
$packageName = $packageInfo.ArtifactName ?? $packageInfo.Name
|
||||
$packageType = $packageInfo.SdkType
|
||||
|
||||
# Construct full package name with groupId if available
|
||||
$fullPackageName = $packageName
|
||||
if ($packageInfo.PSObject.Members.Name -contains "Group" -and $packageInfo.Group) {
|
||||
$fullPackageName = "$($packageInfo.Group):$packageName"
|
||||
}
|
||||
$repoName = $RepoFullName
|
||||
if (!$repoName) {
|
||||
$repoName = "azure/azure-sdk-for-$LanguageShort"
|
||||
@ -36,7 +44,7 @@ function Submit-Request($filePath, $packageName, $packageType)
|
||||
$query.Add('commitSha', $CommitSha)
|
||||
$query.Add('repoName', $repoName)
|
||||
$query.Add('pullRequestNumber', $PullRequestNumber)
|
||||
$query.Add('packageName', $packageName)
|
||||
$query.Add('packageName', $fullPackageName)
|
||||
$query.Add('language', $LanguageShort)
|
||||
$query.Add('project', $DevopsProject)
|
||||
$query.Add('packageType', $packageType)
|
||||
@ -75,7 +83,7 @@ function Submit-Request($filePath, $packageName, $packageType)
|
||||
catch
|
||||
{
|
||||
Write-Host "ERROR: API request failed" -ForegroundColor Red
|
||||
Write-Host "Status Code: $($_.Exception.Response.StatusCode.Value__)" -ForegroundColor Yellow
|
||||
Write-Host "Status Code: $($_.Exception.Response.StatusCode.Value__)" -ForegroundColor Yellow
|
||||
Write-Host "Error: $($_.Exception.Message)" -ForegroundColor Yellow
|
||||
if ($_.ErrorDetails.Message) {
|
||||
Write-Host "Details: $($_.ErrorDetails.Message)" -ForegroundColor Yellow
|
||||
@ -165,7 +173,7 @@ foreach ($packageInfoFile in $packageInfoFiles)
|
||||
if ($isRequired -eq $True)
|
||||
{
|
||||
$filePath = $pkgPath.Replace($ArtifactPath , "").Replace("\", "/")
|
||||
$respCode = Submit-Request -filePath $filePath -packageName $pkgArtifactName -packageType $packageType
|
||||
$respCode = Submit-Request -filePath $filePath -packageInfo $packageInfo
|
||||
if ($respCode -ne '200')
|
||||
{
|
||||
$responses[$pkgArtifactName] = $respCode
|
||||
|
||||
Loading…
Reference in New Issue
Block a user