Skip to content

Commit da246f5

Browse files
weshaggardazure-sdk
authored andcommitted
Fix GroupId property access
1 parent bc6b026 commit da246f5

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

eng/common/scripts/Helpers/DevOps-WorkItem-Helpers.ps1

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ function CheckDevOpsAccess()
6565
}
6666
}
6767

68+
function GetGroupId($pkg)
69+
{
70+
if ($pkg.PSObject.Properties.Name -contains "GroupId") {
71+
return $pkg.GroupId
72+
}
73+
return $null
74+
}
75+
6876
function Invoke-AzBoardsCmd($subCmd, $parameters, $output = $true)
6977
{
7078
$azCmdStr = "az boards ${subCmd} $($parameters -join ' ')"
@@ -466,10 +474,11 @@ function UpdatePackageWorkItemReleaseState($id, $state, $releaseType, $outputCom
466474

467475
function FindOrCreateClonePackageWorkItem($lang, $pkg, $verMajorMinor, $allowPrompt = $false, $outputCommand = $false, $relatedId = $null, $tag= $null, $ignoreReleasePlannerTests = $true)
468476
{
469-
$workItem = FindPackageWorkItem -lang $lang -packageName $pkg.Package -version $verMajorMinor -includeClosed $true -outputCommand $outputCommand -tag $tag -ignoreReleasePlannerTests $ignoreReleasePlannerTests -groupId $pkg.GroupId
477+
$groupId = GetGroupId $pkg
478+
$workItem = FindPackageWorkItem -lang $lang -packageName $pkg.Package -version $verMajorMinor -includeClosed $true -outputCommand $outputCommand -tag $tag -ignoreReleasePlannerTests $ignoreReleasePlannerTests -groupId $groupId
470479

471480
if (!$workItem) {
472-
$latestVersionItem = FindLatestPackageWorkItem -lang $lang -packageName $pkg.Package -outputCommand $outputCommand -tag $tag -ignoreReleasePlannerTests $ignoreReleasePlannerTests -groupId $pkg.GroupId
481+
$latestVersionItem = FindLatestPackageWorkItem -lang $lang -packageName $pkg.Package -outputCommand $outputCommand -tag $tag -ignoreReleasePlannerTests $ignoreReleasePlannerTests -groupId $groupId
473482
$assignedTo = "me"
474483
$extraFields = @()
475484
if ($latestVersionItem) {
@@ -519,11 +528,7 @@ function CreateOrUpdatePackageWorkItem($lang, $pkg, $verMajorMinor, $existingIte
519528
}
520529

521530
# 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-
}
531+
$pkgGroupId = GetGroupId $pkg
527532
$pkgName = $pkg.Package
528533
$pkgDisplayName = $pkg.DisplayName
529534
$pkgType = $pkg.Type
@@ -1043,7 +1048,7 @@ function UpdatePackageVersions($pkgWorkItem, $plannedVersions, $shippedVersions)
10431048
function UpdateValidationStatus($pkgvalidationDetails, $BuildDefinition, $PipelineUrl)
10441049
{
10451050
$pkgName = $pkgValidationDetails.Name
1046-
$groupId = $pkgValidationDetails.GroupId
1051+
$groupId = GetGroupId $pkgValidationDetails
10471052
$versionString = $pkgValidationDetails.Version
10481053

10491054
$parsedNewVersion = [AzureEngSemanticVersion]::new($versionString)

0 commit comments

Comments
 (0)