From 621e2a905cabae3c5aa3413cf1f543f2d090e502 Mon Sep 17 00:00:00 2001 From: ray chen Date: Wed, 26 Nov 2025 00:34:34 +0000 Subject: [PATCH] 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 113e0a5e6..b1e34c662 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 a61f37bbe..37b4a4bfa 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 930602444..ea4221fcd 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 415831e32..97c0ecf94 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 3541cd489..3059002f3 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 54304568b..d888a773c 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 611f4c737..f8f9870eb 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 }