Sync eng/common directory with azure-sdk-tools for PR 7988 (#5479)

* Pass valid original artifact file name in request to APIView
This commit is contained in:
Azure SDK Bot 2024-04-02 15:27:31 -04:00 committed by GitHub
parent 1ba6be47e4
commit 6450530bd8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -89,9 +89,13 @@ function Upload-SourceArtifact($filePath, $apiLabel, $releaseStatus, $packageVer
return $StatusCode
}
function Upload-ReviewTokenFile($packageName, $apiLabel, $releaseStatus, $reviewFileName, $packageVersion)
function Upload-ReviewTokenFile($packageName, $apiLabel, $releaseStatus, $reviewFileName, $packageVersion, $filePath)
{
$params = "buildId=${BuildId}&artifactName=${ArtifactName}&originalFilePath=${packageName}&reviewFilePath=${reviewFileName}"
Write-Host "Original File path: $filePath"
$fileName = Split-Path -Leaf $filePath
Write-Host "OriginalFile name: $fileName"
$params = "buildId=${BuildId}&artifactName=${ArtifactName}&originalFilePath=${fileName}&reviewFilePath=${reviewFileName}"
$params += "&label=${apiLabel}&repoName=${RepoName}&packageName=${packageName}&project=internal&packageVersion=${packageVersion}"
if($MarkPackageAsShipped) {
$params += "&setReleaseTag=true"
@ -135,17 +139,17 @@ function Get-APITokenFileName($packageName)
}
}
function Submit-APIReview($packageInfo, $packagePath)
function Submit-APIReview($packageInfo, $packagePath, $packageArtifactName)
{
$packageName = $packageInfo.Name
$apiLabel = "Source Branch:${SourceBranch}"
# Get generated review token file if present
# APIView processes request using different API if token file is already generated
$reviewTokenFileName = Get-APITokenFileName $packageName
$reviewTokenFileName = Get-APITokenFileName $packageArtifactName
if ($reviewTokenFileName) {
Write-Host "Uploading review token file $reviewTokenFileName to APIView."
return Upload-ReviewTokenFile $packageName $apiLabel $packageInfo.ReleaseStatus $reviewTokenFileName $packageInfo.Version
return Upload-ReviewTokenFile $packageName $apiLabel $packageInfo.ReleaseStatus $reviewTokenFileName $packageInfo.Version $packagePath
}
else {
Write-Host "Uploading $packagePath to APIView."
@ -205,7 +209,7 @@ function ProcessPackage($packageName)
if ( ($SourceBranch -eq $DefaultBranch) -or (-not $version.IsPrerelease) -or $MarkPackageAsShipped)
{
Write-Host "Submitting API Review request for package $($pkg), File path: $($pkgPath)"
$respCode = Submit-APIReview $pkgInfo $pkgPath
$respCode = Submit-APIReview $pkgInfo $pkgPath $packageName
Write-Host "HTTP Response code: $($respCode)"
# no need to check API review status when marking a package as shipped