Restore the preview package version convention used by earlier releases - #4602
Conversation
Preview packages up to and including 7.1.0-preview2 shipped as
{base}-{suffix}.{Build.BuildNumber}, for example 7.1.0-preview2.26190.5,
with a date-encoded file version of 7.1.0.26190.
The versioning consolidation moved version selection out of the pipeline
YAML and into Versions.props, and with it the only two shapes that
compute-versions.ps1 can emit became 7.1.0-preview3 (AddRevision false)
and 7.1.0.38995-preview3 (AddRevision true). Neither reproduces the
shipped convention: the revision moved ahead of the prerelease suffix and
its source changed from Build.BuildNumber to Build.BuildId, which also
dropped the date encoding from the file version.
Restore the original shape for official and non-official OneBranch runs:
- Pass Build.BuildNumber into compute-versions.ps1.
- When AddRevision is false, append the build number after the prerelease
suffix and emit the build number's date segment as VersionRevision, so
the downstream -p:BuildNumber gives file version 7.1.0.26238.
- Leave stable versions unstamped, matching the previous behaviour where
only preview builds carried a build number.
- Leave the AddRevision path untouched for repeated test publishes.
Verified against the shipped preview2 assembly:
preview2 shipped package 7.1.0-preview2.26190.5 file 7.1.0.26190
preview3 before package 7.1.0-preview3 file 7.1.0.38305
preview3 after package 7.1.0-preview3.26238.3 file 7.1.0.26238
Assembly version remains 7.0.0.0 in all cases.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 8c691319-4c66-40f6-a88e-b453937052f1
There was a problem hiding this comment.
Pull request overview
Restores historical OneBranch preview package and file-version stamping.
Changes:
- Appends pipeline build numbers to prerelease package versions.
- Preserves build-ID revisioning as an opt-in path.
- Expands Pester coverage for versioning scenarios.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
compute-versions-stage.yml |
Passes the pipeline build number. |
compute-versions.ps1 |
Implements restored version stamping. |
compute-versions.Tests.ps1 |
Tests preview, stable, and SqlServer behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Make BuildNumber optional and validate it only on the path that consumes it, rather than declaring a mandatory parameter that is ignored when AddRevision is true. - Rewrite the script description to state each path's package and file version shapes explicitly, including that file versions always carry a build number even when package versions do not. - Gate the 16-bit revision wrap message on AddRevision so default runs stop reporting a collision for a value they never use. - Update the package versions instructions guide, which still documented only the revision-before-suffix shape. - Add non-preview coverage for both paths, assert the wrap message is absent on the default path, and cover the missing and malformed BuildNumber cases. Supply BuildNumber only in the tests that need it. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 8c691319-4c66-40f6-a88e-b453937052f1
|
Test evidence for the latest push ( Worth flagging that nothing in CI executes these Pester tests. There is no pipeline stage, GitHub workflow, or Two environment notes for anyone else trying to run them, since neither is obvious from the README:
Happy to add a follow-up that wires this directory into CI and pins the Pester version, if that is wanted. It felt out of scope here. I also confirmed this push does not change any emitted version. Running the pre-review-feedback script and the current one with the exact arguments the stage passes produces identical output, apart from the suppressed wrap warning: |
Hoists the sample build number into a documented script-scoped constant and derives the assertion patterns from it, so the value reads as arbitrary-but- well-formed rather than as something the tests are coupled to. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 8c691319-4c66-40f6-a88e-b453937052f1
Scope noteThis PR is a release blocker for 7.1.0-preview3, so I want to be explicit about what I am and am not taking on here. In scope: restoring the package and file version convention we shipped in preview2. That is the Preview2 shipped, and preview3 currently does not:
The regression came in with #4336 and was not deliberate. Three of the four version fields moved, and the file version stopped carrying the date encoding. Validated end to end on non-official run Deferred: anything that is a genuine improvement but not required to get preview3 out. I have filed #4603 for these rather than dropping them:
I would rather land the narrow fix, ship preview3, and do those properly than widen this PR while the release is blocked. If anything I have deferred looks like it actually is required for correctness here, say so and I will pull it back in. Review feedback addressed so far
One open question for @paulmedynski: your suggested wording used Tests are 14/14 locally on pwsh 7.6.5 with Pester 5.7.1. |
paulmedynski
left a comment
There was a problem hiding this comment.
Approving, and we can address the outstanding comments in followup work.
Fixes the package version convention regression introduced when versioning was consolidated into
Versions.props.Problem
Preview packages up to and including
7.1.0-preview2shipped as{base}-{suffix}.{Build.BuildNumber}, with a date-encoded file version:7.1.0-preview2(shipped)7.1.0-preview2.26190.57.1.0.26190After #4336 moved version selection out of the pipeline YAML,
compute-versions.ps1can only emit two shapes, and neither reproduces the shipped convention:addRevisionfalse(default)7.1.0-preview37.1.0.38305true7.1.0.38995-preview37.1.0.38995Two things changed at once:
Add-VersionRevisionrebuilds the version as{base}.{revision}-{suffix}).$(Build.BuildNumber)to$(Build.BuildId). Because the official pipeline passes that revision through as-p:BuildNumber, the file version also lost its date encoding —38305is just build id169375wrapped through 16 bits.Confirmed against the shipped assemblies:
Change
Restore the original shape for OneBranch runs, without disturbing the CI or local-dev paths (which use
BuildSuffixand are unaffected):$(Build.BuildNumber)intocompute-versions.ps1.addRevisionisfalse, append the build number after the prerelease suffix, and emit the build number's date segment asVersionRevisionso the downstream-p:BuildNumberyields7.1.0.26238.addRevisionpath untouched, so repeated test publishes can still disambiguate by build id.Result
7.1.0-preview2(shipped)7.1.0-preview2.26190.57.1.0.261907.0.0.07.1.0-preview3before7.1.0-preview37.1.0.383057.0.0.07.1.0-preview3after7.1.0-preview3.26238.37.1.0.262387.0.0.0Verification
compute-versions.ps1run end-to-end against a stubbeddotnetvia its-DotnetPathtest hook:MSBuild property evaluation of the real
Versions.props:Pester coverage updated: build-number stamping, unbuilt-SqlServer passthrough, and stable versions left unstamped.
Checklist
7.0.0.0; CI, PR and local-dev version paths are untouched/cc @paulmedynski @cheenamalhotra