Skip to content

Commit

Permalink
Sync eng/common directory with azure-sdk-tools for PR 7975 (Azure#35013)
Browse files Browse the repository at this point in the history
* Pass Group in request to get package status
  • Loading branch information
azure-sdk authored Apr 1, 2024
1 parent 6e8c5c9 commit 95593f6
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions eng/common/scripts/Validate-Package.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -187,21 +187,21 @@ function CreateUpdatePackageWorkItem($pkgInfo)
}

# Read package property file and identify all packages to process
Write-Host "Processing package: $PackageName"
Write-Host "Processing artifact: $PackageName"
Write-Host "Is Release Build: $IsReleaseBuild"
$packagePropertyFile = Join-Path $ConfigFileDir "$PackageName.json"
$pkgInfo = Get-Content $packagePropertyFile | ConvertFrom-Json

$pkgName = $pkgInfo.Name
$changeLogPath = $pkgInfo.ChangeLogPath
$versionString = $pkgInfo.Version
Write-Host "Checking if we need to create or update work item for package $packageName with version $versionString."
$isShipped = IsVersionShipped $packageName $versionString
Write-Host "Checking if we need to create or update work item for package $pkgName with version $versionString."
$isShipped = IsVersionShipped $pkgName $versionString
if ($isShipped) {
Write-Host "Package work item already exists for version [$versionString] that is marked as shipped. Skipping the update of package work item."
exit 0
}

Write-Host "Validating package $packageName with version $versionString."
Write-Host "Validating package $pkgName with version $versionString."

# Change log validation
$changeLogStatus = [PSCustomObject]@{
Expand All @@ -212,10 +212,19 @@ $changeLogStatus = [PSCustomObject]@{
ValidateChangeLog $changeLogPath $versionString $changeLogStatus

# API review and package name validation
$apireviewDetails = VerifyAPIReview $PackageName $pkgInfo.Version $Language
$fulPackageName = $pkgName
$groupId = $null
if ($pkgInfo.PSObject.Members.Name -contains "Group") {
$groupId = $pkgInfo.Group
}
if ($groupId){
$fulPackageName = "${groupId}:${pkgName}"
}
Write-Host "Checking API review status for package $fulPackageName"
$apireviewDetails = VerifyAPIReview $fulPackageName $pkgInfo.Version $Language

$pkgValidationDetails= [PSCustomObject]@{
Name = $PackageName
Name = $pkgName
Version = $pkgInfo.Version
ChangeLogValidation = $changeLogStatus
APIReviewValidation = $apireviewDetails.ApiviewApproval
Expand Down Expand Up @@ -246,7 +255,7 @@ Write-Host "Package Name status:" $apireviewDetails.PackageNameApproval.Status
if ($IsReleaseBuild)
{
if (!$updatedWi -or $changelogStatus.Status -ne "Success" -or $apireviewDetails.ApiviewApproval.Status -ne "Approved" -or $apireviewDetails.PackageNameApproval.Status -ne "Approved") {
Write-Error "At least one of the Validations above failed for package $PackageName with version $versionString."
Write-Error "At least one of the Validations above failed for package $pkgName with version $versionString."
exit 1
}
}

0 comments on commit 95593f6

Please sign in to comment.