Fix buildinfo.json uploading for preview, LTS, and stable releases#25571
Fix buildinfo.json uploading for preview, LTS, and stable releases#25571daxian-dbw merged 9 commits intomasterfrom
Conversation
| if ($ltsRelease) { | ||
| [System.Management.Automation.SemanticVersion] $stableVersion = $stableReleaseTag | ||
| [System.Management.Automation.SemanticVersion] $currentVersion = $currentReleaseTag | ||
| if ($currentVersion.Minor % 2 -eq 0) { |
There was a problem hiding this comment.
We need to use metadata.json because we can have two LTS releases
There was a problem hiding this comment.
Pull request overview
This PR aims to fix the buildinfo.json upload logic to correctly identify LTS and stable releases without relying on metadata.json's PublishToChannels flags. The changes introduce version-based logic to determine if a release is LTS (even minor versions) and compare versions to ensure only newer stable releases update the stable.json file.
Changes:
- Removed dependency on metadata.json flags for determining stable/LTS release status
- Added semantic version comparison to check if current release is newer than stable release
- Introduced logic to identify LTS releases based on even minor version numbers
- Enhanced upload comments for clarity
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if ($ltsRelease) { | ||
| [System.Management.Automation.SemanticVersion] $stableVersion = $stableReleaseTag | ||
| [System.Management.Automation.SemanticVersion] $currentVersion = $currentReleaseTag | ||
| $isLTSRelease = ($currentVersion.Minor % 2) -eq 0 |
There was a problem hiding this comment.
The LTS determination logic ($currentVersion.Minor % 2) -eq 0 assumes that all even minor versions are LTS releases. However, this may not always be accurate. For example:
- If a stable release is 7.6.0 (even minor), it would be considered LTS
- If the actual LTS release is 7.4.x, the logic would incorrectly identify 7.6.0 as LTS as well
Consider whether this assumption holds for all PowerShell versioning scenarios, or if additional validation is needed to ensure only the correct versions are marked as LTS.
There was a problem hiding this comment.
will use
$ltsRelease = $metadata.LTSRelease.PublishToChannels
… LTS determination
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
PR Summary
This pull request refactors and improves the release build info upload process in the
.pipelines/templates/release-upload-buildinfo.ymlfile. The main goals are to clarify variable names, improve semantic version handling, and ensure that JSON files for preview, LTS, and stable releases are only uploaded when appropriate.Key improvements and changes:
Variable renaming and logic clarity:
CopyMainBuildInfo,CopyLTSBuildInfo, andCopyVersionBuildInfoto more descriptive names:UploadPreview,UploadLTS, andUploadStable. Similarly, output file variables were renamed for clarity (e.g.,BuildInfoJsonFile→PreviewBuildInfoFile). [1] [2]Semantic version comparison:
Conditional uploads and file creation:
These changes improve maintainability, correctness, and clarity in the release pipeline.
PR Context
This pull request updates the logic in the
.pipelines/templates/release-upload-buildinfo.ymlfile to improve the handling of release tags and JSON file creation for stable, LTS, and preview builds. The changes focus on refining the conditions for processing release information, ensuring accurate version comparisons, and enhancing the clarity of the upload logic.Improvements to release tag handling:
StableReleaseandLTSReleasewithStableReleaseTagandReleaseTag, stripping the 'v' prefix for consistent version comparisons. ([.pipelines/templates/release-upload-buildinfo.ymlL61-R62](https://github.com/PowerShell/PowerShell/pull/25571/files#diff-3899d139e74033a3ffb85d3d580d27296f1b1851dfa1405a322bc0da6c9cf2a3L61-R62))Refinements in JSON file creation:
CopyMainBuildInfoto focus solely on preview builds, removing the dependency onStableRelease. ([.pipelines/templates/release-upload-buildinfo.ymlL74-R74](https://github.com/PowerShell/PowerShell/pull/25571/files#diff-3899d139e74033a3ffb85d3d580d27296f1b1851dfa1405a322bc0da6c9cf2a3L74-R74))[.pipelines/templates/release-upload-buildinfo.ymlL83-R86](https://github.com/PowerShell/PowerShell/pull/25571/files#diff-3899d139e74033a3ffb85d3d580d27296f1b1851dfa1405a322bc0da6c9cf2a3L83-R86))stable.jsonis only updated if the current version is greater than the stable version. ([.pipelines/templates/release-upload-buildinfo.ymlR95-R96](https://github.com/PowerShell/PowerShell/pull/25571/files#diff-3899d139e74033a3ffb85d3d580d27296f1b1851dfa1405a322bc0da6c9cf2a3R95-R96))Enhancements to upload logic:
[.pipelines/templates/release-upload-buildinfo.ymlR128-R144](https://github.com/PowerShell/PowerShell/pull/25571/files#diff-3899d139e74033a3ffb85d3d580d27296f1b1851dfa1405a322bc0da6c9cf2a3R128-R144))PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright header