From dac4c3ff7d57bf5889d88fc9e8a33822fb189302 Mon Sep 17 00:00:00 2001 From: ray chen Date: Sat, 22 Nov 2025 01:19:52 +0000 Subject: [PATCH 01/10] Used full pkg name in release work items --- eng/common/scripts/Helpers/Package-Helpers.ps1 | 17 +++++++++++++++++ eng/common/scripts/Validate-All-Packages.ps1 | 16 +++++++++++----- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/eng/common/scripts/Helpers/Package-Helpers.ps1 b/eng/common/scripts/Helpers/Package-Helpers.ps1 index 084bc34ab529..a61f37bbe471 100644 --- a/eng/common/scripts/Helpers/Package-Helpers.ps1 +++ b/eng/common/scripts/Helpers/Package-Helpers.ps1 @@ -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 +} diff --git a/eng/common/scripts/Validate-All-Packages.ps1 b/eng/common/scripts/Validate-All-Packages.ps1 index a247ec3b5110..54304568bae6 100644 --- a/eng/common/scripts/Validate-All-Packages.ps1 +++ b/eng/common/scripts/Validate-All-Packages.ps1 @@ -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 From 1470aa49cb4bd5ec75d342a5ce17a7eec9e3e0c6 Mon Sep 17 00:00:00 2001 From: ray chen Date: Wed, 26 Nov 2025 00:34:34 +0000 Subject: [PATCH 02/10] Used full pkg name for dev ops work item --- .../templates/steps/verify-changelog.yml | 4 +++ .../scripts/Helpers/Package-Helpers.ps1 | 7 ++++- eng/common/scripts/Package-Properties.ps1 | 17 ++++++++-- eng/common/scripts/Prepare-Release.ps1 | 31 +++++++++++++++---- eng/common/scripts/Update-ChangeLog.ps1 | 6 ++-- eng/common/scripts/Validate-All-Packages.ps1 | 12 ++----- eng/common/scripts/Verify-ChangeLog.ps1 | 13 ++++++-- 7 files changed, 68 insertions(+), 22 deletions(-) diff --git a/eng/common/pipelines/templates/steps/verify-changelog.yml b/eng/common/pipelines/templates/steps/verify-changelog.yml index 113e0a5e695a..b1e34c662e1b 100644 --- a/eng/common/pipelines/templates/steps/verify-changelog.yml +++ b/eng/common/pipelines/templates/steps/verify-changelog.yml @@ -14,6 +14,9 @@ parameters: - name: Condition type: string default: succeeded() +- name: GroupId + type: string + default: '' steps: - task: Powershell@2 @@ -23,6 +26,7 @@ steps: -PackageName '${{ parameters.PackageName }}' -ServiceDirectory '${{ coalesce(parameters.ServiceDirectory, parameters.ServiceName) }}' -ForRelease $${{ parameters.ForRelease }} + -GroupId '${{ parameters.GroupId }}' pwsh: true workingDirectory: $(Pipeline.Workspace) displayName: Verify ChangeLogEntry for ${{ parameters.PackageName }} diff --git a/eng/common/scripts/Helpers/Package-Helpers.ps1 b/eng/common/scripts/Helpers/Package-Helpers.ps1 index a61f37bbe471..37b4a4bfa932 100644 --- a/eng/common/scripts/Helpers/Package-Helpers.ps1 +++ b/eng/common/scripts/Helpers/Package-Helpers.ps1 @@ -269,15 +269,20 @@ function Split-ArrayIntoBatches { # Get the full package name based on packageInfo properties # Returns Group+ArtifactName if Group exists and has a value, otherwise returns Name +# If UseColonSeparator switch is enabled, returns Group:ArtifactName format (colon separator) function Get-FullPackageName { param ( [Parameter(Mandatory=$true)] - [PSCustomObject]$PackageInfo + [PSCustomObject]$PackageInfo, + [switch]$UseColonSeparator ) if ($PackageInfo.PSObject.Members.Name -contains "Group") { $groupId = $PackageInfo.Group if ($groupId) { + if ($UseColonSeparator) { + return "${groupId}:$($PackageInfo.ArtifactName)" + } return "${groupId}+$($PackageInfo.ArtifactName)" } } diff --git a/eng/common/scripts/Package-Properties.ps1 b/eng/common/scripts/Package-Properties.ps1 index 930602444fdb..ea4221fcd6b6 100644 --- a/eng/common/scripts/Package-Properties.ps1 +++ b/eng/common/scripts/Package-Properties.ps1 @@ -230,16 +230,29 @@ class PackageProps { # Returns important properties of the package relative to the language repo # Returns a PS Object with properties @ { pkgName, pkgVersion, pkgDirectoryPath, pkgReadMePath, pkgChangeLogPath } # Note: python is required for parsing python package properties. +# GroupId is optional and is used to filter packages for languages that support group identifiers (e.g., Java). +# When GroupId is provided, the function will match both the package name and the group ID. function Get-PkgProperties { Param ( [Parameter(Mandatory = $true)] [string]$PackageName, - [string]$ServiceDirectory + [string]$ServiceDirectory, + [string]$GroupId ) $allPkgProps = Get-AllPkgProperties -ServiceDirectory $ServiceDirectory - $pkgProps = $allPkgProps.Where({ $_.Name -eq $PackageName -or $_.ArtifactName -eq $PackageName }); + + if ([string]::IsNullOrEmpty($GroupId)) { + $pkgProps = $allPkgProps.Where({ $_.Name -eq $PackageName -or $_.ArtifactName -eq $PackageName }); + } + else { + $pkgProps = $allPkgProps.Where({ + ($_.Name -eq $PackageName -or $_.ArtifactName -eq $PackageName) -and + $_.PSObject.Properties.Name -contains "Group" -and + $_.Group -eq $GroupId + }); + } if ($pkgProps.Count -ge 1) { if ($pkgProps.Count -gt 1) { diff --git a/eng/common/scripts/Prepare-Release.ps1 b/eng/common/scripts/Prepare-Release.ps1 index 415831e32300..97c0ecf94858 100755 --- a/eng/common/scripts/Prepare-Release.ps1 +++ b/eng/common/scripts/Prepare-Release.ps1 @@ -30,6 +30,9 @@ If one isn't provided, then it will compute the next ship date or today's date i .PARAMETER ReleaseTrackingOnly Optional: If this switch is passed then the script will only update the release work items and not update the versions in the local repo or validate the changelog. +.PARAMETER GroupId +Optional: The group ID for the package. For Java packages, if not provided, the script will prompt for input with 'com.azure' as the default. + .EXAMPLE PS> ./eng/common/scripts/Prepare-Release.ps1 @@ -49,7 +52,8 @@ param( [string]$PackageName, [string]$ServiceDirectory, [string]$ReleaseDate, # Pass Date in the form MM/dd/yyyy" - [switch]$ReleaseTrackingOnly = $false + [switch]$ReleaseTrackingOnly = $false, + [string]$GroupId ) Set-StrictMode -Version 3 @@ -57,6 +61,18 @@ Set-StrictMode -Version 3 . ${PSScriptRoot}\Helpers\ApiView-Helpers.ps1 . ${PSScriptRoot}\Helpers\DevOps-WorkItem-Helpers.ps1 +# Prompt for GroupId if language is Java and GroupId is not provided +if ($Language -eq 'java' -and [string]::IsNullOrEmpty($GroupId)) { + $userInput = Read-Host "Input the group id, or press Enter to use 'com.azure' as the group id" + if ([string]::IsNullOrWhiteSpace($userInput)) { + $GroupId = "com.azure" + } + else { + $GroupId = $userInput.Trim() + } + Write-Host "Using GroupId: $GroupId" -ForegroundColor Green +} + function Get-ReleaseDay($baseDate) { # Find first friday @@ -74,7 +90,7 @@ function Get-ReleaseDay($baseDate) $ErrorPreference = 'Stop' $packageProperties = $null -$packageProperties = Get-PkgProperties -PackageName $PackageName -ServiceDirectory $ServiceDirectory +$packageProperties = Get-PkgProperties -PackageName $PackageName -ServiceDirectory $ServiceDirectory -GroupId $GroupId if (!$packageProperties) { @@ -128,7 +144,7 @@ if (Test-Path "Function:GetExistingPackageVersions") } $currentProjectVersion = $packageProperties.Version -$newVersion = Read-Host -Prompt "Input the new version, or press Enter to use use current project version '$currentProjectVersion'" +$newVersion = Read-Host -Prompt "Input the new version, or press Enter to use current project version '$currentProjectVersion'" if (!$newVersion) { @@ -142,8 +158,10 @@ if ($null -eq $newVersionParsed) exit 1 } +$fullPackageName = Get-FullPackageName -PackageInfo $packageProperties + $result = Update-DevOpsReleaseWorkItem -language $LanguageDisplayName ` - -packageName $packageProperties.Name ` + -packageName $fullPackageName ` -version $newVersion ` -plannedDate $releaseDateString ` -packageRepoPath $packageProperties.serviceDirectory ` @@ -166,7 +184,8 @@ try } $url = az keyvault secret show --name "APIURL" --vault-name "AzureSDKPrepRelease-KV" --query "value" --output "tsv" $apiKey = az keyvault secret show --name "APIKEY" --vault-name "AzureSDKPrepRelease-KV" --query "value" --output "tsv" - Check-ApiReviewStatus -PackageName $packageProperties.Name -packageVersion $newVersion -Language $LanguageDisplayName -url $url -apiKey $apiKey + $fullPackageNameInApiView = Get-FullPackageName -PackageInfo $packageProperties -UseColonSeparator + Check-ApiReviewStatus -PackageName $fullPackageNameInApiView -packageVersion $newVersion -Language $LanguageDisplayName -url $url -apiKey $apiKey } catch { @@ -194,7 +213,7 @@ if (Test-Path "Function:SetPackageVersion") } SetPackageVersion -PackageName $packageProperties.Name -Version $newVersion ` -ServiceDirectory $packageProperties.ServiceDirectory -ReleaseDate $releaseDateString ` - -PackageProperties $packageProperties -ReplaceLatestEntryTitle $replaceLatestEntryTitle + -PackageProperties $packageProperties -ReplaceLatestEntryTitle $replaceLatestEntryTitle -GroupId $packageProperties.Group } else { diff --git a/eng/common/scripts/Update-ChangeLog.ps1 b/eng/common/scripts/Update-ChangeLog.ps1 index 3541cd489403..3059002f3511 100644 --- a/eng/common/scripts/Update-ChangeLog.ps1 +++ b/eng/common/scripts/Update-ChangeLog.ps1 @@ -4,6 +4,7 @@ # Version : Version to add or replace in change log # Unreleased: Default is true. If it is set to false, then today's date will be set in verion title. If it is True then title will show "Unreleased" # ReplaceLatestEntryTitle: Replaces the latest changelog entry title. +# GroupId: Optional. The group ID for the package. Used for filtering packages in languages that support group identifiers (e.g., Java). [CmdletBinding()] param ( @@ -14,7 +15,8 @@ param ( [Boolean]$Unreleased = $true, [Boolean]$ReplaceLatestEntryTitle = $false, [String]$ChangelogPath, - [String]$ReleaseDate + [String]$ReleaseDate, + [String]$GroupId ) Set-StrictMode -Version 3 @@ -59,7 +61,7 @@ if ($null -eq [AzureEngSemanticVersion]::ParseVersionString($Version)) if ([string]::IsNullOrEmpty($ChangelogPath)) { - $pkgProperties = Get-PkgProperties -PackageName $PackageName -ServiceDirectory $ServiceDirectory + $pkgProperties = Get-PkgProperties -PackageName $PackageName -ServiceDirectory $ServiceDirectory -GroupId $GroupId $ChangelogPath = $pkgProperties.ChangeLogPath } diff --git a/eng/common/scripts/Validate-All-Packages.ps1 b/eng/common/scripts/Validate-All-Packages.ps1 index 54304568bae6..d888a773c24f 100644 --- a/eng/common/scripts/Validate-All-Packages.ps1 +++ b/eng/common/scripts/Validate-All-Packages.ps1 @@ -201,15 +201,9 @@ 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 - if ($groupId){ - $fullPackageName = "${groupId}:$($packageInfo.ArtifactName)" - } - } - + # Technically we can use groupId+artifactName format in api view, + # however it will need to migrate the existing data and Java parser also needs the change. + $fullPackageName = Get-FullPackageName -PackageInfo $packageInfo -UseColonSeparator Write-Host "Checking API review status for package $fullPackageName" $apireviewDetails = VerifyAPIReview $fullPackageName $packageInfo.Version $Language diff --git a/eng/common/scripts/Verify-ChangeLog.ps1 b/eng/common/scripts/Verify-ChangeLog.ps1 index 611f4c737541..f8f9870eb222 100644 --- a/eng/common/scripts/Verify-ChangeLog.ps1 +++ b/eng/common/scripts/Verify-ChangeLog.ps1 @@ -1,11 +1,20 @@ # Wrapper Script for ChangeLog Verification +# Parameter description +# ChangeLogLocation: Path to the changelog file +# VersionString: Version string to verify in the changelog +# PackageName: Name of the package +# ServiceDirectory: Service directory path +# ForRelease: Whether to verify for release (default: false) +# GroupId: Optional. The group ID for the package. Used for filtering packages in languages that support group identifiers (e.g., Java). + [CmdletBinding()] param ( [String]$ChangeLogLocation, [String]$VersionString, [string]$PackageName, [string]$ServiceDirectory, - [boolean]$ForRelease = $False + [boolean]$ForRelease = $False, + [String]$GroupId ) Set-StrictMode -Version 3 @@ -18,7 +27,7 @@ if ($ChangeLogLocation -and $VersionString) } else { - $PackageProp = Get-PkgProperties -PackageName $PackageName -ServiceDirectory $ServiceDirectory + $PackageProp = Get-PkgProperties -PackageName $PackageName -ServiceDirectory $ServiceDirectory -GroupId $GroupId $validChangeLog = Confirm-ChangeLogEntry -ChangeLogLocation $PackageProp.ChangeLogPath -VersionString $PackageProp.Version -ForRelease $ForRelease } From fbbeba27a1e6583d9353cbf9963b2033ea3c9989 Mon Sep 17 00:00:00 2001 From: ray chen Date: Wed, 26 Nov 2025 00:59:46 +0000 Subject: [PATCH 03/10] Added test --- eng/common/scripts/Helpers/Package-Helpers.ps1 | 4 ++-- eng/common/scripts/Package-Properties.ps1 | 12 +++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/eng/common/scripts/Helpers/Package-Helpers.ps1 b/eng/common/scripts/Helpers/Package-Helpers.ps1 index 37b4a4bfa932..f157d354a6b8 100644 --- a/eng/common/scripts/Helpers/Package-Helpers.ps1 +++ b/eng/common/scripts/Helpers/Package-Helpers.ps1 @@ -281,9 +281,9 @@ function Get-FullPackageName { $groupId = $PackageInfo.Group if ($groupId) { if ($UseColonSeparator) { - return "${groupId}:$($PackageInfo.ArtifactName)" + return "${groupId}:$($PackageInfo.Name)" } - return "${groupId}+$($PackageInfo.ArtifactName)" + return "${groupId}+$($PackageInfo.Name)" } } return $PackageInfo.Name diff --git a/eng/common/scripts/Package-Properties.ps1 b/eng/common/scripts/Package-Properties.ps1 index ea4221fcd6b6..dcab4e7214ab 100644 --- a/eng/common/scripts/Package-Properties.ps1 +++ b/eng/common/scripts/Package-Properties.ps1 @@ -241,6 +241,8 @@ function Get-PkgProperties { [string]$GroupId ) + Write-Host "Get-PkgProperties called with PackageName: [$PackageName], ServiceDirectory: [$ServiceDirectory], GroupId: [$GroupId]" + $allPkgProps = Get-AllPkgProperties -ServiceDirectory $ServiceDirectory if ([string]::IsNullOrEmpty($GroupId)) { @@ -249,8 +251,7 @@ function Get-PkgProperties { else { $pkgProps = $allPkgProps.Where({ ($_.Name -eq $PackageName -or $_.ArtifactName -eq $PackageName) -and - $_.PSObject.Properties.Name -contains "Group" -and - $_.Group -eq $GroupId + ($_.PSObject.Properties.Name -contains "Group" -and $_.Group -eq $GroupId) }); } @@ -261,7 +262,12 @@ function Get-PkgProperties { return $pkgProps[0] } - LogError "Failed to retrieve Properties for [$PackageName]" + if ([string]::IsNullOrEmpty($GroupId)) { + LogError "Failed to retrieve Properties for [$PackageName]" + } + else { + LogError "Failed to retrieve Properties for [$PackageName] with GroupId [$GroupId]. Ensure the package has a Group property matching the specified GroupId." + } return $null } From e3dbc74c5f57b403f5fc1a67dd5ca9ae43df9864 Mon Sep 17 00:00:00 2001 From: ray chen Date: Wed, 26 Nov 2025 17:55:32 +0000 Subject: [PATCH 04/10] Pass in package info file path --- .../templates/steps/verify-changelog.yml | 4 ++-- .../scripts/Helpers/Package-Helpers.ps1 | 22 +------------------ eng/common/scripts/Package-Properties.ps1 | 22 +++++++++++++++++++ eng/common/scripts/Verify-ChangeLog.ps1 | 11 +++++++++- 4 files changed, 35 insertions(+), 24 deletions(-) diff --git a/eng/common/pipelines/templates/steps/verify-changelog.yml b/eng/common/pipelines/templates/steps/verify-changelog.yml index b1e34c662e1b..4c4fefbdadbe 100644 --- a/eng/common/pipelines/templates/steps/verify-changelog.yml +++ b/eng/common/pipelines/templates/steps/verify-changelog.yml @@ -14,7 +14,7 @@ parameters: - name: Condition type: string default: succeeded() -- name: GroupId +- name: PackageInfoFilePath type: string default: '' @@ -26,7 +26,7 @@ steps: -PackageName '${{ parameters.PackageName }}' -ServiceDirectory '${{ coalesce(parameters.ServiceDirectory, parameters.ServiceName) }}' -ForRelease $${{ parameters.ForRelease }} - -GroupId '${{ parameters.GroupId }}' + -PackageInfoFilePath '${{ parameters.PackageInfoFilePath }}' pwsh: true workingDirectory: $(Pipeline.Workspace) displayName: Verify ChangeLogEntry for ${{ parameters.PackageName }} diff --git a/eng/common/scripts/Helpers/Package-Helpers.ps1 b/eng/common/scripts/Helpers/Package-Helpers.ps1 index f157d354a6b8..dc77d24922a7 100644 --- a/eng/common/scripts/Helpers/Package-Helpers.ps1 +++ b/eng/common/scripts/Helpers/Package-Helpers.ps1 @@ -267,24 +267,4 @@ 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 -# If UseColonSeparator switch is enabled, returns Group:ArtifactName format (colon separator) -function Get-FullPackageName { - param ( - [Parameter(Mandatory=$true)] - [PSCustomObject]$PackageInfo, - [switch]$UseColonSeparator - ) - - if ($PackageInfo.PSObject.Members.Name -contains "Group") { - $groupId = $PackageInfo.Group - if ($groupId) { - if ($UseColonSeparator) { - return "${groupId}:$($PackageInfo.Name)" - } - return "${groupId}+$($PackageInfo.Name)" - } - } - return $PackageInfo.Name -} + diff --git a/eng/common/scripts/Package-Properties.ps1 b/eng/common/scripts/Package-Properties.ps1 index dcab4e7214ab..7704bd04cea2 100644 --- a/eng/common/scripts/Package-Properties.ps1 +++ b/eng/common/scripts/Package-Properties.ps1 @@ -587,3 +587,25 @@ function Get-PkgPropsForEntireService ($serviceDirectoryPath) { return $projectProps } + +# Get the full package name based on packageInfo properties +# Returns Group+ArtifactName if Group exists and has a value, otherwise returns Name +# If UseColonSeparator switch is enabled, returns Group:ArtifactName format (colon separator) +function Get-FullPackageName { + param ( + [Parameter(Mandatory=$true)] + [PSCustomObject]$PackageInfo, + [switch]$UseColonSeparator + ) + + if ($PackageInfo.PSObject.Members.Name -contains "Group") { + $groupId = $PackageInfo.Group + if ($groupId) { + if ($UseColonSeparator) { + return "${groupId}:$($PackageInfo.Name)" + } + return "${groupId}+$($PackageInfo.Name)" + } + } + return $PackageInfo.Name +} diff --git a/eng/common/scripts/Verify-ChangeLog.ps1 b/eng/common/scripts/Verify-ChangeLog.ps1 index f8f9870eb222..e657b531e861 100644 --- a/eng/common/scripts/Verify-ChangeLog.ps1 +++ b/eng/common/scripts/Verify-ChangeLog.ps1 @@ -14,7 +14,7 @@ param ( [string]$PackageName, [string]$ServiceDirectory, [boolean]$ForRelease = $False, - [String]$GroupId + [String]$PackageInfoFilePath ) Set-StrictMode -Version 3 @@ -27,6 +27,15 @@ if ($ChangeLogLocation -and $VersionString) } else { + # Load package info to extract GroupId if available + $GroupId = $null + if ($PackageInfoFilePath -and (Test-Path $PackageInfoFilePath)) { + $packageInfoJson = Get-Content $PackageInfoFilePath | ConvertFrom-Json + if ($packageInfoJson.PSObject.Properties.Name -contains "Group") { + $GroupId = $packageInfoJson.Group + } + } + $PackageProp = Get-PkgProperties -PackageName $PackageName -ServiceDirectory $ServiceDirectory -GroupId $GroupId $validChangeLog = Confirm-ChangeLogEntry -ChangeLogLocation $PackageProp.ChangeLogPath -VersionString $PackageProp.Version -ForRelease $ForRelease } From b3bfb9d602ba35c2ad1f68efbb7c81afe004d825 Mon Sep 17 00:00:00 2001 From: ray chen Date: Mon, 1 Dec 2025 18:31:32 +0000 Subject: [PATCH 05/10] Reverted changes to verify-changelog.yml and script --- .../templates/steps/verify-changelog.yml | 4 ---- .../scripts/Helpers/Package-Helpers.ps1 | 2 -- eng/common/scripts/Verify-ChangeLog.ps1 | 22 ++----------------- 3 files changed, 2 insertions(+), 26 deletions(-) diff --git a/eng/common/pipelines/templates/steps/verify-changelog.yml b/eng/common/pipelines/templates/steps/verify-changelog.yml index 4c4fefbdadbe..113e0a5e695a 100644 --- a/eng/common/pipelines/templates/steps/verify-changelog.yml +++ b/eng/common/pipelines/templates/steps/verify-changelog.yml @@ -14,9 +14,6 @@ parameters: - name: Condition type: string default: succeeded() -- name: PackageInfoFilePath - type: string - default: '' steps: - task: Powershell@2 @@ -26,7 +23,6 @@ steps: -PackageName '${{ parameters.PackageName }}' -ServiceDirectory '${{ coalesce(parameters.ServiceDirectory, parameters.ServiceName) }}' -ForRelease $${{ parameters.ForRelease }} - -PackageInfoFilePath '${{ parameters.PackageInfoFilePath }}' pwsh: true workingDirectory: $(Pipeline.Workspace) displayName: Verify ChangeLogEntry for ${{ parameters.PackageName }} diff --git a/eng/common/scripts/Helpers/Package-Helpers.ps1 b/eng/common/scripts/Helpers/Package-Helpers.ps1 index dc77d24922a7..084bc34ab529 100644 --- a/eng/common/scripts/Helpers/Package-Helpers.ps1 +++ b/eng/common/scripts/Helpers/Package-Helpers.ps1 @@ -266,5 +266,3 @@ function Split-ArrayIntoBatches { return , $batches } - - diff --git a/eng/common/scripts/Verify-ChangeLog.ps1 b/eng/common/scripts/Verify-ChangeLog.ps1 index e657b531e861..611f4c737541 100644 --- a/eng/common/scripts/Verify-ChangeLog.ps1 +++ b/eng/common/scripts/Verify-ChangeLog.ps1 @@ -1,20 +1,11 @@ # Wrapper Script for ChangeLog Verification -# Parameter description -# ChangeLogLocation: Path to the changelog file -# VersionString: Version string to verify in the changelog -# PackageName: Name of the package -# ServiceDirectory: Service directory path -# ForRelease: Whether to verify for release (default: false) -# GroupId: Optional. The group ID for the package. Used for filtering packages in languages that support group identifiers (e.g., Java). - [CmdletBinding()] param ( [String]$ChangeLogLocation, [String]$VersionString, [string]$PackageName, [string]$ServiceDirectory, - [boolean]$ForRelease = $False, - [String]$PackageInfoFilePath + [boolean]$ForRelease = $False ) Set-StrictMode -Version 3 @@ -27,16 +18,7 @@ if ($ChangeLogLocation -and $VersionString) } else { - # Load package info to extract GroupId if available - $GroupId = $null - if ($PackageInfoFilePath -and (Test-Path $PackageInfoFilePath)) { - $packageInfoJson = Get-Content $PackageInfoFilePath | ConvertFrom-Json - if ($packageInfoJson.PSObject.Properties.Name -contains "Group") { - $GroupId = $packageInfoJson.Group - } - } - - $PackageProp = Get-PkgProperties -PackageName $PackageName -ServiceDirectory $ServiceDirectory -GroupId $GroupId + $PackageProp = Get-PkgProperties -PackageName $PackageName -ServiceDirectory $ServiceDirectory $validChangeLog = Confirm-ChangeLogEntry -ChangeLogLocation $PackageProp.ChangeLogPath -VersionString $PackageProp.Version -ForRelease $ForRelease } From e41b1b15ddbe50559f0917b51e74899a53aae4fc Mon Sep 17 00:00:00 2001 From: ray chen Date: Fri, 5 Dec 2025 19:43:48 +0000 Subject: [PATCH 06/10] Updated script to process groupId in work items --- .../Helpers/DevOps-WorkItem-Helpers.ps1 | 37 ++++++++++++++----- eng/common/scripts/Prepare-Release.ps1 | 5 +-- eng/common/scripts/Validate-All-Packages.ps1 | 24 ++++++------ 3 files changed, 41 insertions(+), 25 deletions(-) diff --git a/eng/common/scripts/Helpers/DevOps-WorkItem-Helpers.ps1 b/eng/common/scripts/Helpers/DevOps-WorkItem-Helpers.ps1 index 2e7521fb8b93..07a433e46f84 100644 --- a/eng/common/scripts/Helpers/DevOps-WorkItem-Helpers.ps1 +++ b/eng/common/scripts/Helpers/DevOps-WorkItem-Helpers.ps1 @@ -215,16 +215,17 @@ function FindParentWorkItem($serviceName, $packageDisplayName, $outputCommand = $packageWorkItems = @{} $packageWorkItemWithoutKeyFields = @{} -function FindLatestPackageWorkItem($lang, $packageName, $outputCommand = $true, $ignoreReleasePlannerTests = $true, $tag = $null) +function FindLatestPackageWorkItem($lang, $packageName, $groupId = $null, $outputCommand = $true, $ignoreReleasePlannerTests = $true, $tag = $null) { # Cache all the versions of this package and language work items - $null = FindPackageWorkItem $lang $packageName -includeClosed $true -outputCommand $outputCommand -ignoreReleasePlannerTests $ignoreReleasePlannerTests -tag $tag + $null = FindPackageWorkItem $lang $packageName -includeClosed $true -outputCommand $outputCommand -ignoreReleasePlannerTests $ignoreReleasePlannerTests -tag $tag -groupId $groupId $latestWI = $null foreach ($wi in $packageWorkItems.Values) { if ($wi.fields["Custom.Language"] -ne $lang) { continue } if ($wi.fields["Custom.Package"] -ne $packageName) { continue } + if ($groupId -and $wi.fields["Custom.Group"] -ne $groupId) { continue } if (!$latestWI) { $latestWI = $wi @@ -238,9 +239,13 @@ function FindLatestPackageWorkItem($lang, $packageName, $outputCommand = $true, return $latestWI } -function FindPackageWorkItem($lang, $packageName, $version, $outputCommand = $true, $includeClosed = $false, $ignoreReleasePlannerTests = $true, $tag = $null) +function FindPackageWorkItem($lang, $packageName, $version, $groupId = $null, $outputCommand = $true, $includeClosed = $false, $ignoreReleasePlannerTests = $true, $tag = $null) { - $key = BuildHashKeyNoNull $lang $packageName $version + $keyArgs = @($lang, $packageName, $version) + if (![string]::IsNullOrWhiteSpace($groupId)) { + $keyArgs += $groupId + } + $key = BuildHashKeyNoNull @keyArgs if ($key -and $packageWorkItems.ContainsKey($key)) { return $packageWorkItems[$key] } @@ -253,6 +258,7 @@ function FindPackageWorkItem($lang, $packageName, $version, $outputCommand = $tr $fields += "System.Tags" $fields += "Custom.Language" $fields += "Custom.Package" + $fields += "Custom.Group" $fields += "Custom.PackageDisplayName" $fields += "System.Title" $fields += "Custom.PackageType" @@ -282,6 +288,9 @@ function FindPackageWorkItem($lang, $packageName, $version, $outputCommand = $tr if ($packageName) { $query += " AND [Package] = '${packageName}'" } + if ($groupId) { + $query += " AND [Group] = '${groupId}'" + } if ($version) { $query += " AND [PackageVersionMajorMinor] = '${version}'" } @@ -295,7 +304,11 @@ function FindPackageWorkItem($lang, $packageName, $version, $outputCommand = $tr foreach ($wi in $workItems) { - $localKey = BuildHashKeyNoNull $wi.fields["Custom.Language"] $wi.fields["Custom.Package"] $wi.fields["Custom.PackageVersionMajorMinor"] + $localKeyArgs = @($wi.fields["Custom.Language"], $wi.fields["Custom.Package"], $wi.fields["Custom.PackageVersionMajorMinor"]) + if (![string]::IsNullOrWhiteSpace($wi.fields["Custom.Group"])) { + $localKeyArgs += $wi.fields["Custom.Group"] + } + $localKey = BuildHashKeyNoNull @localKeyArgs if (!$localKey) { $packageWorkItemWithoutKeyFields[$wi.id] = $wi Write-Host "Skipping package [$($wi.id)]$($wi.fields['System.Title']) which is missing required fields language, package, or version." @@ -461,10 +474,10 @@ function UpdatePackageWorkItemReleaseState($id, $state, $releaseType, $outputCom function FindOrCreateClonePackageWorkItem($lang, $pkg, $verMajorMinor, $allowPrompt = $false, $outputCommand = $false, $relatedId = $null, $tag= $null, $ignoreReleasePlannerTests = $true) { - $workItem = FindPackageWorkItem -lang $lang -packageName $pkg.Package -version $verMajorMinor -includeClosed $true -outputCommand $outputCommand -tag $tag -ignoreReleasePlannerTests $ignoreReleasePlannerTests + $workItem = FindPackageWorkItem -lang $lang -packageName $pkg.Package -version $verMajorMinor -includeClosed $true -outputCommand $outputCommand -tag $tag -ignoreReleasePlannerTests $ignoreReleasePlannerTests -groupId $pkg.Group if (!$workItem) { - $latestVersionItem = FindLatestPackageWorkItem -lang $lang -packageName $pkg.Package -outputCommand $outputCommand -tag $tag -ignoreReleasePlannerTests $ignoreReleasePlannerTests + $latestVersionItem = FindLatestPackageWorkItem -lang $lang -packageName $pkg.Package -outputCommand $outputCommand -tag $tag -ignoreReleasePlannerTests $ignoreReleasePlannerTests -groupId $pkg.Group $assignedTo = "me" $extraFields = @() if ($latestVersionItem) { @@ -513,6 +526,7 @@ function CreateOrUpdatePackageWorkItem($lang, $pkg, $verMajorMinor, $existingIte return } $pkgName = $pkg.Package + $pkgGroupId = if ($pkg.PSObject.Properties.Name -contains "GroupId") { $pkg.GroupId } else { $pkg.Group } $pkgDisplayName = $pkg.DisplayName $pkgType = $pkg.Type $pkgNewLibrary = $pkg.New @@ -523,6 +537,7 @@ function CreateOrUpdatePackageWorkItem($lang, $pkg, $verMajorMinor, $existingIte $fields = @() $fields += "`"Language=${lang}`"" $fields += "`"Package=${pkgName}`"" + $fields += "`"Group=${pkgGroupId}`"" $fields += "`"PackageDisplayName=${pkgDisplayName}`"" $fields += "`"PackageType=${pkgType}`"" $fields += "`"PackageTypeNewLibrary=${pkgNewLibrary}`"" @@ -540,6 +555,7 @@ function CreateOrUpdatePackageWorkItem($lang, $pkg, $verMajorMinor, $existingIte if ($lang -ne $existingItem.fields["Custom.Language"]) { $changedField = "Custom.Language" } if ($pkgName -ne $existingItem.fields["Custom.Package"]) { $changedField = "Custom.Package" } + if ($pkgGroupId -ne $existingItem.fields["Custom.Group"]) { $changedField = "Custom.Group" } if ($verMajorMinor -ne $existingItem.fields["Custom.PackageVersionMajorMinor"]) { $changedField = "Custom.PackageVersionMajorMinor" } if ($pkgDisplayName -ne $existingItem.fields["Custom.PackageDisplayName"]) { $changedField = "Custom.PackageDisplayName" } if ($pkgType -ne [string]$existingItem.fields["Custom.PackageType"]) { $changedField = "Custom.PackageType" } @@ -1029,15 +1045,16 @@ function UpdatePackageVersions($pkgWorkItem, $plannedVersions, $shippedVersions) function UpdateValidationStatus($pkgvalidationDetails, $BuildDefinition, $PipelineUrl) { $pkgName = $pkgValidationDetails.Name + $groupId = $pkgValidationDetails.Group $versionString = $pkgValidationDetails.Version $parsedNewVersion = [AzureEngSemanticVersion]::new($versionString) $versionMajorMinor = "" + $parsedNewVersion.Major + "." + $parsedNewVersion.Minor - $workItem = FindPackageWorkItem -lang $LanguageDisplayName -packageName $pkgName -version $versionMajorMinor -includeClosed $true -outputCommand $false + $workItem = FindPackageWorkItem -lang $LanguageDisplayName -packageName $pkgName -groupId $groupId -version $versionMajorMinor -includeClosed $true -outputCommand $false if (!$workItem) { - Write-Host"No work item found for package [$pkgName]." + Write-Host "No work item found for package [$pkgName] with groupId [$groupId]." return $false } @@ -1250,6 +1267,7 @@ function Update-DevOpsReleaseWorkItem { [Parameter(Mandatory=$true)] [string]$version, [string]$plannedDate, + [string]$groupId = $null, [string]$serviceName = $null, [string]$packageDisplayName = $null, [string]$packageRepoPath = "NA", @@ -1277,6 +1295,7 @@ function Update-DevOpsReleaseWorkItem { $packageInfo = [PSCustomObject][ordered]@{ Package = $packageName + Group = $groupId DisplayName = $packageDisplayName ServiceName = $serviceName RepoPath = $packageRepoPath diff --git a/eng/common/scripts/Prepare-Release.ps1 b/eng/common/scripts/Prepare-Release.ps1 index 97c0ecf94858..6d57acf6d601 100755 --- a/eng/common/scripts/Prepare-Release.ps1 +++ b/eng/common/scripts/Prepare-Release.ps1 @@ -158,10 +158,9 @@ if ($null -eq $newVersionParsed) exit 1 } -$fullPackageName = Get-FullPackageName -PackageInfo $packageProperties - $result = Update-DevOpsReleaseWorkItem -language $LanguageDisplayName ` - -packageName $fullPackageName ` + -packageName $packageProperties.Name ` + -groupId $packageProperties.Group ` -version $newVersion ` -plannedDate $releaseDateString ` -packageRepoPath $packageProperties.serviceDirectory ` diff --git a/eng/common/scripts/Validate-All-Packages.ps1 b/eng/common/scripts/Validate-All-Packages.ps1 index d888a773c24f..84a59df66211 100644 --- a/eng/common/scripts/Validate-All-Packages.ps1 +++ b/eng/common/scripts/Validate-All-Packages.ps1 @@ -111,13 +111,13 @@ function VerifyAPIReview($packageName, $packageVersion, $language) } -function IsVersionShipped($packageName, $packageVersion) +function IsVersionShipped($packageName, $packageVersion, $groupId = $null) { # This function will decide if a package version is already shipped or not Write-Host "Checking if a version is already shipped for package $packageName with version $packageVersion." $parsedNewVersion = [AzureEngSemanticVersion]::new($packageVersion) $versionMajorMinor = "" + $parsedNewVersion.Major + "." + $parsedNewVersion.Minor - $workItem = FindPackageWorkItem -lang $LanguageDisplayName -packageName $packageName -version $versionMajorMinor -includeClosed $true -outputCommand $false + $workItem = FindPackageWorkItem -lang $LanguageDisplayName -packageName $packageName -groupId $groupId -version $versionMajorMinor -includeClosed $true -outputCommand $false if ($workItem) { # Check if the package version is already shipped @@ -127,7 +127,7 @@ function IsVersionShipped($packageName, $packageVersion) } } else { - Write-Host "No work item found for package [$packageName]. Creating new work item for package." + Write-Host "No work item found for package [$packageName], group [$groupId]. Creating new work item for package." } return $false } @@ -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,8 @@ function CreateUpdatePackageWorkItem($pkgInfo) # Create or update package work item $result = Update-DevOpsReleaseWorkItem -language $LanguageDisplayName ` - -packageName $fullPkgNameInRemoteFeed ` + -packageName $packageName ` + -groupId $pkgInfo.Group ` -version $versionString ` -plannedDate $plannedDate ` -packageRepoPath $pkgInfo.serviceDirectory ` @@ -175,19 +176,14 @@ function ProcessPackage($packageInfo) $pkgName = $packageInfo.Name $changeLogPath = $packageInfo.ChangeLogPath $versionString = $packageInfo.Version - Write-Host "Checking if we need to create or update work item for package $pkgName with version $versionString." - - # If there's a groupId that means this is Java and pkgName = GroupId+ArtifactName + Write-Host "Checking if we need to create or update work item for package $pkgName and groupId $packageInfo.Group with version $versionString." Write-Host "Package name before checking groupId: $pkgName" - $fullPkgNameInRemoteFeed = Get-FullPackageName -PackageInfo $packageInfo - $isShipped = IsVersionShipped $fullPkgNameInRemoteFeed $versionString + $isShipped = IsVersionShipped $pkgName $versionString $packageInfo.Group 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 $fullPkgNameInRemoteFeed with version $versionString." - # Change log validation $changeLogStatus = [PSCustomObject]@{ Name = "Change Log Validation" @@ -207,8 +203,10 @@ function ProcessPackage($packageInfo) Write-Host "Checking API review status for package $fullPackageName" $apireviewDetails = VerifyAPIReview $fullPackageName $packageInfo.Version $Language + # The following object will be used to update package work item, the name should be package name only without groupId $pkgValidationDetails= [PSCustomObject]@{ - Name = $fullPkgNameInRemoteFeed + Name = $pkgName + Group = $packageInfo.Group Version = $packageInfo.Version ChangeLogValidation = $changeLogStatus APIReviewValidation = $apireviewDetails.ApiviewApproval From 23864ee69994c798c2e5c518bcb50aea2472db6b Mon Sep 17 00:00:00 2001 From: ray chen Date: Fri, 5 Dec 2025 20:30:38 +0000 Subject: [PATCH 07/10] Renamed new property to GroupId --- .../Helpers/DevOps-WorkItem-Helpers.ps1 | 32 ++++++++++++------- eng/common/scripts/Validate-All-Packages.ps1 | 2 +- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/eng/common/scripts/Helpers/DevOps-WorkItem-Helpers.ps1 b/eng/common/scripts/Helpers/DevOps-WorkItem-Helpers.ps1 index 07a433e46f84..31193b864da3 100644 --- a/eng/common/scripts/Helpers/DevOps-WorkItem-Helpers.ps1 +++ b/eng/common/scripts/Helpers/DevOps-WorkItem-Helpers.ps1 @@ -225,7 +225,7 @@ function FindLatestPackageWorkItem($lang, $packageName, $groupId = $null, $outpu { if ($wi.fields["Custom.Language"] -ne $lang) { continue } if ($wi.fields["Custom.Package"] -ne $packageName) { continue } - if ($groupId -and $wi.fields["Custom.Group"] -ne $groupId) { continue } + if ($groupId -and $wi.fields["Custom.GroupId"] -ne $groupId) { continue } if (!$latestWI) { $latestWI = $wi @@ -258,7 +258,7 @@ function FindPackageWorkItem($lang, $packageName, $version, $groupId = $null, $o $fields += "System.Tags" $fields += "Custom.Language" $fields += "Custom.Package" - $fields += "Custom.Group" + $fields += "Custom.GroupId" $fields += "Custom.PackageDisplayName" $fields += "System.Title" $fields += "Custom.PackageType" @@ -289,7 +289,7 @@ function FindPackageWorkItem($lang, $packageName, $version, $groupId = $null, $o $query += " AND [Package] = '${packageName}'" } if ($groupId) { - $query += " AND [Group] = '${groupId}'" + $query += " AND [GroupId] = '${groupId}'" } if ($version) { $query += " AND [PackageVersionMajorMinor] = '${version}'" @@ -305,8 +305,8 @@ function FindPackageWorkItem($lang, $packageName, $version, $groupId = $null, $o foreach ($wi in $workItems) { $localKeyArgs = @($wi.fields["Custom.Language"], $wi.fields["Custom.Package"], $wi.fields["Custom.PackageVersionMajorMinor"]) - if (![string]::IsNullOrWhiteSpace($wi.fields["Custom.Group"])) { - $localKeyArgs += $wi.fields["Custom.Group"] + if (![string]::IsNullOrWhiteSpace($wi.fields["Custom.GroupId"])) { + $localKeyArgs += $wi.fields["Custom.GroupId"] } $localKey = BuildHashKeyNoNull @localKeyArgs if (!$localKey) { @@ -474,10 +474,10 @@ function UpdatePackageWorkItemReleaseState($id, $state, $releaseType, $outputCom function FindOrCreateClonePackageWorkItem($lang, $pkg, $verMajorMinor, $allowPrompt = $false, $outputCommand = $false, $relatedId = $null, $tag= $null, $ignoreReleasePlannerTests = $true) { - $workItem = FindPackageWorkItem -lang $lang -packageName $pkg.Package -version $verMajorMinor -includeClosed $true -outputCommand $outputCommand -tag $tag -ignoreReleasePlannerTests $ignoreReleasePlannerTests -groupId $pkg.Group + $workItem = FindPackageWorkItem -lang $lang -packageName $pkg.Package -version $verMajorMinor -includeClosed $true -outputCommand $outputCommand -tag $tag -ignoreReleasePlannerTests $ignoreReleasePlannerTests -groupId $pkg.GroupId if (!$workItem) { - $latestVersionItem = FindLatestPackageWorkItem -lang $lang -packageName $pkg.Package -outputCommand $outputCommand -tag $tag -ignoreReleasePlannerTests $ignoreReleasePlannerTests -groupId $pkg.Group + $latestVersionItem = FindLatestPackageWorkItem -lang $lang -packageName $pkg.Package -outputCommand $outputCommand -tag $tag -ignoreReleasePlannerTests $ignoreReleasePlannerTests -groupId $pkg.GroupId $assignedTo = "me" $extraFields = @() if ($latestVersionItem) { @@ -525,8 +525,16 @@ function CreateOrUpdatePackageWorkItem($lang, $pkg, $verMajorMinor, $existingIte Write-Host "Cannot create or update because one of lang, pkg or verMajorMinor aren't set. [$lang|$($pkg.Package)|$verMajorMinor]" return } + + # PackageProp object uses Group, while other places use GroupId, such as in work item fields and package csv files. + $pkgGroupId = if ($pkg.PSObject.Properties.Name -contains "GroupId") { + $pkg.GroupId + } elseif ($pkg.PSObject.Properties.Name -contains "Group") { + $pkg.Group + } else { + $null + } $pkgName = $pkg.Package - $pkgGroupId = if ($pkg.PSObject.Properties.Name -contains "GroupId") { $pkg.GroupId } else { $pkg.Group } $pkgDisplayName = $pkg.DisplayName $pkgType = $pkg.Type $pkgNewLibrary = $pkg.New @@ -537,7 +545,7 @@ function CreateOrUpdatePackageWorkItem($lang, $pkg, $verMajorMinor, $existingIte $fields = @() $fields += "`"Language=${lang}`"" $fields += "`"Package=${pkgName}`"" - $fields += "`"Group=${pkgGroupId}`"" + $fields += "`"GroupId=${pkgGroupId}`"" $fields += "`"PackageDisplayName=${pkgDisplayName}`"" $fields += "`"PackageType=${pkgType}`"" $fields += "`"PackageTypeNewLibrary=${pkgNewLibrary}`"" @@ -555,7 +563,7 @@ function CreateOrUpdatePackageWorkItem($lang, $pkg, $verMajorMinor, $existingIte if ($lang -ne $existingItem.fields["Custom.Language"]) { $changedField = "Custom.Language" } if ($pkgName -ne $existingItem.fields["Custom.Package"]) { $changedField = "Custom.Package" } - if ($pkgGroupId -ne $existingItem.fields["Custom.Group"]) { $changedField = "Custom.Group" } + if ($pkgGroupId -ne $existingItem.fields["Custom.GroupId"]) { $changedField = "Custom.GroupId" } if ($verMajorMinor -ne $existingItem.fields["Custom.PackageVersionMajorMinor"]) { $changedField = "Custom.PackageVersionMajorMinor" } if ($pkgDisplayName -ne $existingItem.fields["Custom.PackageDisplayName"]) { $changedField = "Custom.PackageDisplayName" } if ($pkgType -ne [string]$existingItem.fields["Custom.PackageType"]) { $changedField = "Custom.PackageType" } @@ -1045,7 +1053,7 @@ function UpdatePackageVersions($pkgWorkItem, $plannedVersions, $shippedVersions) function UpdateValidationStatus($pkgvalidationDetails, $BuildDefinition, $PipelineUrl) { $pkgName = $pkgValidationDetails.Name - $groupId = $pkgValidationDetails.Group + $groupId = $pkgValidationDetails.GroupId $versionString = $pkgValidationDetails.Version $parsedNewVersion = [AzureEngSemanticVersion]::new($versionString) @@ -1295,7 +1303,7 @@ function Update-DevOpsReleaseWorkItem { $packageInfo = [PSCustomObject][ordered]@{ Package = $packageName - Group = $groupId + GroupId = $groupId DisplayName = $packageDisplayName ServiceName = $serviceName RepoPath = $packageRepoPath diff --git a/eng/common/scripts/Validate-All-Packages.ps1 b/eng/common/scripts/Validate-All-Packages.ps1 index 84a59df66211..b92e912601b0 100644 --- a/eng/common/scripts/Validate-All-Packages.ps1 +++ b/eng/common/scripts/Validate-All-Packages.ps1 @@ -206,7 +206,7 @@ function ProcessPackage($packageInfo) # The following object will be used to update package work item, the name should be package name only without groupId $pkgValidationDetails= [PSCustomObject]@{ Name = $pkgName - Group = $packageInfo.Group + GroupId = $packageInfo.Group Version = $packageInfo.Version ChangeLogValidation = $changeLogStatus APIReviewValidation = $apireviewDetails.ApiviewApproval From 7ba74599e8b880da4edfd1d102254f1f16b1344e Mon Sep 17 00:00:00 2001 From: ray chen Date: Fri, 5 Dec 2025 23:07:59 +0000 Subject: [PATCH 08/10] Removed the condition check for Group --- eng/common/scripts/Helpers/DevOps-WorkItem-Helpers.ps1 | 2 -- 1 file changed, 2 deletions(-) diff --git a/eng/common/scripts/Helpers/DevOps-WorkItem-Helpers.ps1 b/eng/common/scripts/Helpers/DevOps-WorkItem-Helpers.ps1 index 31193b864da3..c1dce9a3776f 100644 --- a/eng/common/scripts/Helpers/DevOps-WorkItem-Helpers.ps1 +++ b/eng/common/scripts/Helpers/DevOps-WorkItem-Helpers.ps1 @@ -529,8 +529,6 @@ function CreateOrUpdatePackageWorkItem($lang, $pkg, $verMajorMinor, $existingIte # PackageProp object uses Group, while other places use GroupId, such as in work item fields and package csv files. $pkgGroupId = if ($pkg.PSObject.Properties.Name -contains "GroupId") { $pkg.GroupId - } elseif ($pkg.PSObject.Properties.Name -contains "Group") { - $pkg.Group } else { $null } From b4376b4f69e60650a96d751ca72fa46428392942 Mon Sep 17 00:00:00 2001 From: ray chen Date: Sat, 6 Dec 2025 00:51:13 +0000 Subject: [PATCH 09/10] Build hash key with non-null arguments --- .../Helpers/DevOps-WorkItem-Helpers.ps1 | 20 ++++++------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/eng/common/scripts/Helpers/DevOps-WorkItem-Helpers.ps1 b/eng/common/scripts/Helpers/DevOps-WorkItem-Helpers.ps1 index c1dce9a3776f..257bb43fde69 100644 --- a/eng/common/scripts/Helpers/DevOps-WorkItem-Helpers.ps1 +++ b/eng/common/scripts/Helpers/DevOps-WorkItem-Helpers.ps1 @@ -139,14 +139,14 @@ function Invoke-Query($fields, $wiql, $output = $true) return $workItems } -function BuildHashKeyNoNull() +function BuildHashKeyFromNonNullArgs() { $filterNulls = $args | Where-Object { $_ } - # if we had any nulls then return null - if (!$filterNulls -or $args.Count -ne $filterNulls.Count) { + # if we had any non-nulls then return it + if (!$filterNulls) { return $null } - return BuildHashKey $args + return BuildHashKey @filterNulls } function BuildHashKey() @@ -241,11 +241,7 @@ function FindLatestPackageWorkItem($lang, $packageName, $groupId = $null, $outpu function FindPackageWorkItem($lang, $packageName, $version, $groupId = $null, $outputCommand = $true, $includeClosed = $false, $ignoreReleasePlannerTests = $true, $tag = $null) { - $keyArgs = @($lang, $packageName, $version) - if (![string]::IsNullOrWhiteSpace($groupId)) { - $keyArgs += $groupId - } - $key = BuildHashKeyNoNull @keyArgs + $key = BuildHashKeyFromNonNullArgs $lang $packageName $version $groupId if ($key -and $packageWorkItems.ContainsKey($key)) { return $packageWorkItems[$key] } @@ -304,11 +300,7 @@ function FindPackageWorkItem($lang, $packageName, $version, $groupId = $null, $o foreach ($wi in $workItems) { - $localKeyArgs = @($wi.fields["Custom.Language"], $wi.fields["Custom.Package"], $wi.fields["Custom.PackageVersionMajorMinor"]) - if (![string]::IsNullOrWhiteSpace($wi.fields["Custom.GroupId"])) { - $localKeyArgs += $wi.fields["Custom.GroupId"] - } - $localKey = BuildHashKeyNoNull @localKeyArgs + $localKey = BuildHashKeyFromNonNullArgs $wi.fields["Custom.Language"] $wi.fields["Custom.Package"] $wi.fields["Custom.PackageVersionMajorMinor"] $wi.fields["Custom.GroupId"] if (!$localKey) { $packageWorkItemWithoutKeyFields[$wi.id] = $wi Write-Host "Skipping package [$($wi.id)]$($wi.fields['System.Title']) which is missing required fields language, package, or version." From 0ccb5904058d13d0d46639beecb95d2191b3154b Mon Sep 17 00:00:00 2001 From: ray chen Date: Mon, 8 Dec 2025 19:35:56 +0000 Subject: [PATCH 10/10] Used the original BuildHashKey to return hash from non-null args --- .../scripts/Helpers/DevOps-WorkItem-Helpers.ps1 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/common/scripts/Helpers/DevOps-WorkItem-Helpers.ps1 b/eng/common/scripts/Helpers/DevOps-WorkItem-Helpers.ps1 index 257bb43fde69..7ec0de578382 100644 --- a/eng/common/scripts/Helpers/DevOps-WorkItem-Helpers.ps1 +++ b/eng/common/scripts/Helpers/DevOps-WorkItem-Helpers.ps1 @@ -139,14 +139,14 @@ function Invoke-Query($fields, $wiql, $output = $true) return $workItems } -function BuildHashKeyFromNonNullArgs() +function BuildHashKeyNoNull() { $filterNulls = $args | Where-Object { $_ } - # if we had any non-nulls then return it - if (!$filterNulls) { + # if we had any nulls then return null + if (!$filterNulls -or $args.Count -ne $filterNulls.Count) { return $null } - return BuildHashKey @filterNulls + return BuildHashKey $args } function BuildHashKey() @@ -241,7 +241,7 @@ function FindLatestPackageWorkItem($lang, $packageName, $groupId = $null, $outpu function FindPackageWorkItem($lang, $packageName, $version, $groupId = $null, $outputCommand = $true, $includeClosed = $false, $ignoreReleasePlannerTests = $true, $tag = $null) { - $key = BuildHashKeyFromNonNullArgs $lang $packageName $version $groupId + $key = BuildHashKey $lang $packageName $version $groupId if ($key -and $packageWorkItems.ContainsKey($key)) { return $packageWorkItems[$key] } @@ -300,7 +300,7 @@ function FindPackageWorkItem($lang, $packageName, $version, $groupId = $null, $o foreach ($wi in $workItems) { - $localKey = BuildHashKeyFromNonNullArgs $wi.fields["Custom.Language"] $wi.fields["Custom.Package"] $wi.fields["Custom.PackageVersionMajorMinor"] $wi.fields["Custom.GroupId"] + $localKey = BuildHashKey $wi.fields["Custom.Language"] $wi.fields["Custom.Package"] $wi.fields["Custom.PackageVersionMajorMinor"] $wi.fields["Custom.GroupId"] if (!$localKey) { $packageWorkItemWithoutKeyFields[$wi.id] = $wi Write-Host "Skipping package [$($wi.id)]$($wi.fields['System.Title']) which is missing required fields language, package, or version."