Skip to content

Fix buildinfo.json uploading for preview, LTS, and stable releases#25571

Merged
daxian-dbw merged 9 commits intomasterfrom
FixBuildInfoRelease
Jan 21, 2026
Merged

Fix buildinfo.json uploading for preview, LTS, and stable releases#25571
daxian-dbw merged 9 commits intomasterfrom
FixBuildInfoRelease

Conversation

@jshigetomi
Copy link
Collaborator

@jshigetomi jshigetomi commented May 15, 2025

  • Fix buildinfo to not depend on metadata.json

PR Summary

This pull request refactors and improves the release build info upload process in the .pipelines/templates/release-upload-buildinfo.yml file. 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:

  • Renamed build variable names from CopyMainBuildInfo, CopyLTSBuildInfo, and CopyVersionBuildInfo to more descriptive names: UploadPreview, UploadLTS, and UploadStable. Similarly, output file variables were renamed for clarity (e.g., BuildInfoJsonFilePreviewBuildInfoFile). [1] [2]

Semantic version comparison:

  • Added logic to parse and compare semantic versions for stable releases, ensuring that the stable release file is only updated if the current version is greater than the previous stable version. [1] [2]

Conditional uploads and file creation:

  • Updated the conditions for uploading JSON files to Azure Storage so that preview, LTS, and stable files are only uploaded when relevant, using the new variable names. The upload step now checks if any of the new upload variables are set to 'YES'.
  • Ensured that the creation and copying of versioned JSON files (e.g., for stable and LTS releases) only occurs when appropriate, based on semantic version comparison and release type.

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.yml file 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:

  • Replaced StableRelease and LTSRelease with StableReleaseTag and ReleaseTag, 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:

  • Updated the condition for setting CopyMainBuildInfo to focus solely on preview builds, removing the dependency on StableRelease. ([.pipelines/templates/release-upload-buildinfo.ymlL74-R74](https://github.com/PowerShell/PowerShell/pull/25571/files#diff-3899d139e74033a3ffb85d3d580d27296f1b1851dfa1405a322bc0da6c9cf2a3L74-R74))
  • Introduced semantic versioning for stable and current release tags to determine if the current release is eligible for LTS (based on even minor versions). ([.pipelines/templates/release-upload-buildinfo.ymlL83-R86](https://github.com/PowerShell/PowerShell/pull/25571/files#diff-3899d139e74033a3ffb85d3d580d27296f1b1851dfa1405a322bc0da6c9cf2a3L83-R86))
  • Added a check to ensure stable.json is 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:

  • Improved clarity by adding comments to distinguish between the upload steps for preview, LTS, and stable JSON files. ([.pipelines/templates/release-upload-buildinfo.ymlR128-R144](https://github.com/PowerShell/PowerShell/pull/25571/files#diff-3899d139e74033a3ffb85d3d580d27296f1b1851dfa1405a322bc0da6c9cf2a3R128-R144))

PR Checklist

@jshigetomi jshigetomi added CL-BuildPackaging Indicates that a PR should be marked as a build or packaging change in the Change Log BackPort-7.4.x-Consider BackPort-7.5.x-Consider labels May 15, 2025
@jshigetomi jshigetomi marked this pull request as ready for review May 15, 2025 19:14
@jshigetomi jshigetomi requested a review from a team as a code owner May 15, 2025 19:14
@microsoft-github-policy-service microsoft-github-policy-service bot added the Review - Needed The PR is being reviewed label May 22, 2025
if ($ltsRelease) {
[System.Management.Automation.SemanticVersion] $stableVersion = $stableReleaseTag
[System.Management.Automation.SemanticVersion] $currentVersion = $currentReleaseTag
if ($currentVersion.Minor % 2 -eq 0) {
Copy link
Member

Choose a reason for hiding this comment

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

We need to use metadata.json because we can have two LTS releases

@jshigetomi jshigetomi changed the title Release Build for for LTS Versions Greater than the Current Stable Fix buildinfo.json uploading LTS to the latest stable Sep 12, 2025
@jshigetomi jshigetomi closed this Jan 20, 2026
@jshigetomi jshigetomi reopened this Jan 20, 2026
Copilot AI review requested due to automatic review settings January 20, 2026 21:13
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

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.

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 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
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

  will use
  $ltsRelease = $metadata.LTSRelease.PublishToChannels

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 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.

@daxian-dbw daxian-dbw changed the title Fix buildinfo.json uploading LTS to the latest stable Fix buildinfo.json uploading for preview, LTS, and stable releases Jan 21, 2026
@daxian-dbw daxian-dbw merged commit 0931a75 into master Jan 21, 2026
36 checks passed
@daxian-dbw daxian-dbw deleted the FixBuildInfoRelease branch January 21, 2026 00:27
daxian-dbw pushed a commit to daxian-dbw/PowerShell that referenced this pull request Jan 21, 2026
daxian-dbw pushed a commit to daxian-dbw/PowerShell that referenced this pull request Jan 21, 2026
@microsoft-github-policy-service microsoft-github-policy-service bot removed the Review - Needed The PR is being reviewed label Jan 21, 2026
TravisEz13 pushed a commit to TravisEz13/PowerShell that referenced this pull request Feb 10, 2026
TravisEz13 pushed a commit to TravisEz13/PowerShell that referenced this pull request Feb 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backport-7.4.x-Migrated Backport-7.5.x-Migrated Backport-7.6.x-Migrated CL-BuildPackaging Indicates that a PR should be marked as a build or packaging change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants