Skip to content

Commit cd9121b

Browse files
authored
Merge branch 'main' into dev/mdaigle/update-package-versions-7.1
2 parents aaf13ad + 62d96ad commit cd9121b

358 files changed

Lines changed: 18842 additions & 60052 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"ms-mssql.mssql"
1717
],
1818
"settings": {
19-
"dotnet.defaultSolution": "src/Microsoft.Data.SqlClient.sln"
19+
"dotnet.defaultSolution": "src/Microsoft.Data.SqlClient.slnx"
2020
}
2121
}
2222
},

.github/copilot-instructions.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,18 @@
1111

1212
## 📚 Project Overview
1313
This project is a .NET data provider for SQL Server, enabling .NET applications to interact with SQL Server databases. It supports various features like connection pooling, transaction management, and asynchronous operations.
14-
The project builds from a **single unified project** at `src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj` that multi-targets `net462`, `net8.0`, and `net9.0`. The legacy `netfx/` and `netcore/` directories are being phased out — only their `ref/` folders (which define the public API surface) remain active.
14+
The project builds from a **single unified project** at `src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj`. It targets `net8.0` and `net9.0` on all supported hosts, and adds `net462` only when building on Windows. The legacy `netfx/` and `netcore/` directories are being phased out — only their `ref/` folders (which define the public API surface) remain active.
1515
The project includes:
1616
- **Public APIs**: Defined in `netcore/ref/` and `netfx/ref/` directories.
1717
- **Implementations**: All source code in `src/Microsoft.Data.SqlClient/src/`.
1818
- **Tests**: Located in the `tests/` directory, covering unit and integration tests.
19-
- **Unit Tests**: Located in `tests/UnitTests/` directory, which includes tests for individual components and methods.
20-
- **Functional Tests**: Located in `tests/FunctionalTests/` directory, which includes tests for various features and functionalities that can be run without a SQL Server instance.
21-
- **Manual Tests**: Located in `tests/ManualTests/` directory, which includes tests that require a SQL Server instance to run.
19+
- **Unit Tests**: Located in `src/Microsoft.Data.SqlClient/tests/UnitTests/`.
20+
- **Functional Tests**: Located in `src/Microsoft.Data.SqlClient/tests/FunctionalTests/`.
21+
- **Manual Tests**: Located in `src/Microsoft.Data.SqlClient/tests/ManualTests/`.
22+
- **Performance/Stress Tests**: Located in `src/Microsoft.Data.SqlClient/tests/PerformanceTests/` and `src/Microsoft.Data.SqlClient/tests/StressTests/`.
2223
- **Documentation**: Found in the `doc/` directory, including API documentation, usage examples.
2324
- **Policies**: Contribution guidelines, coding standards, and review policies in the `policy/` directory.
24-
- **Building**: The project uses MSBuild for building and testing, with configurations and targets defined in the `build.proj` file, whereas instructions are provided in the `BUILDGUIDE.md` file.
25+
- **Building**: The repo uses `build.proj` for orchestrated build/test/pack workflows, `src/Microsoft.Data.SqlClient.slnx` for solution-centric development tooling, and Azure DevOps YAML under `eng/pipelines/` plus `eng/pipelines/onebranch/` for CI and official release flows. See `BUILDGUIDE.md` for local build details.
2526
- **CI/CD**: ADO Pipelines for CI/CD and Pull request validation are defined in the `eng/` directory, ensuring code quality and automated testing.
2627

2728
## 📦 Products
@@ -129,6 +130,10 @@ When a new issue is created, follow these steps:
129130
- Suggest release note entries for fixes by updating files under `release-notes/` or by using the `release-notes` prompt (instead of editing `CHANGELOG.md` directly).
130131
- Tag reviewers based on `CODEOWNERS` file
131132

