@@ -215,16 +215,17 @@ function FindParentWorkItem($serviceName, $packageDisplayName, $outputCommand =
215215$packageWorkItems = @ {}
216216$packageWorkItemWithoutKeyFields = @ {}
217217
218- function FindLatestPackageWorkItem ($lang , $packageName , $outputCommand = $true , $ignoreReleasePlannerTests = $true , $tag = $null )
218+ function FindLatestPackageWorkItem ($lang , $packageName , $groupId = $null , $ outputCommand = $true , $ignoreReleasePlannerTests = $true , $tag = $null )
219219{
220220 # Cache all the versions of this package and language work items
221- $null = FindPackageWorkItem $lang $packageName - includeClosed $true - outputCommand $outputCommand - ignoreReleasePlannerTests $ignoreReleasePlannerTests - tag $tag
221+ $null = FindPackageWorkItem $lang $packageName - includeClosed $true - outputCommand $outputCommand - ignoreReleasePlannerTests $ignoreReleasePlannerTests - tag $tag - groupId $groupId
222222
223223 $latestWI = $null
224224 foreach ($wi in $packageWorkItems.Values )
225225 {
226226 if ($wi.fields [" Custom.Language" ] -ne $lang ) { continue }
227227 if ($wi.fields [" Custom.Package" ] -ne $packageName ) { continue }
228+ if ($groupId -and $wi.fields [" Custom.GroupId" ] -ne $groupId ) { continue }
228229
229230 if (! $latestWI ) {
230231 $latestWI = $wi
@@ -238,9 +239,9 @@ function FindLatestPackageWorkItem($lang, $packageName, $outputCommand = $true,
238239 return $latestWI
239240}
240241
241- function FindPackageWorkItem ($lang , $packageName , $version , $outputCommand = $true , $includeClosed = $false , $ignoreReleasePlannerTests = $true , $tag = $null )
242+ function FindPackageWorkItem ($lang , $packageName , $version , $groupId = $null , $ outputCommand = $true , $includeClosed = $false , $ignoreReleasePlannerTests = $true , $tag = $null )
242243{
243- $key = BuildHashKeyNoNull $lang $packageName $version
244+ $key = BuildHashKey $lang $packageName $version $groupId
244245 if ($key -and $packageWorkItems.ContainsKey ($key )) {
245246 return $packageWorkItems [$key ]
246247 }
@@ -253,6 +254,7 @@ function FindPackageWorkItem($lang, $packageName, $version, $outputCommand = $tr
253254 $fields += " System.Tags"
254255 $fields += " Custom.Language"
255256 $fields += " Custom.Package"
257+ $fields += " Custom.GroupId"
256258 $fields += " Custom.PackageDisplayName"
257259 $fields += " System.Title"
258260 $fields += " Custom.PackageType"
@@ -282,6 +284,9 @@ function FindPackageWorkItem($lang, $packageName, $version, $outputCommand = $tr
282284 if ($packageName ) {
283285 $query += " AND [Package] = '${packageName} '"
284286 }
287+ if ($groupId ) {
288+ $query += " AND [GroupId] = '${groupId} '"
289+ }
285290 if ($version ) {
286291 $query += " AND [PackageVersionMajorMinor] = '${version} '"
287292 }
@@ -295,7 +300,7 @@ function FindPackageWorkItem($lang, $packageName, $version, $outputCommand = $tr
295300
296301 foreach ($wi in $workItems )
297302 {
298- $localKey = BuildHashKeyNoNull $wi.fields [" Custom.Language" ] $wi.fields [" Custom.Package" ] $wi.fields [" Custom.PackageVersionMajorMinor" ]
303+ $localKey = BuildHashKey $wi.fields [" Custom.Language" ] $wi.fields [" Custom.Package" ] $wi.fields [" Custom.PackageVersionMajorMinor" ] $wi .fields [ " Custom.GroupId " ]
299304 if (! $localKey ) {
300305 $packageWorkItemWithoutKeyFields [$wi.id ] = $wi
301306 Write-Host " Skipping package [$ ( $wi.id ) ]$ ( $wi.fields [' System.Title' ]) which is missing required fields language, package, or version."
@@ -461,10 +466,10 @@ function UpdatePackageWorkItemReleaseState($id, $state, $releaseType, $outputCom
461466
462467function FindOrCreateClonePackageWorkItem ($lang , $pkg , $verMajorMinor , $allowPrompt = $false , $outputCommand = $false , $relatedId = $null , $tag = $null , $ignoreReleasePlannerTests = $true )
463468{
464- $workItem = FindPackageWorkItem - lang $lang - packageName $pkg.Package - version $verMajorMinor - includeClosed $true - outputCommand $outputCommand - tag $tag - ignoreReleasePlannerTests $ignoreReleasePlannerTests
469+ $workItem = FindPackageWorkItem - lang $lang - packageName $pkg.Package - version $verMajorMinor - includeClosed $true - outputCommand $outputCommand - tag $tag - ignoreReleasePlannerTests $ignoreReleasePlannerTests - groupId $pkg .GroupId
465470
466471 if (! $workItem ) {
467- $latestVersionItem = FindLatestPackageWorkItem - lang $lang - packageName $pkg.Package - outputCommand $outputCommand - tag $tag - ignoreReleasePlannerTests $ignoreReleasePlannerTests
472+ $latestVersionItem = FindLatestPackageWorkItem - lang $lang - packageName $pkg.Package - outputCommand $outputCommand - tag $tag - ignoreReleasePlannerTests $ignoreReleasePlannerTests - groupId $pkg .GroupId
468473 $assignedTo = " me"
469474 $extraFields = @ ()
470475 if ($latestVersionItem ) {
@@ -512,6 +517,13 @@ function CreateOrUpdatePackageWorkItem($lang, $pkg, $verMajorMinor, $existingIte
512517 Write-Host " Cannot create or update because one of lang, pkg or verMajorMinor aren't set. [$lang |$ ( $pkg.Package ) |$verMajorMinor ]"
513518 return
514519 }
520+
521+ # PackageProp object uses Group, while other places use GroupId, such as in work item fields and package csv files.
522+ $pkgGroupId = if ($pkg.PSObject.Properties.Name -contains " GroupId" ) {
523+ $pkg.GroupId
524+ } else {
525+ $null
526+ }
515527 $pkgName = $pkg.Package
516528 $pkgDisplayName = $pkg.DisplayName
517529 $pkgType = $pkg.Type
@@ -523,6 +535,7 @@ function CreateOrUpdatePackageWorkItem($lang, $pkg, $verMajorMinor, $existingIte
523535 $fields = @ ()
524536 $fields += " `" Language=${lang} `" "
525537 $fields += " `" Package=${pkgName} `" "
538+ $fields += " `" GroupId=${pkgGroupId} `" "
526539 $fields += " `" PackageDisplayName=${pkgDisplayName} `" "
527540 $fields += " `" PackageType=${pkgType} `" "
528541 $fields += " `" PackageTypeNewLibrary=${pkgNewLibrary} `" "
@@ -540,6 +553,7 @@ function CreateOrUpdatePackageWorkItem($lang, $pkg, $verMajorMinor, $existingIte
540553
541554 if ($lang -ne $existingItem.fields [" Custom.Language" ]) { $changedField = " Custom.Language" }
542555 if ($pkgName -ne $existingItem.fields [" Custom.Package" ]) { $changedField = " Custom.Package" }
556+ if ($pkgGroupId -ne $existingItem.fields [" Custom.GroupId" ]) { $changedField = " Custom.GroupId" }
543557 if ($verMajorMinor -ne $existingItem.fields [" Custom.PackageVersionMajorMinor" ]) { $changedField = " Custom.PackageVersionMajorMinor" }
544558 if ($pkgDisplayName -ne $existingItem.fields [" Custom.PackageDisplayName" ]) { $changedField = " Custom.PackageDisplayName" }
545559 if ($pkgType -ne [string ]$existingItem.fields [" Custom.PackageType" ]) { $changedField = " Custom.PackageType" }
@@ -1029,15 +1043,16 @@ function UpdatePackageVersions($pkgWorkItem, $plannedVersions, $shippedVersions)
10291043function UpdateValidationStatus ($pkgvalidationDetails , $BuildDefinition , $PipelineUrl )
10301044{
10311045 $pkgName = $pkgValidationDetails.Name
1046+ $groupId = $pkgValidationDetails.GroupId
10321047 $versionString = $pkgValidationDetails.Version
10331048
10341049 $parsedNewVersion = [AzureEngSemanticVersion ]::new($versionString )
10351050 $versionMajorMinor = " " + $parsedNewVersion.Major + " ." + $parsedNewVersion.Minor
1036- $workItem = FindPackageWorkItem - lang $LanguageDisplayName - packageName $pkgName - version $versionMajorMinor - includeClosed $true - outputCommand $false
1051+ $workItem = FindPackageWorkItem - lang $LanguageDisplayName - packageName $pkgName - groupId $groupId - version $versionMajorMinor - includeClosed $true - outputCommand $false
10371052
10381053 if (! $workItem )
10391054 {
1040- Write-Host " No work item found for package [$pkgName ]."
1055+ Write-Host " No work item found for package [$pkgName ] with groupId [ $groupId ]."
10411056 return $false
10421057 }
10431058
@@ -1250,6 +1265,7 @@ function Update-DevOpsReleaseWorkItem {
12501265 [Parameter (Mandatory = $true )]
12511266 [string ]$version ,
12521267 [string ]$plannedDate ,
1268+ [string ]$groupId = $null ,
12531269 [string ]$serviceName = $null ,
12541270 [string ]$packageDisplayName = $null ,
12551271 [string ]$packageRepoPath = " NA" ,
@@ -1277,6 +1293,7 @@ function Update-DevOpsReleaseWorkItem {
12771293
12781294 $packageInfo = [PSCustomObject ][ordered ]@ {
12791295 Package = $packageName
1296+ GroupId = $groupId
12801297 DisplayName = $packageDisplayName
12811298 ServiceName = $serviceName
12821299 RepoPath = $packageRepoPath
0 commit comments