Skip to content

Consolidate package version specification and computation#4336

Draft
paulmedynski wants to merge 3 commits into
mainfrom
dev/paul/canonical-versions
Draft

Consolidate package version specification and computation#4336
paulmedynski wants to merge 3 commits into
mainfrom
dev/paul/canonical-versions

Conversation

@paulmedynski
Copy link
Copy Markdown
Contributor

@paulmedynski paulmedynski commented Jun 3, 2026

Summary

Introduces canonical version infrastructure with centralized, pre-computed package versions for all pipeline types (OneBranch official, CI, and PR).

Motivation

Previously, version computation was scattered:

  • OneBranch pipelines had hardcoded version variables that required manual updates each release
  • CI/PR pipelines had no mechanism to compute versions centrally — version variables were undefined or relied on fallback defaults
  • There was no clear distinction between "being released" vs "dependency-only" package versions in official builds

This PR creates a single source of truth for versions (Versions.props per project) and a uniform extraction pattern across all pipeline types.

Changes

Version Infrastructure (Versions.props)

  • Renamed *VersionDefault*NextVersion in all 6 Versions.props files (SqlClient, Abstractions, Logging, Azure, AKV Provider, SqlServer)
  • Added *PublishedVersion (last shipped version) to all Versions.props — used for dependency-only packages in official builds
  • Standardized 3-tier priority resolution:
    1. Explicit PackageVersion parameter (CI/OneBranch pass this)
    2. BuildNumber + optional BuildSuffix → prerelease tag
    3. Fallback -dev suffix (local developer builds)

build.proj — GetVersions Targets

  • Added 6 GetVersions{Label} targets that emit PackageVersion: and FileVersion: to stdout
  • Targets accept BuildNumber, BuildSuffix, and IsReleasing{Label} parameters
  • OneBranch uses release booleans to select next vs published version; CI/PR always use next version

OneBranch Pipeline (Official)

  • New: eng/pipelines/onebranch/stages/compute-versions-stage.yml — single fast stage extracts all versions up-front
  • Modified: build-stages.yml — consumes versions from compute-versions stage via stageDependencies outputs
  • Modified: build-buildproj-job.yml, pack-buildproj-step.yml, build-buildproj-step.yml — accept packageVersion as required parameter
  • Simplified: package-variables.yml — removed hardcoded version values (now computed dynamically)
  • Removed: Release boolean defaults from pipeline YAML (kept only in compute-versions)
  • Modified: publish-symbols-stage.yml / publish-symbols-job.yml — accept version parameters

CI/PR Pipeline

  • New: eng/pipelines/stages/compute-versions-ci-stage.yml — fast stage runs GetVersions* with BuildSuffix
  • Modified: dotnet-sqlclient-ci-core.yml — added buildSuffix parameter, wired compute-versions as first stage
  • Modified: All 5 downstream build stages — added compute_versions_ci to dependsOn, defined stage-level variables from outputs
  • Modified: PR pipelines pass buildSuffix: 'pr', CI pipelines pass buildSuffix: 'ci'
  • Simplified: ci-build-variables.yml — removed version variables (now computed dynamically)

Documentation

  • Renamed: package-versions.instructions.md3rd-party-package-versions.instructions.md (scoped to external deps)
  • New: sqlclient-package-versions.instructions.md — comprehensive guide to version resolution across all scenarios

Version Differentiation

Pipeline Suffix Example Version
Developer (local) -dev 7.1.0-preview1-dev
PR validation -pr 7.1.0-preview1-pr20250602.1
CI (merge trigger) -ci 7.1.0-preview1-ci20250602.1
OneBranch official (none) 7.1.0-preview1

Architecture

Versions.props (per project)          build.proj GetVersions* targets
    ├── NextVersion                         ↓
    ├── PublishedVersion              compute-versions stage
    └── Priority logic                      ↓
                                    stageDependencies outputs
                                            ↓
                                    downstream build stages
                                    (-p:PackageVersion<Pkg>=<value>)

Verification

  • OneBranch official pipeline produces correct versions
  • CI pipeline produces -ci suffixed versions
  • PR pipeline produces -pr suffixed versions
  • Local dotnet build still produces -dev versions
  • Package dependency versions resolve correctly in Package mode

…ions

- Rename *VersionDefault -> *NextVersion in all Versions.props
- Add *PublishedVersion (last shipped) to all Versions.props
- Add 6 GetVersions* targets to build.proj (stdout-based extraction)
- Add compute-versions-stage.yml (single job extracts all versions up-front)
- Make packageVersion a required parameter in all build/pack steps
- Remove BuildSuffix from pipeline variables
- Wire release booleans to resolve next vs published version per package
- Add compute-versions-ci-stage.yml that extracts all package/file
  versions up-front using GetVersions* targets with BuildSuffix
- Wire compute-versions as first stage in dotnet-sqlclient-ci-core.yml
- PR pipelines pass buildSuffix='pr', CI pipelines pass buildSuffix='ci'
- Each downstream stage consumes versions via stageDependencies outputs
- Remove buildSuffix from ci-build-variables.yml (now a parameter)
- Rename package-versions.instructions.md to 3rd-party scope
- Add sqlclient-package-versions.instructions.md documenting version flow
Copilot AI review requested due to automatic review settings June 3, 2026 13:56
@github-project-automation github-project-automation Bot moved this to To triage in SqlClient Board Jun 3, 2026
@paulmedynski paulmedynski added the Area\Engineering Use this for issues that are targeted for changes in the 'eng' folder or build systems. label Jun 3, 2026
@paulmedynski paulmedynski moved this from To triage to In progress in SqlClient Board Jun 3, 2026
@paulmedynski paulmedynski added this to the 7.1.0-preview2 milestone Jun 3, 2026
@paulmedynski paulmedynski changed the title Add compute-versions stage for CI/PR pipelines Add compute-versions stage for CI/PR/Official pipelines Jun 3, 2026
@paulmedynski paulmedynski changed the title Add compute-versions stage for CI/PR/Official pipelines Consolidate package version specification and computation Jun 3, 2026
Copy link
Copy Markdown
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

This PR introduces a centralized “compute versions” stage for CI/PR pipelines (mirroring the OneBranch approach) and refactors version sources so pipelines can compute/package versions once and flow them to downstream stages/jobs.

Changes:

  • Added compute_versions_ci stage to extract package/file versions up-front via new GetVersions* targets in build.proj.
  • Refactored each package’s Versions.props to introduce *NextVersion and *PublishedVersion properties.
  • Began wiring CI/PR and OneBranch pipelines/templates to consume computed versions (but the current wiring is incomplete and will break pipeline execution).

Reviewed changes

Copilot reviewed 33 out of 33 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
src/Microsoft.SqlServer.Server/Versions.props Adds Published/Next version properties; updates computed package/file version logic to use SqlServerNextVersion.
src/Microsoft.Data.SqlClient/Versions.props Adds Published/Next version properties; updates computed package/file version logic to use SqlClientNextVersion.
src/Microsoft.Data.SqlClient.Internal/Logging/src/Versions.props Adds Published/Next version properties; updates computed package/file version logic to use LoggingNextVersion.
src/Microsoft.Data.SqlClient.Extensions/Azure/src/Versions.props Adds Published/Next version properties; updates computed package/file version logic to use AzureNextVersion.
src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/Versions.props Adds Published/Next version properties; updates computed package/file version logic to use AbstractionsNextVersion.
src/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider/src/Versions.props Adds Published/Next version properties; updates computed package/file version logic to use AkvProviderNextVersion.
eng/pipelines/stages/compute-versions-ci-stage.yml New CI/PR stage that runs GetVersions* targets and exports versions as stage/job outputs.
eng/pipelines/stages/build-sqlserver-package-ci-stage.yml Adds dependency on compute stage and maps its outputs to stage variables (but needs additional wiring updates).
eng/pipelines/stages/build-sqlclient-package-ci-stage.yml Adds dependency on compute stage and maps its outputs to stage variables; attempts to use those versions downstream.
eng/pipelines/stages/build-logging-package-ci-stage.yml Adds dependency on compute stage and maps its outputs to stage variables (but needs downstream job wiring updates).
eng/pipelines/stages/build-azure-package-ci-stage.yml Adds dependency on compute stage and maps its outputs to stage variables (but downstream job calls still use template parameters).
eng/pipelines/stages/build-abstractions-package-ci-stage.yml Adds dependency on compute stage and maps its outputs to stage variables (but downstream job calls still use template parameters).
eng/pipelines/sqlclient-pr-project-ref-pipeline.yml Passes buildSuffix: 'pr' into the CI core template.
eng/pipelines/sqlclient-pr-package-ref-pipeline.yml Passes buildSuffix: 'pr' into the CI core template.
eng/pipelines/dotnet-sqlclient-ci-project-reference-pipeline.yml Passes buildSuffix: 'ci' into the CI core template.
eng/pipelines/dotnet-sqlclient-ci-package-reference-pipeline.yml Passes buildSuffix: 'ci' into the CI core template.
eng/pipelines/dotnet-sqlclient-ci-core.yml Adds buildSuffix parameter and injects the compute-versions stage before other stages.
eng/pipelines/libraries/ci-build-variables.yml Removes previously hardcoded per-package version variables in favor of computed versions.
build.proj Adds GetVersions* targets that emit labeled version lines for pipeline parsing.
eng/pipelines/onebranch/variables/package-variables.yml Removes OneBranch per-package version variables; keeps artifact naming variables.
eng/pipelines/onebranch/stages/compute-versions-stage.yml New OneBranch stage to compute “next/published/effective” versions and emit output variables.
eng/pipelines/onebranch/stages/build-stages.yml Refactors build template to require pre-computed versions; comments out SqlClient package validation stage.
eng/pipelines/onebranch/stages/publish-symbols-stage.yml Refactors parameters to require pre-computed package versions for symbol publishing.
eng/pipelines/onebranch/stages/release-stages.yml Removes explicit per-version packagePath in favor of default/wildcarded publish behavior.
eng/pipelines/onebranch/jobs/build-buildproj-job.yml Threads “pre-computed version” concept through build/pack steps; tweaks APIScan versionNumber handling.
eng/pipelines/onebranch/jobs/publish-symbols-job.yml Refactors job variables to list form; clarifies version requirement.
eng/pipelines/onebranch/steps/roslyn-analyzers-buildproj-step.yml Updates comments to reflect version must be pre-computed.
eng/pipelines/onebranch/steps/pack-buildproj-step.yml Updates comments to reflect version must be pre-computed.
eng/pipelines/onebranch/steps/build-buildproj-step.yml Updates comments to reflect version must be pre-computed.
eng/pipelines/onebranch/sqlclient-official.yml Removes passing version vars to templates (but does not yet provide new required version parameters).
eng/pipelines/onebranch/sqlclient-non-official.yml Removes passing version vars to templates (but does not yet provide new required version parameters).
.github/instructions/sqlclient-package-versions.instructions.md New documentation describing version resolution flow (examples need to match actual pipeline build-number format).
.github/instructions/3rd-party-package-versions.instructions.md Renames/re-scopes instructions to explicitly cover third-party dependency versions.

