Skip to content

Patch release script, fix and simplify dependency detection#48395

Open
XiaofeiCao wants to merge 9 commits intoAzure:mainfrom
XiaofeiCao:fix_arm_patch
Open

Patch release script, fix and simplify dependency detection#48395
XiaofeiCao wants to merge 9 commits intoAzure:mainfrom
XiaofeiCao:fix_arm_patch

Conversation

@XiaofeiCao
Copy link
Contributor

@XiaofeiCao XiaofeiCao commented Mar 12, 2026

Changes

1. Fix patch detection algorithm (existing commits)

Replaced CreateForwardLookingVersions + FindAllArtifactsThatNeedPatching with a single fixed-point loop. Fixes missing patch detection for artifacts whose dependencies have no sibling dependents in the patch list.

 # Changelog of azure-resourcemanager-containerinstance
-## 2.48.0-beta.1 (Unreleased)
-### Features Added
-### Breaking Changes
-### Bugs Fixed
-### Other Changes
+## 2.47.1 (2026-03-13)
+### Other Changes
+#### Dependency Updates
+- Upgraded `azure-storage-file-share` from `12.25.1` to version `12.25.2`.

2. Fix changelog showing beta versions (cd0d46b)

Added GetResolvedDependencyVersions with 3-tier resolution: PatchVersionOverrides > version_client.txt col 2 (GA) > pom.xml. Also fixed artifactId collision between com.azure and com.azure.v2.

 #### Dependency Updates
-- Upgraded `azure-storage-blob` from `12.33.2` to version `13.0.0-beta.1`.
+- Upgraded `azure-storage-blob` from `12.33.2` to version `12.33.3`.

3. Fix changelog showing generic message (f4d20ee)

patchreleases.ps1 now builds a PatchVersionOverrides map from ArtifactInfos and passes it through GeneratePatches so changelogs list specific dependency upgrades.

 #### Dependency Updates
-- Upgraded core dependencies.
+- Upgraded `azure-storage-blob` from `12.33.2` to version `12.33.3`.

4. Fix auto-release pipeline path (bbf62ee)

Generate-Patches-For-Automatic-Releases.ps1 now queries Maven for each artifact latest GA version, computes patch versions, and passes the override map through generatepatch.ps1. Without this fix, the auto-release pipeline still produced the generic message from #3.

Files Changed

  • eng/scripts/patchhelpers.ps1 — simplified FindArtifactsThatNeedPatching
  • eng/scripts/bomhelpers.ps1 — added GetResolvedDependencyVersions, updated GeneratePatch signatures
  • eng/scripts/patchreleases.ps1 — builds PatchVersionOverrides from ArtifactInfos
  • eng/scripts/Generate-Patch.ps1 — uses pom + prerelease-to-col2 fallback
  • eng/scripts/generatepatch.ps1 — accepts and passes PatchVersionOverrides
  • eng/scripts/Generate-Patches-For-Automatic-Releases.ps1 — builds override map from YAML
  • eng/scripts/tests/patchhelpers.tests.ps1 — 23 tests

XiaofeiCao and others added 3 commits March 12, 2026 10:50
Verifies that when an artifact is independently released to a newer GA
version, dependents are correctly flagged for patching. Without the
seeding loop (commit b3148a6), the forward-looking map would only
contain the old version from the dependent's POM, causing the mismatch
to go undetected.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…AllArtifactsThatNeedPatching

Replace the two-function dance (CreateForwardLookingVersions building a complex
version map from POM deps, then FindAllArtifactsThatNeedPatching comparing against
it) with a single FindArtifactsThatNeedPatching function that:

1. Seeds a version map directly from each artifact's LatestGAOrPatchVersion
2. Iterates in dependency order (guaranteed by patch_release_client.txt)
3. Only checks dependencies that are in the patch list (ignores external deps)

This also fixes a latent bug where external dependency version inconsistencies
(e.g., different reactor-core versions across artifacts) could trigger false
positive patch detections.

Deletes unused ArtifactsToPatchUtil which had bugs (undefined $depId variable,
infinite recursion passing wrong parameter).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@XiaofeiCao XiaofeiCao marked this pull request as ready for review March 12, 2026 07:52
Copilot AI review requested due to automatic review settings March 12, 2026 07:52
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Simplifies patch release dependency detection for Azure SDK for Java patch pipelines by replacing the previous multi-pass “highest version wins” dependency scan with a patch-list-scoped, seeded version map approach intended to correctly detect independent dependency releases and avoid false positives from external dependencies.

Changes:

  • Replaced CreateForwardLookingVersions + FindAllArtifactsThatNeedPatching with a single FindArtifactsThatNeedPatching implementation.
  • Updated patch release scripts to call the new function.
  • Added Pester unit tests covering patch detection scenarios and helper functions.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
eng/scripts/patchhelpers.ps1 Replaces the patch detection algorithm with a seeded, patch-list-only dependency check.
eng/scripts/patchreleases.ps1 Switches patch detection call site to the new function.
eng/scripts/Update-Artifacts-List-For-Patch-Release.ps1 Switches patch detection call site to the new function (and updates a related comment).
eng/scripts/tests/patchhelpers.tests.ps1 Adds new Pester tests for patch detection, patch version bumping, and topological sort behavior.

You can also share your feedback on Copilot code review. Take the survey.

All patch scripts hardcoded $remoteName/main as the base for creating
branches. This makes end-to-end local testing impossible without being
on main.

Add a -UseCurrentBranch switch that, when set, creates patch branches
from HEAD instead of $remoteName/main. Threaded through all entry
points and internal functions:

- Generate-Patches-For-Automatic-Releases.ps1
- Generate-Patch.ps1
- generatepatch.ps1
- patchreleases.ps1
- GeneratePatch() / GeneratePatches() in bomhelpers.ps1
- GenerateBOMFile() in patchhelpers.ps1

Production behavior is unchanged (default creates from main). For local
testing, add the switch:
  ./Generate-Patch.ps1 ... -UseCurrentBranch

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.


You can also share your feedback on Copilot code review. Take the survey.

Comment on lines 43 to 50
param(
[string[]]$ArtifactIds,
[string]$ServiceDirectoryName,
[string]$BranchName,
[string]$GroupId = 'com.azure'
[string]$GroupId = 'com.azure',
# When set, creates patch branches from the current branch instead of remote main.
[switch]$UseCurrentBranch
)
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment-based help lists parameters (ArtifactIds, ServiceDirectoryName, BranchName, GroupId, etc.), but the newly added -UseCurrentBranch switch isn’t included in the help text. Add a .PARAMETER entry (and example if appropriate) so the new behavior is discoverable.

Copilot uses AI. Check for mistakes.
Comment on lines +32 to 35
[Parameter(Mandatory=$false)][boolean]$CreateNewBranch = $true,
# When set, creates patch branches from the current branch instead of remote main.
[Parameter(Mandatory=$false)][switch]$UseCurrentBranch
)
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This script has a numbered list of supported arguments in the header comments, but the newly added -UseCurrentBranch parameter isn’t documented there. Please update the header argument list so users discover the new switch and understand when to use it.

Copilot uses AI. Check for mistakes.
The simplified single-pass algorithm assumed patch_release_client.txt was
ordered by dependency (dependencies before dependents). In reality it's
alphabetical. This caused dependents like azure-messaging-eventhubs-
checkpointstore-blob to be missed when they appeared before their
dependency (azure-storage-blob) in the iteration order.

Replace the single foreach with a do/while fixed-point loop that iterates
until no new patches are found, making the algorithm correct regardless of
artifact ordering.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
XiaofeiCao and others added 3 commits March 13, 2026 13:05
The changelog generation was reading dependency versions from the pom.xml
after update_versions.py ran, which writes beta/preview versions for
{x-version-update;...;current} markers. For patch releases, the changelog
should show GA/released versions (column 2 from version_client.txt).

Added GetResolvedDependencyVersions function that resolves dependency
versions from version_client.txt column 2 instead of the pom.xml. Applied
the fix to both GeneratePatch() in bomhelpers.ps1 and CreatePatchRelease()
in Generate-Patch.ps1.

Fixes incorrect changelog entries like:
  'Upgraded azure-messaging-eventhubs from 5.21.3 to 5.22.0-beta.1'
which should instead show the GA version from version_client.txt col 2.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
GetResolvedDependencyVersions now uses a layered resolution strategy:
1. PatchVersionOverrides (highest priority) - patch versions for sibling
   artifacts being patched in the same run
2. version_client.txt col 2 - GA version fallback for prerelease pom versions
3. pom.xml version - used as-is for GA versions and external deps

The previous approach read only from version_client.txt col 2, which was
never updated with patch versions (set_versions.py --new-version only
changes col 3). This caused all deps to appear unchanged, producing the
generic 'Upgraded core dependencies.' message.

patchreleases.ps1 now builds a PatchVersionOverrides map from ArtifactInfos
and passes it through GeneratePatches/GeneratePatch to the resolver.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.


You can also share your feedback on Copilot code review. Take the survey.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@XiaofeiCao XiaofeiCao changed the title Fix and simplify patch release dependency detection Patch release script, fix and simplify dependency detection Mar 13, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.


You can also share your feedback on Copilot code review. Take the survey.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] ARM patch release, dependent libraries are not listed

3 participants