GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Restore the preview package version convention used by earlier releas… · iplus-framework/SqlClient@f9e8579

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • .github/instructions
    • sqlclient-package-versions.instructions.md
  • eng/pipelines/onebranch
    • scripts
      • compute-versions.ps1
      • tests
        • compute-versions.Tests.ps1
    • stages
      • compute-versions-stage.yml
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎.github/instructions/sqlclient-package-versions.instructions.md‎

Copy file name to clipboardExpand all lines: .github/instructions/sqlclient-package-versions.instructions.md
+30-12Lines changed: 30 additions & 12 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -136,29 +136,47 @@ Each downstream build job receives:
136136

137137
Since an explicit `<Pkg>PackageVersion` is provided, Versions.props hits Priority 1 — uses the value verbatim.
138138

139-
#### Non-Official Test Publication Revisions
139+
#### Package Version Shapes: `addRevision`
140140

141-
Both OneBranch pipelines expose `addRevision` (default `false`). Their human-readable run name
142-
remains `$(Year:YY)$(DayOfYear)$(Rev:.r)`, while version revisions come from globally unique
143-
`Build.BuildId`. The compute stage always maps `Build.BuildId` into the unsigned 16-bit file-version
144-
range before evaluating canonical file versions:
141+
Both OneBranch pipelines expose `addRevision` (default `false`), which selects between two mutually
142+
exclusive package version shapes. Their human-readable run name is `$(Year:YY)$(DayOfYear)$(Rev:.r)`,
143+
and the compute stage receives both that run name (as `Build.BuildNumber`) and the globally unique
144+
`Build.BuildId` (as the revision).
145+
146+
**Default path — `addRevision: false`.** The pipeline run name is appended after any prerelease
147+
suffix, reproducing the shape shipped by earlier previews. `Build.BuildId` is not used:
148+
149+
- `1.2.3` stays `1.2.3` — non-preview releases are never stamped with a build number
150+
- `1.2.3-preview1` becomes `1.2.3-preview1.<build_number>`, e.g. `7.1.0-preview3.26238.3`
151+
- The matching file version is `1.2.3.<date_segment>`, e.g. `7.1.0.26238`
152+
153+
Note the asymmetry: the *package* version omits the build number for non-preview releases, but the
154+
*file* version always carries one in its fourth component. This keeps every shipped assembly
155+
date-encoded and traceable to the run that produced it, while preserving the released package
156+
version customers expect.
157+
158+
**Opt-in path — `addRevision: true`.** Version revisions come from `Build.BuildId` instead, which is
159+
mapped into the unsigned 16-bit file-version range before canonical file versions are evaluated:
145160

146161
```text
147162
revision = ((Build.BuildId - 1) % 65535) + 1
148163
```
149164

150-
Build IDs `1` through `65535` therefore map directly; subsequent IDs wrap back through that range.
151-
The compute stage logs the mapping whenever wrapping occurs because the revision can then collide
152-
with an earlier run. When `addRevision` is enabled, the mapped value is inserted before any package
153-
prerelease suffix so package and file versions use the same revision:
165+
Build IDs `1` through `65535` map directly; subsequent IDs wrap back through that range. The compute
166+
stage logs the mapping whenever wrapping occurs because the revision can then collide with an earlier
167+
run. The mapped value is inserted before any package prerelease suffix so package and file versions
168+
use the same revision:
154169

155170
- `1.2.3` becomes `1.2.3.<revision>`
156171
- `1.2.3-preview1` becomes `1.2.3.<revision>-preview1`
157172
- The matching file version is `1.2.3.<revision>`
158173

159-
Only packages built in the current run are revised. When `buildSqlServer` is `false`, the effective
160-
SqlServer version remains `SqlServerPublishedVersion` so dependency restore continues to request the
161-
package that actually exists on NuGet.
174+
This shape exists for repeated test publishes of the same base version, where each run needs a
175+
distinct package version. `Build.BuildNumber` is not used on this path.
176+
177+
Only packages built in the current run are revised or stamped. When `buildSqlServer` is `false`, the
178+
effective SqlServer version remains `SqlServerPublishedVersion` so dependency restore continues to
179+
request the package that actually exists on NuGet.
162180

163181
An explicit four-part package version is also treated as the complete file version base by both
164182
canonical Versions.props files; they do not append `FileVersionBuildNumber` as a fifth component.
Collapse file

‎eng/pipelines/onebranch/scripts/compute-versions.ps1‎

