-
Notifications
You must be signed in to change notification settings - Fork 330
Consolidate package version specification and computation #4336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
paulmedynski
wants to merge
12
commits into
main
Choose a base branch
from
dev/paul/canonical-versions
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
d02da63
Eng: canonical version infrastructure with pre-computed pipeline vers…
paulmedynski f75eb18
Add compute-versions stage for CI/PR pipelines
paulmedynski c952496
Fix review feedback: wire compute-versions into OneBranch pipelines
paulmedynski e63eafa
Wire computed package versions into CI test stage
paulmedynski cf9afb3
Unify SqlClient family packages onto a single shared version
paulmedynski f0955bd
Simplify OneBranch pipeline for unified SqlClient family version
paulmedynski 6b2c50f
Simplify CI/PR pipeline for unified SqlClient family version
paulmedynski c68060f
Docs: describe unified SqlClient family versioning
paulmedynski 048bc18
Consolidate CI version parameters onto a single packageVersion
paulmedynski c140cce
Remove dead Abstractions/Logging Versions.props imports from SqlClien…
paulmedynski 87248c9
Rename ThisAssembly version constants to FileVersion and PackageVersion
paulmedynski 4bdf4dd
Simplify OneBranch flags: always build SqlClient family; optional Sql…
paulmedynski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
6 changes: 4 additions & 2 deletions
6
...ructions/package-versions.instructions.md → ...rd-party-package-versions.instructions.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
154 changes: 154 additions & 0 deletions
154
.github/instructions/sqlclient-package-versions.instructions.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,154 @@ | ||
| --- | ||
| applyTo: "**/Versions.props,build.proj,eng/pipelines/**/*.yml" | ||
| --- | ||
| # SqlClient Package Version Resolution | ||
|
|
||
| How package versions are determined across different build scenarios for the packages in this repository. | ||
|
|
||
| ## Package families | ||
|
|
||
| The repository ships two independently-versioned units: | ||
|
|
||
| - **The SqlClient family** — `Microsoft.Data.SqlClient` plus the packages that version in lockstep with | ||
| it: `Microsoft.Data.SqlClient.Internal.Logging`, `Microsoft.Data.SqlClient.Extensions.Abstractions`, | ||
| `Microsoft.Data.SqlClient.Extensions.Azure`, and | ||
| `Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider`. **All family packages use the | ||
| SqlClient version numbers** — the same NuGet package version, file version, and assembly version — | ||
| and are always built and released together. | ||
| - **`Microsoft.SqlServer.Server`** — versioned and released on its own cadence. | ||
|
|
||
| ## Version Properties | ||
|
|
||
| The SqlClient family version lives in `src/Microsoft.Data.SqlClient/Versions.props`, which is imported | ||
| for every project by `src/Directory.Build.props` (so the `SqlClient*` version properties are always | ||
| available). `Microsoft.SqlServer.Server` declares its own version in its own `Versions.props`. | ||
|
|
||
| | Property | Applies to | Purpose | Example | | ||
| |----------|-----------|---------|---------| | ||
| | `SqlClientNextVersion` | SqlClient family | Version being developed; used for the next release | `7.1.0-preview1` | | ||
| | `SqlServerNextVersion` | SqlServer | Version being developed for SqlServer | `1.1.0-preview1` | | ||
| | `SqlServerPublishedVersion` | SqlServer | Last SqlServer version shipped to NuGet | `1.0.0` | | ||
|
|
||
| The SqlClient family always ships its next version, so there is **no** family `PublishedVersion`. Only | ||
| `Microsoft.SqlServer.Server` keeps a published version (used when it is built as a SqlClient dependency | ||
| but not itself released). | ||
|
|
||
| ## Resolution Logic | ||
|
|
||
| Each `Versions.props` uses a 3-tier `<Choose>` block: | ||
|
|
||
| | Priority | Condition | PackageVersion | FileVersion | | ||
| |----------|-----------|----------------|-------------| | ||
| | 1 | `<Pkg>PackageVersion` explicitly provided | Used as-is | Strip prerelease + append BuildNumber | | ||
| | 2 | `BuildNumber` provided (non-zero) | `NextVersion[-BuildSuffix+BuildNumber]` | `NextVersion.Split('-')[0].BuildNumber` | | ||
| | 3 | Nothing provided | `NextVersion-dev` | `NextVersion.Split('-')[0].0` | | ||
|
|
||
| For every family package, `<Pkg>` is `SqlClient` (e.g. `-p:SqlClientPackageVersion=...`); for | ||
| Microsoft.SqlServer.Server it is `SqlServer`. | ||
|
|
||
| ## Scenarios | ||
|
|
||
| ### Developer (local `dotnet build`) | ||
|
|
||
| **Mode:** Project (default `ReferenceType=Project`) | ||
|
|
||
| - No `BuildNumber`, no `BuildSuffix`, no `PackageVersion*` passed. | ||
| - Falls into Priority 3 (the `<Otherwise>` branch). | ||
| - **Result:** `7.1.0-preview1-dev` / FileVersion `7.1.0.0` | ||
| - Dependencies are project references — no package versions needed for siblings. | ||
|
|
||
| **Mode:** Package (`-p:ReferenceType=Package`) | ||
|
|
||
| - Same version resolution for the package being built. | ||
| - Sibling dependencies are restored from local `packages/` feed (previously packed with `-dev` suffix). | ||
| - A developer would first `dotnet build build.proj -t:Pack` to produce local packages, then consume them. | ||
|
|
||
| ### PR Pipeline (non-official CI) | ||
|
|
||
| **`buildSuffix`** set via core template parameter: | ||
| - `buildSuffix: 'pr'` (passed explicitly from PR pipeline) | ||
| - `BuildNumber` = `$(DayOfYear)$(Rev:rr)` (e.g. `15401` for day-of-year 154, run 01) | ||
|
|
||
| **Mode:** Project (typical PR validation) | ||
|
|
||
| - Versions computed in `compute-versions-ci-stage.yml` (runs `GetVersions*` targets with `-p:BuildSuffix=pr -p:BuildNumber=...`) | ||
| - Falls into Priority 2 with BuildSuffix present. | ||
| - **Result:** `7.1.0-preview1-pr15401` / FileVersion `7.1.0.15401` | ||
| - Dependencies are project references — all packages built together in-tree. | ||
|
|
||
| **Mode:** Package (PR package-ref validation) | ||
|
|
||
| - Same version computation via compute-versions stage. | ||
| - Downstream stages define stage-level variables from compute-versions output using `$[ stageDependencies... ]`. | ||
| - Each build step receives an explicit family `-p:SqlClientPackageVersion=<value>` (and `-p:SqlServerPackageVersion=` where needed), hitting Priority 1. | ||
| - Sibling dependencies consumed from pipeline artifacts published by upstream stages. | ||
|
|
||
| ### CI Pipeline (non-official, triggered on merge) | ||
|
|
||
| Same structure as PR but passes `buildSuffix: 'ci'` explicitly. | ||
|
|
||
| - **Result:** `7.1.0-preview1-ci15401` / FileVersion `7.1.0.15401` | ||
|
|
||
| ### OneBranch Pipeline (official) | ||
|
|
||
| **Mode:** Always Package (`ReferenceType=Package`) | ||
|
|
||
| Uses the full `compute-versions-stage.yml` machinery: | ||
|
|
||
| #### Step A: Compute Versions (dedicated early stage) | ||
|
|
||
| 1. Runs the `GetVersionsSqlClient` and `GetVersionsSqlServer` MSBuild targets against `build.proj`. | ||
| 2. Each target calls `dotnet build <project> -getProperty:<Pkg>PackageVersion` with `BuildNumber` but **no BuildSuffix**. | ||
| 3. Falls into Priority 2 without BuildSuffix → `PackageVersion = NextVersion` as-is (e.g. `7.1.0-preview1`). | ||
| 4. `GetVersionsSqlServer` also extracts `SqlServerPublishedVersion` (the SqlClient family has no published version). | ||
|
|
||
| #### Step B: Resolve Effective Versions | ||
|
|
||
| - The **SqlClient family** always uses `SqlClientNextVersion`. | ||
| - **`Microsoft.SqlServer.Server`** uses its next or published version based on the | ||
| `releaseSqlServer` boolean: | ||
|
|
||
| | `releaseSqlServer` | Effective SqlServer Version | Meaning | | ||
| |--------------------------|-----------------------------|---------| | ||
| | `True` | `SqlServerNextVersion` (e.g. `1.1.0-preview1`) | SqlServer is being released | | ||
| | `False` | `SqlServerPublishedVersion` (e.g. `1.0.0`) | Only built as a SqlClient dependency; use last-shipped | | ||
|
|
||
| These are published as ADO output variables: `versions.SqlClientPackageVersion`, | ||
| `versions.SqlServerPackageVersion`, and their `*FileVersion` counterparts. | ||
|
|
||
| #### Step C: Build Stages Consume Pre-computed Versions | ||
|
|
||
| Each downstream build job receives: | ||
| - `packageVersion` parameter → passed as `-p:SqlClientPackageVersion=<value>` (or `-p:SqlServerPackageVersion=` for SqlServer) | ||
| - Dependency versions → family dependencies use the shared `SqlClientPackageVersion`; the SqlServer dependency uses `SqlServerPackageVersion` | ||
|
|
||
| Since an explicit `<Pkg>PackageVersion` is provided, Versions.props hits Priority 1 — uses the value verbatim. | ||
|
|
||
| #### Summary | ||
|
|
||
| | Package | Version Source | Example | | ||
| |---------|----------------|---------| | ||
| | SqlClient family (always released together) | `SqlClientNextVersion` | `7.1.0-preview1` | | ||
| | SqlServer, being released | `SqlServerNextVersion` | `1.1.0-preview1` | | ||
| | SqlServer, dependency only | `SqlServerPublishedVersion` | `1.0.0` | | ||
|
|
||
| ## Key Architectural Difference | ||
|
|
||
| | Scenario | Who computes versions | How dependencies get versions | | ||
| |----------|----------------------|-------------------------------| | ||
| | Developer | Versions.props inline (Priority 3) | Project references (no version needed) | | ||
| | PR/CI (Project) | `compute-versions-ci-stage` up-front | Project references (no version needed) | | ||
| | PR/CI (Package) | `compute-versions-ci-stage` up-front | Stage variables via `$[ stageDependencies... ]` → `-p:SqlClientPackageVersion=` / `-p:SqlServerPackageVersion=` | | ||
| | OneBranch | `compute-versions-stage` up-front | Explicit `-p:SqlClientPackageVersion=` / `-p:SqlServerPackageVersion=` from stage outputs | | ||
|
|
||
| ## Updating Versions | ||
|
|
||
| After releasing the **SqlClient family**: | ||
| 1. Update `SqlClientNextVersion` in `src/Microsoft.Data.SqlClient/Versions.props` to the next planned | ||
| version. (There is no family published version to update.) | ||
|
|
||
| After releasing **`Microsoft.SqlServer.Server`**: | ||
| 1. Update `SqlServerPublishedVersion` to the version just shipped. | ||
| 2. Update `SqlServerNextVersion` to the next planned version. | ||
|
|
||
| The SqlServer properties live in `src/Microsoft.SqlServer.Server/Versions.props`. | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.