Used full pkg name in release work items

This commit is contained in:
ray chen 2025-11-22 01:19:52 +00:00 committed by azure-sdk
parent a2082c3e5b
commit 6b28105085
2 changed files with 28 additions and 5 deletions

View File

@ -266,3 +266,20 @@ function Split-ArrayIntoBatches {
return , $batches
}
# Get the full package name based on packageInfo properties
# Returns Group+ArtifactName if Group exists and has a value, otherwise returns Name
function Get-FullPackageName {
param (
[Parameter(Mandatory=$true)]
[PSCustomObject]$PackageInfo
)
if ($PackageInfo.PSObject.Members.Name -contains "Group") {
$groupId = $PackageInfo.Group
if ($groupId) {
return "${groupId}+$($PackageInfo.ArtifactName)"
}
}
return $PackageInfo.Name
}

View File

@ -135,8 +135,8 @@ function IsVersionShipped($packageName, $packageVersion)
function CreateUpdatePackageWorkItem($pkgInfo)
{
# This function will create or update package work item in Azure DevOps
$fullPkgNameInRemoteFeed = Get-FullPackageName -PackageInfo $pkgInfo
$versionString = $pkgInfo.Version
$packageName = $pkgInfo.Name
$plannedDate = $pkgInfo.ReleaseStatus
$setReleaseState = $true
if (!$plannedDate -or $plannedDate -eq "Unreleased")
@ -147,7 +147,7 @@ function CreateUpdatePackageWorkItem($pkgInfo)
# Create or update package work item
$result = Update-DevOpsReleaseWorkItem -language $LanguageDisplayName `
-packageName $packageName `
-packageName $fullPkgNameInRemoteFeed `
-version $versionString `
-plannedDate $plannedDate `
-packageRepoPath $pkgInfo.serviceDirectory `
@ -176,13 +176,17 @@ function ProcessPackage($packageInfo)
$changeLogPath = $packageInfo.ChangeLogPath
$versionString = $packageInfo.Version
Write-Host "Checking if we need to create or update work item for package $pkgName with version $versionString."
$isShipped = IsVersionShipped $pkgName $versionString
# If there's a groupId that means this is Java and pkgName = GroupId+ArtifactName
Write-Host "Package name before checking groupId: $pkgName"
$fullPkgNameInRemoteFeed = Get-FullPackageName -PackageInfo $packageInfo
$isShipped = IsVersionShipped $fullPkgNameInRemoteFeed $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."
return
}
Write-Host "Validating package $pkgName with version $versionString."
Write-Host "Validating package $fullPkgNameInRemoteFeed with version $versionString."
# Change log validation
$changeLogStatus = [PSCustomObject]@{
@ -197,6 +201,7 @@ function ProcessPackage($packageInfo)
# If there's a groupId that means this is Java and pkgName = GroupId+ArtifactName
# but the VerifyAPIReview requires GroupId:ArtifactName
# Can API view handle groupId+artifactName format so that we can use consistent format?
Write-Host "Package name before checking groupId: $fullPackageName"
if ($packageInfo.PSObject.Members.Name -contains "Group") {
$groupId = $packageInfo.Group
@ -209,7 +214,7 @@ function ProcessPackage($packageInfo)
$apireviewDetails = VerifyAPIReview $fullPackageName $packageInfo.Version $Language
$pkgValidationDetails= [PSCustomObject]@{
Name = $pkgName
Name = $fullPkgNameInRemoteFeed
Version = $packageInfo.Version
ChangeLogValidation = $changeLogStatus
APIReviewValidation = $apireviewDetails.ApiviewApproval
@ -220,6 +225,7 @@ function ProcessPackage($packageInfo)
Write-Host "Output: $($output)"
# Create json token file in artifact path
# Does the following validation file name also need to use full package name with groupId?
$tokenFile = Join-Path $ArtifactPath "$($packageInfo.ArtifactName)-Validation.json"
$output | Out-File -FilePath $tokenFile -Encoding utf8