Copy file name to clipboardExpand all lines: eng/pipelines/onebranch/scripts/compute-versions.ps1
+112-12Lines changed: 112 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,34 @@
1212
The published SqlServer version is needed when SqlServer is not built because downstream
1313
SqlClient projects restore that existing package from NuGet.
1414
15-
The supplied revision is mapped to the range 1 through 65535 before canonical versions
16-
are evaluated so every file version has a valid fourth component. When AddRevision is true, that
17-
same mapped value is inserted as the fourth numeric component of package versions built during
18-
this run. Any prerelease suffix remains after the revision. For example, 1.2.3-preview1 with
19-
revision 165500 becomes package version 1.2.3.34430-preview1 and file version 1.2.3.34430.
15+
Two mutually exclusive package version shapes are supported:
16+
17+
When AddRevision is true, BuildNumber is ignored if specified. For non-preview releases, versions
18+
will be 1.2.3.<revision>. For preview releases, versions will be 1.2.3.<revision>-previewX.
19+
20+
When AddRevision is false, BuildNumber must be specified. Non-preview versions will be 1.2.3, and
21+
preview releases will be 1.2.3-previewX.<build_number>.
22+
23+
This asymmetry maintains the existing package versioning practice where previews include a
24+
date-coded build number, but normal releases do not.
25+
26+
File versions are always four-part and always carry a build number in the fourth component, even
27+
when the package version does not:
28+
29+
- AddRevision true. The fourth component is the mapped revision, so package and file versions
30+
agree. A package version of 1.2.3.34430-preview1 has file version 1.2.3.34430.
31+
32+
- AddRevision false. The fourth component is the first segment of BuildNumber. A package
33+
version of 1.2.3-preview1.26238.3 has file version 1.2.3.26238, and a stable package version
34+
of 1.2.3 still has file version 1.2.3.26238. This keeps every file version date-encoded and
35+
traceable back to the run that produced it.
2036
21-
Revisions above 65535 wrap through the valid unsigned 16-bit file-version range. The script logs
37+
The supplied revision is mapped to the range 1 through 65535 before canonical versions
38+
are evaluated so every file version has a valid fourth component. Revisions above 65535 wrap
39+
through the valid unsigned 16-bit file-version range. When AddRevision is true the script logs
2240
the mapping because the revision may then collide with an earlier run. An unbuilt SqlServer
23-
package is never revised because its effective version must continue to identify the package
24-
that already exists on NuGet.
41+
package is never revised or stamped with a build number because its effective version must
42+
continue to identify the package that already exists on NuGet.
2543
2644
The script emits these output variables for downstream stages:
2745
- VersionRevision
@@ -33,7 +51,13 @@
3351
3452
.PARAMETER Revision
3553
Positive integer used to distinguish versions. Values above 65535 are wrapped into the unsigned
36-
16-bit revision range.
54+
16-bit revision range. Only consumed when AddRevision is true.
55+
56+
.PARAMETER BuildNumber
57+
Pipeline build number in the form <date>.<run>, such as 26238.3. Required when AddRevision is
58+
false, and ignored when AddRevision is true. When required, it is appended to prerelease package
59+
versions and its first segment becomes the file-version build number, so file versions remain
60+
date-encoded.
3761
3862
.PARAMETER BuildSqlServer
3963
Whether this run builds Microsoft.SqlServer.Server. When false, the effective SqlServer package
@@ -47,6 +71,17 @@
4771
dotnet executable to invoke. Defaults to the dotnet command resolved from PATH. This parameter
4872
primarily supports isolated testing and specialized agent configurations.
4973
74+
.EXAMPLE
75+
./compute-versions.ps1 `
76+
-ProjectPath ./build.proj `
77+
-Revision 165500 `
78+
-BuildNumber 26238.3 `
79+
-BuildSqlServer $true `
80+
-AddRevision $false
81+
82+
Computes versions for an official-style run that builds SqlServer. Prerelease package versions
83+
become 7.1.0-preview3.26238.3 and file versions become 7.1.0.26238.
84+
5085
.EXAMPLE
5186
./compute-versions.ps1 `
5287
-ProjectPath ./build.proj `
@@ -55,7 +90,8 @@
5590
-AddRevision $true
5691
5792
Computes versions for a run that builds SqlServer and appends mapped revision 34430 to both
58-
package families and their file versions.
93+
package families and their file versions. BuildNumber is not supplied because AddRevision is
94+
true.
5995
6096
.EXAMPLE
6197
./compute-versions.ps1 `
@@ -83,6 +119,10 @@ param(
83119
[ValidateRange(1, [long]::MaxValue)]
84120
[long]$Revision,
85121

122+
[Parameter(HelpMessage = "Pipeline build number, such as 26238.3. Required when AddRevision is false.")]
123+
[ValidatePattern("^$|^\d+\.\d+$")]
124+
[string]$BuildNumber = "",
125+
86126
[Parameter(Mandatory = $true, HelpMessage = "Whether Microsoft.SqlServer.Server is built in this run.")]
87127
[bool]$BuildSqlServer,
88128

@@ -98,7 +138,7 @@ Set-StrictMode -Version Latest
98138
$ErrorActionPreference = "Stop"
99139

100140
$wrappedRevision = (($Revision - 1) % 65535) + 1
101-
if ($Revision -gt 65535) {
141+
if ($AddRevision -and $Revision -gt 65535) {
102142
Write-Host "Revision $Revision exceeds the unsigned 16-bit limit and wrapped to $wrappedRevision; this revision may collide with an earlier run."
103143
}
104144

@@ -196,6 +236,43 @@ function Add-VersionRevision {
196236
return $versionWithRevision
197237
}
198238

239+
<#
240+
.SYNOPSIS
241+
Appends a pipeline build number to a prerelease package version.
242+
243+
.DESCRIPTION
244+
Reproduces the version shape used by earlier previews, where the build number follows the
245+
prerelease suffix, such as 7.1.0-preview3.26238.3. Stable versions are returned unchanged
246+
because released packages are not stamped with a build number.
247+
248+
.PARAMETER Version
249+
Package version with a three-part numeric base and optional prerelease suffix.
250+
251+
.PARAMETER BuildNumber
252+
Pipeline build number to append.
253+
254+
.OUTPUTS
255+
The package version with the build number appended to its prerelease suffix, or the original
256+
version when it carries no prerelease suffix.
257+
#>
258+
function Add-VersionBuildNumber {
259+
param(
260+
[string]$Version,
261+
[string]$BuildNumber
262+
)
263+
264+
$parts = $Version -split "-", 2
265+
if ($parts[0] -notmatch "^\d+\.\d+\.\d+$") {
266+
throw "Expected a three-part numeric version base, but received '$Version'."
267+
}
268+
269+
if ($parts.Count -eq 2) {
270+
return "$($parts[0])-$($parts[1]).$BuildNumber"
271+
}
272+
273+
return $Version
274+
}
275+
199276
<#
200277
.SYNOPSIS
201278
Emits an Azure DevOps job output variable for consumption by downstream stages.
@@ -232,6 +309,8 @@ $sqlServerPackageVersion = if ($BuildSqlServer) {
232309
$sqlServerVersions.PublishedVersion
233310
}
234311

312+
$fileVersionBuildNumber = $null
313+
235314
if ($AddRevision) {
236315
$sqlClientPackageVersion = Add-VersionRevision `
237316
-Version $sqlClientPackageVersion `
@@ -242,13 +321,34 @@ if ($AddRevision) {
242321
-Revision $wrappedRevision
243322
}
244323

324+
# The revision is already the fourth component of the package version, so it is also the
325+
# file-version build number.
326+
$fileVersionBuildNumber = $wrappedRevision
245327
Write-Host "Version revision: $wrappedRevision (input=$Revision)"
246328
}
329+
else {
330+
if ([string]::IsNullOrWhiteSpace($BuildNumber)) {
331+
throw "BuildNumber is required when AddRevision is false."
332+
}
333+
334+
$fileVersionBuildNumber = $BuildNumber.Split(".")[0]
335+
336+
$sqlClientPackageVersion = Add-VersionBuildNumber `
337+
-Version $sqlClientPackageVersion `
338+
-BuildNumber $BuildNumber
339+
if ($BuildSqlServer) {
340+
$sqlServerPackageVersion = Add-VersionBuildNumber `
341+
-Version $sqlServerPackageVersion `
342+
-BuildNumber $BuildNumber
343+
}
344+
345+
Write-Host "Version build number: $BuildNumber (file version build number=$fileVersionBuildNumber)"
346+
}
247347

248348
Write-Host "Effective versions:"
249349
Write-Host " SqlClient (family): $sqlClientPackageVersion"
250350
Write-Host " SqlServer: $sqlServerPackageVersion"
251351

252352
Set-PipelineOutputVariable -Name "SqlClientPackageVersion" -Value $sqlClientPackageVersion
253353
Set-PipelineOutputVariable -Name "SqlServerPackageVersion" -Value $sqlServerPackageVersion
254-
Set-PipelineOutputVariable -Name "VersionRevision" -Value $wrappedRevision
354+
Set-PipelineOutputVariable -Name "VersionRevision" -Value $fileVersionBuildNumber

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.