Sync eng/common directory with azure-sdk-tools for PR 4628 (#4111)

* Add new check in APIView to verify and enforce package name approval

* Changes as per review feedback

* Apply suggestions from code review

Co-authored-by: Wes Haggard <weshaggard@users.noreply.github.com>

Co-authored-by: praveenkuttappan <praveen.kuttappan@gmail.com>
Co-authored-by: Praven Kuttappan <55455725+praveenkuttappan@users.noreply.github.com>
Co-authored-by: Wes Haggard <weshaggard@users.noreply.github.com>
This commit is contained in:
Azure SDK Bot 2022-11-17 12:42:22 -05:00 committed by GitHub
parent 852c07d16b
commit 385492999d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 17 deletions

View File

@ -130,6 +130,13 @@ if ($packages)
}
elseif ($version.IsPrerelease)
{
# Check if package name is approved. Preview version cannot be released without package name approval
if ($respCode -eq '202' -and $pkgInfo.ReleaseStatus -and $pkgInfo.ReleaseStatus -ne "Unreleased")
{
Write-Host "Package name is not yet approved on APIView for $($PackageName). Package name must be approved by an API approver for a beta release if it was never released a stable version."
Write-Host "You can check http://aka.ms/azsdk/engsys/apireview/faq for more details on package name approval."
exit 1
}
# Ignore API review status for prerelease version
Write-Host "Package version is not GA. Ignoring API view approval status"
}

View File

@ -42,9 +42,19 @@ function Check-ApiReviewStatus($packageName, $packageVersion, $language, $url, $
{
Write-Host "API Review is approved for package $($packageName)"
}
else if ($response.StatusCode -eq '202')
{
Write-Host "Package name $($packageName) is not yet approved by an SDK API approver. Package name must be approved to release a beta version if $($packageName) was never released a stable version."
Write-Host "You can check http://aka.ms/azsdk/engsys/apireview/faq for more details on package name Approval."
}
else if ($response.StatusCode -eq '201')
{
Write-Warning "API Review is not approved for package $($packageName). Release pipeline will fail if API review is not approved for a stable version release."
Write-Host "You can check http://aka.ms/azsdk/engsys/apireview/faq for more details on API Approval."
}
else
{
Write-Warning "API Review is not approved for package $($packageName). Release pipeline will fail if API review is not approved."
Write-Warning "API review status check returned unexpected response. $($response)"
Write-Host "You can check http://aka.ms/azsdk/engsys/apireview/faq for more details on API Approval."
}
}

View File

@ -152,24 +152,21 @@ if ($LASTEXITCODE -ne 0) {
exit 1
}
# Check API status if version is GA
if (!$newVersionParsed.IsPrerelease)
# Check API status
try
{
try
{
az account show *> $null
if (!$?) {
Write-Host 'Running az login...'
az login *> $null
}
$url = az keyvault secret show --name "APIURL" --vault-name "AzureSDKPrepRelease-KV" --query "value" --output "tsv"
$apiKey = az keyvault secret show --name "APIKEY" --vault-name "AzureSDKPrepRelease-KV" --query "value" --output "tsv"
Check-ApiReviewStatus -PackageName $packageProperties.Name -packageVersion $newVersion -Language $LanguageDisplayName -url $url -apiKey $apiKey
}
catch
{
Write-Warning "Failed to get APIView URL and API Key from Keyvault AzureSDKPrepRelease-KV. Please check and ensure you have access to this Keyvault as reader."
az account show *> $null
if (!$?) {
Write-Host 'Running az login...'
az login *> $null
}
$url = az keyvault secret show --name "APIURL" --vault-name "AzureSDKPrepRelease-KV" --query "value" --output "tsv"
$apiKey = az keyvault secret show --name "APIKEY" --vault-name "AzureSDKPrepRelease-KV" --query "value" --output "tsv"
Check-ApiReviewStatus -PackageName $packageProperties.Name -packageVersion $newVersion -Language $LanguageDisplayName -url $url -apiKey $apiKey
}
catch
{
Write-Warning "Failed to get APIView URL and API Key from Keyvault AzureSDKPrepRelease-KV. Please check and ensure you have access to this Keyvault as reader."
}
if ($releaseTrackingOnly)