133+
## 🌿 Branch Naming
134+
- All branches created by AI agents **must** use the `dev/automation/` prefix (e.g. `dev/automation/fix-connection-timeout`).
135+
- Do **not** create branches directly under `main`, `dev/`, or any other top-level prefix.
136+
132137
## 🧠 Contextual Awareness
133138
- All source code is in `src/Microsoft.Data.SqlClient/src/`. Do NOT add code to legacy `netfx/src/` or `netcore/src/` directories.
134139
- Only `ref/` folders in `netcore/ref/` and `netfx/ref/` remain active for defining the public API surface.
Lines changed: 101 additions & 172 deletions
Original file line numberDiff line numberDiff line change
@@ -1,195 +1,124 @@
11
---
22
applyTo: "eng/pipelines/**/*.yml"
33
---
4-
# Azure DevOps Pipelines Guide
5-
6-
## Overview
7-
8-
This repository uses Azure DevOps Pipelines for CI/CD. The pipeline configurations are located in `eng/pipelines/`.
9-
10-
**ADO Organization**: sqlclientdrivers
11-
**ADO Project**: ADO.NET
12-
13-
## Pipeline Structure
14-
15-
```
16-
eng/pipelines/
17-
├── abstractions/ # Abstractions package pipelines
18-
├── azure/ # Azure package pipelines
19-
├── common/ # Shared templates
20-
│ └── templates/
21-
│ ├── jobs/ # Reusable job templates
22-
│ ├── stages/ # Reusable stage templates
23-
│ └── steps/ # Reusable step templates
24-
├── jobs/ # Top-level job definitions
25-
├── libraries/ # Shared variable definitions
26-
├── stages/ # Stage definitions
27-
├── steps/ # Step definitions
28-
├── variables/ # Variable templates
29-
├── akv-official-pipeline.yml # AKV provider official/signing build
30-
├── dotnet-sqlclient-ci-core.yml # Core CI pipeline (reusable)
31-
├── dotnet-sqlclient-ci-package-reference-pipeline.yml # CI with package references
32-
├── dotnet-sqlclient-ci-project-reference-pipeline.yml # CI with project references
33-
├── dotnet-sqlclient-signing-pipeline.yml # Package signing pipeline
34-
├── sqlclient-pr-package-ref-pipeline.yml # PR validation (package ref)
35-
├── sqlclient-pr-project-ref-pipeline.yml # PR validation (project ref)
36-
└── stress-tests-pipeline.yml # Stress testing
37-
```
38-
39-
## Main Pipelines
40-
41-
### CI Core Pipeline (`dotnet-sqlclient-ci-core.yml`)
42-
Reusable core CI pipeline consumed by both project-reference and package-reference CI pipelines. Configurable parameters:
43-
44-
| Parameter | Description | Default |
45-
|-----------|-------------|---------|
46-
| `targetFrameworks` | Windows test frameworks | `[net462, net8.0, net9.0, net10.0]` |
47-
| `targetFrameworksUnix` | Unix test frameworks | `[net8.0, net9.0, net10.0]` |
48-
| `referenceType` | Project or Package reference | Required |
49-
| `buildConfiguration` | Debug or Release | Required |
50-
| `useManagedSNI` | Test with managed SNI | `[false, true]` |
51-
| `testJobTimeout` | Test job timeout (minutes) | Required |
52-
| `runAlwaysEncryptedTests` | Include AE tests | `true` |
53-
| `enableStressTests` | Include stress test stage | `false` |
54-
55-
### CI Reference Pipelines
56-
- `dotnet-sqlclient-ci-project-reference-pipeline.yml` — Full CI using project references (builds from source)
57-
- `dotnet-sqlclient-ci-package-reference-pipeline.yml` — Full CI using package references (tests against published NuGet packages)
58-
59-
### PR Validation Pipelines
60-
- `sqlclient-pr-project-ref-pipeline.yml` — PR validation with project references
61-
- `sqlclient-pr-package-ref-pipeline.yml` — PR validation with package references
62-
63-
These pipelines trigger on pull requests and run a subset of the full CI matrix to provide fast feedback.
64-
65-
### Official/Signing Pipeline (`dotnet-sqlclient-signing-pipeline.yml`)
66-
Signs and publishes NuGet packages. Used for official releases. Requires secure service connections and key vault access for code signing.
67-
68-
### AKV Official Pipeline (`akv-official-pipeline.yml`)
69-
Builds and signs the `Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider` add-on package separately from the main driver. Uses 1ES pipeline templates for compliance.
70-
71-
### Stress Tests Pipeline (`stress-tests-pipeline.yml`)
72-
Optional pipeline for long-running stress and endurance testing. Enabled via `enableStressTests` parameter in CI core.
73-
74-
## Build Stages
75-
76-
1. **build_abstractions_package_stage**: Build and pack abstractions
77-
2. **build_sqlclient_package_stage**: Build main driver and AKV packages
78-
3. **build_azure_package_stage**: Build Azure extensions package
79-
4. **stress_tests_stage**: Optional stress testing
80-
5. **run_tests_stage**: Execute all test suites
4+
# Azure DevOps CI/CD Pipeline Guidelines
815

