Pass in package info file path

This commit is contained in:
ray chen 2025-11-26 17:55:32 +00:00 committed by azure-sdk
parent 8ba2425b96
commit 5f2ab2f337
4 changed files with 35 additions and 24 deletions

View File

@ -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 }}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}