Skip to content

Commit af4fa47

Browse files
XiaofeiCaoCopilot
andcommitted
Pass PatchVersionOverrides through auto-release pipeline path
The auto-release pipeline uses Generate-Patches-For-Automatic-Releases.ps1 → generatepatch.ps1 → GeneratePatch. This path was not passing PatchVersionOverrides, so sibling patch versions were invisible during changelog generation, resulting in 'Upgraded core dependencies.' instead of listing specific dependency changes. Fix: - generatepatch.ps1: accept -PatchVersionOverrides parameter - Generate-Patches-For-Automatic-Releases.ps1: build override map from YAML package list by querying Maven for each artifact's latest GA version and computing the next patch version Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent f4d20ee commit af4fa47

3 files changed

Lines changed: 24 additions & 3 deletions

File tree

eng/scripts/Generate-Patches-For-Automatic-Releases.ps1

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,25 @@ try {
5555
$packagesData = $ymlObject["extends"]["parameters"]["artifacts"]
5656
$libraryList = $null
5757

58+
# Build PatchVersionOverrides: map of artifactId → patch version for all artifacts
59+
# being patched. This is passed to generatepatch.ps1 so changelogs show the correct
60+
# version when a sibling dependency is also being patched in the same run.
61+
$PatchVersionOverrides = @{}
62+
foreach ($packageData in $packagesData) {
63+
$pkgArtifactId = $packageData["name"]
64+
$pkgGroupId = $packageData["groupId"]
65+
try {
66+
$mavenInfo = GetVersionInfoForAnArtifactId -GroupId $pkgGroupId -ArtifactId $pkgArtifactId
67+
$patchVersion = GetPatchVersion -ReleaseVersion $mavenInfo.LatestGAOrPatchVersion
68+
$PatchVersionOverrides[$pkgArtifactId] = $patchVersion
69+
} catch {
70+
Write-Warning "Could not determine patch version for ${pkgArtifactId}: $_"
71+
}
72+
}
73+
5874
# Reset each package to the latest stable release and update CHANGELOG, POM and README for patch release.
5975
foreach ($packageData in $packagesData) {
60-
. "${PSScriptRoot}/generatepatch.ps1" -ArtifactIds $packageData["name"] -ServiceDirectoryName $packageData["ServiceDirectory"] -BranchName $branchName -GroupId $packageData["groupId"] -UseCurrentBranch:$UseCurrentBranch
76+
. "${PSScriptRoot}/generatepatch.ps1" -ArtifactIds $packageData["name"] -ServiceDirectoryName $packageData["ServiceDirectory"] -BranchName $branchName -GroupId $packageData["groupId"] -UseCurrentBranch:$UseCurrentBranch -PatchVersionOverrides $PatchVersionOverrides
6177
$libraryList += $packageData["groupId"] + ":" + $packageData["name"] + ","
6278
}
6379

eng/scripts/bomhelpers.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,8 @@ function GetDependencyToVersion($PomFilePath) {
156156
}
157157

158158
# Resolve dependency versions for patch changelog generation.
159+
# Parses version_client.txt following the same format as utils.load_version_map_from_file
160+
# (eng/versioning/utils.py), extracting column 2 (CodeModule.dependency) per entry.
159161
# Uses a layered resolution strategy:
160162
# 1. PatchVersionOverrides (highest priority) — maps artifactId to the patch version
161163
# for sibling artifacts being patched in the same run.

eng/scripts/generatepatch.ps1

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@ param(
4646
[string]$BranchName,
4747
[string]$GroupId = 'com.azure',
4848
# When set, creates patch branches from the current branch instead of remote main.
49-
[switch]$UseCurrentBranch
49+
[switch]$UseCurrentBranch,
50+
# Optional map of artifactId → version for sibling artifacts being patched in the same run.
51+
# Passed to GeneratePatch so changelogs show the correct version for sibling dependencies.
52+
[hashtable]$PatchVersionOverrides = @{}
5053
)
5154

5255
$RepoRoot = Resolve-Path "${PSScriptRoot}..\..\.."
@@ -89,7 +92,7 @@ foreach ($artifactId in $ArtifactIds) {
8992
$patchInfo = [ArtifactPatchInfo]::new()
9093
$patchInfo.ArtifactId = $artifactId
9194
$patchInfo.ServiceDirectoryName = $ServiceDirectoryName
92-
GeneratePatch -PatchInfo $patchInfo -BranchName $BranchName -RemoteName $RemoteName -GroupId $GroupId -UseCurrentBranch $UseCurrentBranch
95+
GeneratePatch -PatchInfo $patchInfo -BranchName $BranchName -RemoteName $RemoteName -GroupId $GroupId -UseCurrentBranch $UseCurrentBranch -PatchVersionOverrides $PatchVersionOverrides
9396
#TriggerPipeline -PatchInfos $patchInfo -BranchName $BranchName
9497
}
9598

0 commit comments

Comments
 (0)