82-
## Test Configuration
6+
## Purpose
837

84-
### Test Sets
85-
Tests are divided into sets for parallelization:
86-
- `TestSet=1` — First partition of tests
87-
- `TestSet=2` — Second partition
88-
- `TestSet=3` — Third partition
89-
- `TestSet=AE` — Always Encrypted tests
90-
91-
### Test Filters
92-
Tests use category-based filtering. The default filter excludes both `failing` and `flaky` tests:
93-
```
94-
category!=failing&category!=flaky
95-
```
96-
97-
Category values:
98-
- `nonnetfxtests` — Excluded on .NET Framework
99-
- `nonnetcoreapptests` — Excluded on .NET Core
100-
- `nonwindowstests` — Excluded on Windows
101-
- `nonlinuxtests` — Excluded on Linux
102-
- `failing` — Known permanent failures (excluded from all runs)
103-
- `flaky` — Intermittently failing tests (quarantined, run separately)
104-
105-
### Flaky Test Quarantine in Pipelines
106-
Quarantined tests (`[Trait("Category", "flaky")]`) run in **separate pipeline steps** after the main test steps. This ensures:
107-
- Main test runs are **not blocked** by intermittent failures
108-
- Flaky tests are still **monitored** for regression or resolution
109-
- Code coverage is **not collected** for flaky test runs
110-
- Results appear in pipeline output for visibility
111-
112-
The quarantine steps are configured in:
113-
- `eng/pipelines/common/templates/steps/build-and-run-tests-netcore-step.yml`
114-
- `eng/pipelines/common/templates/steps/build-and-run-tests-netfx-step.yml`
115-
- `eng/pipelines/common/templates/steps/run-all-tests-step.yml`
116-
117-
### Test Timeout
118-
All test runs use `--blame-hang-timeout 10m` (configured in `build.proj`). Tests exceeding 10 minutes are killed and reported as failures.
119-
120-
### SNI Testing
121-
The `useManagedSNI` parameter controls testing with:
122-
- Native SNI (`false`) - Windows native library
123-
- Managed SNI (`true`) - Cross-platform managed implementation
8+
Rules and conventions for editing the Azure DevOps CI/CD pipelines that build, test, and validate Microsoft.Data.SqlClient. These pipelines live under `eng/pipelines/` (excluding `onebranch/`, which is covered by separate instructions).
1249

125-
## Variables
10+
**ADO Organization**: sqlclientdrivers | **ADO Project**: ADO.NET
11+
12+
## Pipeline Layout
13+
14+
Two categories of pipelines exist in this repository:
15+
16+
- **CI/PR pipelines** (`eng/pipelines/`) — Build, test, and validate on every push/PR
17+
- **OneBranch pipelines** (`eng/pipelines/onebranch/`) — Official signing/release builds (separate instructions file)
12618

127-
### Build Variables (`ci-build-variables.yml`)
128-
Common build configuration:
129-
- Package versions
130-
- Build paths
131-
- Signing configuration
19+
Top-level CI/PR pipeline files:
20+
- `dotnet-sqlclient-ci-core.yml` — Reusable core template; all CI and PR pipelines extend this
21+
- `dotnet-sqlclient-ci-package-reference-pipeline.yml` — CI with Package references (Release)
22+
- `dotnet-sqlclient-ci-project-reference-pipeline.yml` — CI with Project references (Release)
23+
- `sqlclient-pr-package-ref-pipeline.yml` — PR validation with Package references
24+
- `sqlclient-pr-project-ref-pipeline.yml` — PR validation with Project references
25+
- `stress/stress-tests-pipeline.yml` — Stress test pipeline and templates
13226

133-
### Runtime Variables
134-
Set via pipeline parameters or UI:
135-
- `Configuration` - Debug/Release
136-
- `Platform` - AnyCPU/x86/x64
137-
- `TF` - Target framework
27+
Reusable templates are organized under:
28+
- `common/templates/jobs/` — Job templates (`ci-build-nugets-job`, `ci-code-coverage-job`, `ci-run-tests-job`)
29+
- `common/templates/stages/` — Stage templates (`ci-run-tests-stage`)
30+
- `common/templates/steps/` — Step templates (build, test, config, publish)
31+
- `jobs/` — Package-specific CI jobs (pack/test Abstractions, Azure, Logging, stress)
32+
- `stages/` — Package-specific CI stages (generate secrets, build SqlServer/Logging/Abstractions/SqlClient/Azure, verify packages)
33+
- `libraries/` — Shared variables (`ci-build-variables.yml`)
34+
- `steps/` — SDK install steps
13835

139-
## Creating Pipeline Changes
36+
## CI Core Template
14037

141-
### Adding New Test Categories
142-
1. Add category attribute to tests: `[Category("newcategory")]`
143-
2. Update filter expressions in test job templates
144-
3. Document category purpose in test documentation
38+
`dotnet-sqlclient-ci-core.yml` is the central orchestrator. All CI and PR pipelines extend it with different parameters.
14539

146-
### Adding New Pipeline Parameters
147-
1. Define parameter in appropriate `.yml` file
148-
2. Add to parameter passing in calling templates
149-
3. Document in this file
40+
Key parameters:
41+
- `referenceType` (required) — `Package` or `Project`; controls how sibling packages are referenced
42+
- `buildConfiguration` (required) — `Debug` or `Release`
43+
- `testJobTimeout` (required) — test job timeout in minutes
44+
- `targetFrameworks` — Windows test TFMs; default `[net462, net8.0, net9.0, net10.0]`
45+
- `targetFrameworksUnix` — Unix test TFMs; default `[net8.0, net9.0, net10.0]`
46+
- `netcoreVersionTestUtils` — default runtime for shared test utilities; default `net10.0`
47+
- `testSets` — test partitions; default `[1, 2, 3]`
48+
- `useManagedSNI` — SNI variants to test; default `[false, true]`
49+
- `runAlwaysEncryptedTests` — include AE test set; default `true`
50+
- `runLegacySqlTests` — include SQL Server 2016/2017 manual-test legs; default `true`
51+
- `debug` — enable debug output; default `false`
52+
- `dotnetVerbosity` — MSBuild verbosity; default `normal`
15053

151-
### Modifying Build Steps
152-
1. Changes should be made in template files for reusability
153-
2. Test changes locally when possible
154-
3. Submit as PR - validation will run
54+
## Build Stage Order
15555

156-
## Best Practices
56+
Stages execute in dependency order (Package reference mode requires artifacts from prior stages):
57+
1. `generate_secrets` — Generate test secrets
58+
2. `build_sqlserver_package_stage` — Build `Microsoft.SqlServer.Server`
59+
3. `build_logging_package_stage` — Build Logging package
60+
4. `build_abstractions_package_stage` — Build Abstractions (package mode depends on Logging)
61+
5. `build_sqlclient_package_stage` — Build SqlClient and produce the AKV provider package
62+
6. `build_azure_package_stage` — Build Azure extensions
63+
7. `verify_nuget_packages_stage` — Verify NuGet package metadata
64+
8. `ci_run_tests_stage` — Run MDS and AKV test suites
15765

158-
### Template Design
159-
- Use templates for reusable definitions
160-
- Pass parameters explicitly (avoid global variables)
161-
- Use descriptive stage/job/step names
66+
Stress testing is no longer a stage threaded through `dotnet-sqlclient-ci-core.yml`; it lives under `eng/pipelines/stress/` as a separate pipeline flow.
16267

163-
### Variable Management
164-
- Use template variables for shared values
165-
- Use pipeline parameters for per-run configuration
166-
- Avoid hardcoding versions (use Directory.Packages.props)
68+
When adding a new build stage, respect the dependency graph and pass artifact names/versions to downstream stages.
16769

168-
### Test Infrastructure
169-
- Ensure tests are properly categorized
170-
- Handle test configuration files properly
171-
- Use test matrix for cross-platform coverage
70+
## PR vs CI Pipeline Differences
17271

173-
## Troubleshooting
72+
PR pipelines:
73+
- Trigger on PRs to `dev/*`, `feat/*`, `main`; exclude `eng/pipelines/onebranch/*` paths
74+
- Use reduced TFM matrix: `[net462, net8.0, net9.0]` (excludes net10.0)
75+
- Timeout: 90 minutes
76+
- Package-ref PR disables Always Encrypted tests in Debug config and also disables legacy SQL Server test legs to keep validation fast
17477

175-
### Common Issues
176-
1. **Test failures due to missing config**: Ensure `config.json` exists
177-
2. **Platform-specific failures**: Check platform exclusion categories
178-
3. **Timeout issues**: Increase `testJobTimeout` parameter
78+
CI pipelines:
79+
- Trigger on push to `main` (GitHub) and `internal/main` (ADO) with `batch: true`
80+
- Scheduled weekday builds (see individual pipeline files for cron times)
81+
- Full TFM matrix including net10.0 test legs and legacy SQL Server manual-test coverage
17982

180-
### Debugging Pipelines
181-
- Enable debug mode via `debug: true` parameter
182-
- Use `dotnetVerbosity: diagnostic` for detailed output
183-
- Check build logs in Azure DevOps
83+
## Test Configuration
84+
85+
Test partitioning:
86+
- Tests split into `TestSet=1`, `TestSet=2`, `TestSet=3` for parallelization
87+
- `TestSet=AE` — Always Encrypted tests (controlled by `runAlwaysEncryptedTests`)
88+
89+
Test filters — default excludes `failing` and `flaky` categories:
90+
- `failing` — known permanent failures, always excluded
91+
- `flaky` — intermittent failures, quarantined in separate pipeline steps
92+
- `nonnetfxtests` / `nonnetcoreapptests` — platform-specific exclusions
93+
- `nonwindowstests` / `nonlinuxtests` — OS-specific exclusions
18494

185-
## Security Considerations
95+
Flaky test quarantine:
96+
- Quarantined tests (`[Trait("Category", "flaky")]`) run in separate steps after main tests
97+
- Main test runs are not blocked by flaky failures
98+
- No code coverage collected for flaky runs
99+
- Configured in `common/templates/steps/build-and-run-tests-netcore-step.yml`, `build-and-run-tests-netfx-step.yml`, and `run-all-tests-step.yml`
186100

187-
- Pipelines use service connections for artifact publishing
188-
- Signing uses secure key vault integration
189-
- Sensitive configuration should use pipeline secrets
190-
- Never commit credentials in pipeline files
101+
SNI testing — `useManagedSNI` controls testing with native SNI (`false`) or managed SNI (`true`)
191102

192-
## Related Documentation
103+
Test timeout — `--blame-hang-timeout 10m` (configured in `build.proj` and threaded through CI test steps); tests exceeding 10 minutes are killed
104+
105+
## Variables
193106

194-
- [BUILDGUIDE.md](../../BUILDGUIDE.md) - Local build instructions
195-
- [Azure DevOps Documentation](https://learn.microsoft.com/azure/devops/pipelines/)
107+
- All CI build variables centralized in `libraries/ci-build-variables.yml`
108+
- Package versions use `-ci` suffix (e.g., `7.0.0.$(Build.BuildNumber)-ci`)
109+
- `assemblyBuildNumber` derived from first segment of `Build.BuildNumber` (16-bit safe)
110+
- `localFeedPath` = `$(Build.SourcesDirectory)/packages` — local NuGet feed for inter-package deps
111+
- `packagePath` = `$(Build.SourcesDirectory)/output` — NuGet pack output
112+
113+
## Conventions When Editing Pipelines
114+
115+
- Always use templates for reusable logic — do not inline complex steps
116+
- Pass parameters explicitly; avoid relying on global variables
117+
- Use descriptive stage/job/step display names
118+
- When adding parameters, define them in the core template and thread through calling pipelines
119+
- When adding test categories, update filter expressions in test step templates
120+
- PR pipelines should run a minimal matrix for fast feedback
121+
- Test changes via PR pipeline first — validation runs automatically
122+
- Enable `debug: true` and `dotnetVerbosity: diagnostic` for troubleshooting
123+
- Never commit credentials or secrets in pipeline files
124+
- Signing and release are handled by OneBranch pipelines — not these CI/PR pipelines

0 commit comments

Comments
 (0)