Comment on lines +81 to +85
variables:
- name: abstractionsPackageVersion
value: $[ stageDependencies.compute_versions_ci.compute_versions_job.outputs['versions.AbstractionsPackageVersion'] ]
- name: abstractionsAssemblyFileVersion
value: $[ stageDependencies.compute_versions_ci.compute_versions_job.outputs['versions.AbstractionsFileVersion'] ]
Comment on lines +77 to +80
variables:
- name: sqlServerPackageVersion
value: $[ stageDependencies.compute_versions_ci.compute_versions_job.outputs['versions.SqlServerPackageVersion'] ]

Comment on lines +100 to +104
- name: mdsPackageVersion
value: $[ stageDependencies.compute_versions_ci.compute_versions_job.outputs['versions.SqlClientPackageVersion'] ]
- name: akvPackageVersion
value: $[ stageDependencies.compute_versions_ci.compute_versions_job.outputs['versions.AkvProviderPackageVersion'] ]
- name: loggingPackageVersion
Comment on lines +170 to +174
# Package versions from compute-versions stage.
- name: azurePackageVersion
value: $[ stageDependencies.compute_versions_ci.compute_versions_job.outputs['versions.AzurePackageVersion'] ]
- name: azureAssemblyFileVersion
value: $[ stageDependencies.compute_versions_ci.compute_versions_job.outputs['versions.AzureFileVersion'] ]
Comment thread eng/pipelines/onebranch/sqlclient-official.yml
Comment thread .github/instructions/sqlclient-package-versions.instructions.md
Comment thread .github/instructions/sqlclient-package-versions.instructions.md Outdated
Comment on lines +82 to +86
- name: loggingPackageVersion
value: $[ stageDependencies.compute_versions_ci.compute_versions_job.outputs['versions.LoggingPackageVersion'] ]
- name: loggingAssemblyFileVersion
value: $[ stageDependencies.compute_versions_ci.compute_versions_job.outputs['versions.LoggingFileVersion'] ]

Comment on lines +131 to +135
# Compute all package versions up-front. Downstream stages consume these via
# stage dependency output variables (e.g. $(loggingPackageVersion)).
- template: /eng/pipelines/stages/compute-versions-ci-stage.yml@self
parameters:
buildSuffix: ${{ parameters.buildSuffix }}
Comment on lines +7 to 11
# Variables for PR and CI pipelines. Package versions are computed by each project's
# Versions.props using BuildNumber + buildSuffix. No per-package version variables are needed.
# The buildSuffix itself is set by each pipeline via the core template parameter.

variables:
- Add compute-versions-stage.yml invocation to official and non-official
  OneBranch pipelines, passing release* parameters
- Add dependsOn: compute_versions and stage-level variables to all build
  stages in build-stages.yml (resolves versions from stageDependencies)
- Add dependsOn: compute_versions and stage-level variables to
  publish-symbols-stage.yml
- Give version parameters default values of $(variableName) so they
  resolve at runtime from stage variables when not passed explicitly
- Fix BuildNumber format in docs: use $(Rev:rr) (e.g. 15401)
  instead of incorrect 20250602.1 format
- Add comment on name: explaining 16-bit int FileVersion constraint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area\Engineering Use this for issues that are targeted for changes in the 'eng' folder or build systems.

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

2 participants