Skip to content

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

Merged
daxian-dbw merged 2 commits intoPowerShell:release/v7.5from
TravisEz13:backport/release/v7.5/25571-0931a75d3
Feb 12, 2026
Merged

[release/v7.5] Fix buildinfo.json uploading for preview, LTS, and stable releases#26773
daxian-dbw merged 2 commits intoPowerShell:release/v7.5from
TravisEz13:backport/release/v7.5/25571-0931a75d3

Conversation

@TravisEz13
Copy link
Member

Backport of #25571 to release/v7.5

Triggered by @TravisEz13 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 GitHub Actions release pipeline automation for buildinfo.json handling. Improves clarity and correctness in release tag processing and JSON file uploads for 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

Original PR fixes release pipeline automation. Testing verified build pipeline functionality on multiple branches. Backport tested on v7.5 release branch - cherry-pick completed successfully with proper conflict resolution for v7.5-specific variable handling.

Risk

REQUIRED: Check exactly one box.

  • High
  • Medium
  • Low

Medium risk as it modifies build pipeline logic, but the changes improve maintainability and correctness. All modifications are scoped to release upload automation. The v7.6 backport (PR #26715) was already merged successfully, demonstrating the changes are valid.

Merge Conflicts

1 file with conflicts resolved: .pipelines/templates/release-upload-buildinfo.yml. Conflict was caused by v7.5 having older code (.Latest vs .PublishToChannels). Resolved by applying PR's semantic versioning changes and modern variable naming.

@TravisEz13 TravisEz13 requested a review from a team as a code owner February 10, 2026 16:36
Copilot AI review requested due to automatic review settings February 10, 2026 16:36
@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 10, 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

Backport to release/v7.5 intended to fix/clarify the release pipeline logic that generates and uploads buildinfo JSON artifacts for preview, LTS, and stable releases.

Changes:

  • Renames pipeline variables controlling uploads (e.g., Copy*Upload*) and corresponding file variables.
  • Introduces semantic version parsing/comparison to gate stable upload behavior.
  • Updates the Azure Blob upload step to upload preview/LTS/stable artifacts conditionally.

Comment on lines +82 to 86
[System.Management.Automation.SemanticVersion] $stableVersion = $stableReleaseTag
[System.Management.Automation.SemanticVersion] $currentVersion = $currentReleaseTag
if ($ltsRelease) {
$ltsFile = "$ENV:PIPELINE_WORKSPACE/lts.json"
Copy-Item -Path $targetFile -Destination $ltsFile -Force
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

$ltsRelease is referenced but never defined in this script, which will throw at runtime. Define it (for example from metadata.json or by computing whether the current release tag is an LTS release) before this conditional.

Copilot uses AI. Check for mistakes.
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 3 comments.

Comment on lines +84 to 87
[System.Management.Automation.SemanticVersion] $stableVersion = $stableReleaseTag
[System.Management.Automation.SemanticVersion] $currentVersion = $currentReleaseTag
if ($ltsRelease) {
$ltsFile = "$ENV:PIPELINE_WORKSPACE/lts.json"
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

$ltsRelease is referenced but never defined in this script anymore (it was removed when $metadata.LTSRelease.Latest was deleted). As written, this condition will always evaluate to $false, so lts.json will never be created/uploaded even when the release should be LTS. Define $ltsRelease again (e.g., from metadata.json or by deriving it from $currentVersion / $buildInfo.ReleaseTag) before this check.

Copilot uses AI. Check for mistakes.
Comment on lines +61 to +69
$stableReleaseTag = $metadata.StableReleaseTag -Replace 'v',''

Write-Verbose -Verbose "Writing $jsonFile contents:"
$buildInfoJsonContent = Get-Content $jsonFile -Encoding UTF8NoBom -Raw
Write-Verbose -Verbose $buildInfoJsonContent

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

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

Using -Replace 'v','' removes all occurrences of the character v, not just a leading v prefix. For tags like v7.5.0-preview.3 this would also strip the v in preview, corrupting the version string. Use a prefix-only removal (e.g., -replace '^v' or TrimStart('v')) for both $stableReleaseTag and $currentReleaseTag.

Copilot uses AI. Check for mistakes.
Comment on lines +74 to +103
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

## Create 'lts.json' if marked as a LTS release.
if ($fileName -eq "stable.json") {
[System.Management.Automation.SemanticVersion] $stableVersion = $stableReleaseTag
[System.Management.Automation.SemanticVersion] $currentVersion = $currentReleaseTag
if ($ltsRelease) {
$ltsFile = "$ENV:PIPELINE_WORKSPACE/lts.json"
Copy-Item -Path $targetFile -Destination $ltsFile -Force
Set-BuildVariable -Name LtsBuildInfoJsonFile -Value $ltsFile
Set-BuildVariable -Name CopyLTSBuildInfo -Value YES
Set-BuildVariable -Name LTSBuildInfoFile -Value $ltsFile
Set-BuildVariable -Name UploadLTS -Value YES
} else {
Set-BuildVariable -Name CopyLTSBuildInfo -Value NO
Set-BuildVariable -Name UploadLTS -Value NO
}

$releaseTag = $buildInfo.ReleaseTag
$version = $releaseTag -replace '^v'
$semVersion = [System.Management.Automation.SemanticVersion] $version
## Only update the stable.json if the current version is greater than the stable version.
if ($currentVersion -gt $stableVersion) {
$versionFile = "$ENV:PIPELINE_WORKSPACE/$($currentVersion.Major)-$($currentVersion.Minor).json"
Copy-Item -Path $targetFile -Destination $versionFile -Force
Set-BuildVariable -Name StableBuildInfoFile -Value $versionFile
Set-BuildVariable -Name UploadStable -Value YES
} else {
Set-BuildVariable -Name UploadStable -Value NO
}
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

After this change, stable.json itself is never uploaded: UploadPreview only covers preview.json, and the UploadStable path uploads only $StableBuildInfoFile (currently set to the versioned Major-Minor.json). Previously the main buildinfo file (stable.json when appropriate) was uploaded via CopyMainBuildInfo/BuildInfoJsonFile. If consumers still expect buildinfo/stable.json to update, reintroduce an upload path for the stable.json $targetFile (separate from the versioned stable file), or adjust the logic/variables so the stable channel file is uploaded as well.

Copilot uses AI. Check for mistakes.
@daxian-dbw daxian-dbw merged commit 1b48948 into PowerShell:release/v7.5 Feb 12, 2026
38 checks passed
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