Skip to content

[release/v7.4] Fix buildinfo.json uploading for preview, LTS, and stable releases#26863

Merged
adityapatwardhan merged 1 commit intoPowerShell:release/v7.4from
TravisEz13:backport/release/v7.4/25571-0931a75d3
Feb 20, 2026
Merged

[release/v7.4] Fix buildinfo.json uploading for preview, LTS, and stable releases#26863
adityapatwardhan merged 1 commit intoPowerShell:release/v7.4from
TravisEz13:backport/release/v7.4/25571-0931a75d3

Conversation

@TravisEz13
Copy link
Member

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

  • Required tooling change
  • Optional tooling change (include reasoning)

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

  • Customer reported
  • Found internally

Regression

REQUIRED: Check exactly one box.

  • Yes
  • No

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
  • Medium
  • Low

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:

  • Conflict: Property name differences - release/v7.4 uses $metadata.StableRelease.Latest and $metadata.LTSRelease.Latest, while main branch uses .PublishToChannels
  • Resolution: Applied incoming changes, adapting property access to use .PublishToChannels pattern from main branch
  • Manual changes: Removed duplicate $currentReleaseTag definition that appeared before $buildInfo was loaded, keeping only the correct definition after $buildInfo is available

@TravisEz13 TravisEz13 requested a review from a team as a code owner February 20, 2026 18:27
Copilot AI review requested due to automatic review settings February 20, 2026 18:27
@TravisEz13 TravisEz13 added the CL-BuildPackaging Indicates that a PR should be marked as a build or packaging change in the Change Log label Feb 20, 2026
@adityapatwardhan adityapatwardhan merged commit 383a4c5 into PowerShell:release/v7.4 Feb 20, 2026
38 checks passed
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

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

Comment on lines +63 to +64
$stableRelease = $metadata.StableRelease.PublishToChannels
$ltsRelease = $metadata.LTSRelease.PublishToChannels
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
$stableRelease = $metadata.StableRelease.PublishToChannels
$ltsRelease = $metadata.LTSRelease.PublishToChannels
$stableRelease = $metadata.StableRelease.Latest
$ltsRelease = $metadata.LTSRelease.Latest

Copilot uses AI. Check for mistakes.
Comment on lines +77 to +83
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
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.

$buildInfo = $buildInfoJsonContent | ConvertFrom-Json
$buildInfo.ReleaseDate = $dateTime
$currentReleaseTag = $buildInfo.ReleaseTag -Replace 'v',''
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

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

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

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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