[release/v7.4] Fix buildinfo.json uploading for preview, LTS, and stable releases#26863
Conversation
There was a problem hiding this comment.
Pull request overview
Backports updates to the release pipeline template responsible for generating and uploading build info JSON files, aiming to correctly handle preview, LTS, and stable release uploads (including versioned “major-minor” buildinfo files).
Changes:
- Refactors pipeline variables (e.g.,
CopyMainBuildInfo→UploadPreview, etc.) and updates upload conditions. - Adds semantic version parsing/comparison intended to prevent updating stable pointers unless the current version is newer.
- Adjusts metadata-driven gating logic for preview/LTS/stable behaviors.
| $stableRelease = $metadata.StableRelease.PublishToChannels | ||
| $ltsRelease = $metadata.LTSRelease.PublishToChannels |
There was a problem hiding this comment.
tools/metadata.json in this branch defines StableRelease/LTSRelease as objects with Latest/Package fields (no PublishToChannels). Using $metadata.StableRelease.PublishToChannels and $metadata.LTSRelease.PublishToChannels will evaluate to $null, preventing LTS/stable logic from ever running. Please revert these accesses to the correct fields for release/v7.4 (e.g., .Latest) or update the metadata schema in this branch consistently.
| $stableRelease = $metadata.StableRelease.PublishToChannels | |
| $ltsRelease = $metadata.LTSRelease.PublishToChannels | |
| $stableRelease = $metadata.StableRelease.Latest | |
| $ltsRelease = $metadata.LTSRelease.Latest |
| if ($fileName -eq "preview.json") { | ||
| Set-BuildVariable -Name UploadPreview -Value YES | ||
| } else { | ||
| Set-BuildVariable -Name CopyMainBuildInfo -Value NO | ||
| Set-BuildVariable -Name UploadPreview -Value NO | ||
| } | ||
|
|
||
| Set-BuildVariable -Name BuildInfoJsonFile -Value $targetFile | ||
|
|
||
| ## Create 'lts.json' if it's the latest stable and also a LTS release. | ||
| Set-BuildVariable -Name PreviewBuildInfoFile -Value $targetFile |
There was a problem hiding this comment.
The new upload variable naming/logic no longer triggers an upload of stable.json itself. UploadPreview only covers preview.json, and UploadStable later uploads $env:StableBuildInfoFile (the versioned <major>-<minor>.json), so the stable.json blob is never updated by this template. Please add explicit handling to upload stable.json when appropriate (similar to the previous CopyMainBuildInfo behavior), in addition to any versioned/LTS uploads.
|
|
||
| $buildInfo = $buildInfoJsonContent | ConvertFrom-Json | ||
| $buildInfo.ReleaseDate = $dateTime | ||
| $currentReleaseTag = $buildInfo.ReleaseTag -Replace 'v','' |
There was a problem hiding this comment.
-Replace 'v','' removes all occurrences of the letter v, not just the leading v prefix. Using -replace '^v' here avoids accidentally mangling tags that contain v in other parts (e.g., preview).
Backport of #25571 to release/v7.4
Triggered by @tplunk_microsoft on behalf of @jshigetomi
Original CL Label: CL-BuildPackaging
/cc @PowerShell/powershell-maintainers
Impact
REQUIRED: Choose either Tooling Impact or Customer Impact (or both). At least one checkbox must be selected.
Tooling Impact
Fixes buildinfo.json upload logic for release pipeline. Refactors variable names from CopyMainBuildInfo/CopyLTSBuildInfo/CopyVersionBuildInfo to UploadPreview/UploadLTS/UploadStable for clarity. Adds semantic version comparison to ensure stable.json is only updated when current version is greater than stable version. Updates upload conditions to properly handle preview, LTS, and stable releases.
Customer Impact
Regression
REQUIRED: Check exactly one box.
This is not a regression.
Testing
Can only be tested interactively through release pipeline runs. Verified by reviewing logic changes and ensuring correct conditional uploads for preview, LTS, and stable releases. Changes add semantic version comparison to prevent updating stable.json unless current version is greater than stable version.
Risk
REQUIRED: Check exactly one box.
High risk as it modifies release build infrastructure, but necessary to fix incorrect buildinfo.json upload behavior. Changes improve maintainability and ensure proper version handling for preview, LTS, and stable releases. The refactoring clarifies variable names and adds semantic version comparison to prevent incorrect stable.json updates.
Merge Conflicts
The file .pipelines/templates/release-upload-buildinfo.yml had conflicts during cherry-pick: