-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sync eng/common directory with azure-sdk-tools for PR 1611 (#1766)
* Add API status check * Revert temp change * Update as per review comments * Removed blank line * Review comments to use az cli * Changes to move az cli commands to caller script and other review comments * Skip languages that's not supported in APIView * Fix bug in language mapping Co-authored-by: praveenkuttappan <[email protected]> Co-authored-by: praveenkuttappan <[email protected]>
- Loading branch information
1 parent
743e6dd
commit 522886a
Showing
2 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
function MapLanguageName($language) | ||
{ | ||
$lang = $language | ||
# Update language name to match those in API cosmos DB. Cosmos SQL is case sensitive and handling this within the query makes it slow. | ||
if($lang -eq 'javascript'){ | ||
$lang = "JavaScript" | ||
} | ||
elseif ($lang -eq "dotnet"){ | ||
$lang = "C#" | ||
} | ||
elseif ($lang -eq "java"){ | ||
$lang = "Java" | ||
} | ||
elseif ($lang -eq "python"){ | ||
$lang = "Python" | ||
} | ||
else{ | ||
$lang = $null | ||
} | ||
return $lang | ||
} | ||
|
||
function Check-ApiReviewStatus($packageName, $packageVersion, $language, $url, $apiKey) | ||
{ | ||
# Get API view URL and API Key to check status | ||
Write-Host "Checking API review status" | ||
$lang = MapLanguageName -language $language | ||
if ($lang -eq $null) { | ||
return | ||
} | ||
$headers = @{ "ApiKey" = $apiKey } | ||
$body = @{ | ||
language = $lang | ||
packageName = $packageName | ||
packageVersion = $packageVersion | ||
} | ||
|
||
try | ||
{ | ||
$response = Invoke-WebRequest $url -Method 'GET' -Headers $headers -Body $body | ||
if ($response.StatusCode -eq '200') | ||
{ | ||
Write-Host "API Review is approved for package $($packageName)" | ||
} | ||
else | ||
{ | ||
Write-Warning "API Review is not approved for package $($packageName). Release pipeline will fail if API review is not approved." | ||
Write-Host "You can check http://aka.ms/azsdk/engsys/apireview/faq for more details on API Approval." | ||
} | ||
} | ||
catch | ||
{ | ||
Write-Warning "Failed to check API review status for package $($PackageName). You can check http://aka.ms/azsdk/engsys/apireview/faq for more details on API Approval." | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters