Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync eng/common directory with azure-sdk-tools for PR 7975 #35013

Merged
merged 3 commits into from
Apr 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}
}
Loading