Skip to content

Commit ee71014

Browse files
Use logging package for azure and abstractions (#3982)
1 parent ba6087d commit ee71014

12 files changed

Lines changed: 326 additions & 277 deletions

.github/instructions/onebranch-pipeline-design.instructions.md

Lines changed: 44 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ Both pipelines use the **OneBranch (1ES) governed template** infrastructure and
2424
|---|---------|-------------|
2525
| 1 | `Microsoft.SqlServer.Server` ||
2626
| 2 | `Microsoft.Data.SqlClient.Extensions.Logging` ||
27-
| 3 | `Microsoft.Data.SqlClient.Extensions.Abstractions` | |
27+
| 3 | `Microsoft.Data.SqlClient.Extensions.Abstractions` | `Extensions.Logging` |
2828
| 4 | `Microsoft.Data.SqlClient` | `Extensions.Logging`, `Extensions.Abstractions` |
29-
| 5 | `Microsoft.Data.SqlClient.Extensions.Azure` | `Extensions.Abstractions` |
29+
| 5 | `Microsoft.Data.SqlClient.Extensions.Azure` | `Extensions.Abstractions`, `Extensions.Logging` |
3030
| 6 | `Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider` | `SqlClient`, `Extensions.Logging` |
3131

3232
---
@@ -38,8 +38,8 @@ sequenceDiagram
3838
participant T as Trigger / User
3939
participant P as Pipeline Orchestrator
4040
participant B1a as Job: Build Extensions.Logging
41-
participant B1b as Job: Build Extensions.Abstractions
4241
participant B1c as Job: Build SqlServer.Server
42+
participant B1b as Job: Build Extensions.Abstractions
4343
participant B2a as Job: Build SqlClient
4444
participant B2b as Job: Build Extensions.Azure
4545
participant V as Job: Validate MDS Package
@@ -55,29 +55,32 @@ sequenceDiagram
5555
par Stage 1 jobs (parallel)
5656
P->>B1a: Build DLLs → ESRP sign DLLs → Pack → ESRP sign NuGet (Logging)
5757
B1a-->>P: ✅ Signed .nupkg
58-
and
59-
P->>B1b: Build DLLs → ESRP sign DLLs → Pack → ESRP sign NuGet (Abstractions)
60-
B1b-->>P: ✅ Signed .nupkg
6158
and
6259
P->>B1c: Build + ESRP sign + pack SqlServer.Server
6360
B1c-->>P: ✅ Signed .nupkg
6461
end
6562
66-
Note over P: Stage 2 — buildMDS (dependsOn: build_independent)
63+
Note over P: Stage 2 — build_abstractions (dependsOn: build_independent)
64+
65+
P->>B1b: Build DLLs → ESRP sign DLLs → Pack → ESRP sign NuGet (Abstractions)
66+
Note right of B1b: Downloads: Extensions.Logging artifact
67+
B1b-->>P: ✅ Signed .nupkg
6768
68-
par Stage 2 jobs (parallel)
69+
Note over P: Stage 3 — build_dependent (dependsOn: build_abstractions)
70+
71+
par Stage 3 jobs (parallel)
6972
P->>B2a: Build + ESRP sign + pack SqlClient
7073
Note right of B2a: Downloads: Extensions.Logging,<br/>Extensions.Abstractions artifacts
7174
B2a-->>P: ✅ Signed .nupkg + .snupkg
7275
and
7376
P->>B2b: Build DLLs → ESRP sign DLLs → Pack → ESRP sign NuGet (Azure)
74-
Note right of B2b: Downloads:<br/>Extensions.Abstractions artifact
77+
Note right of B2b: Downloads: Extensions.Abstractions,<br/>Extensions.Logging artifacts
7578
B2b-->>P: ✅ Signed .nupkg
7679
end
7780
78-
Note over P: Validation + Stage 3 (both dependsOn: buildMDS, run in parallel)
81+
Note over P: Validation + Stage 4 (both dependsOn: build_dependent, run in parallel)
7982
80-
par Validation and Stage 3 (parallel)
83+
par Validation and Stage 4 (parallel)
8184
P->>V: Validate signed MDS package
8285
V-->>P: ✅ Package validation passed
8386
and
@@ -107,62 +110,72 @@ sequenceDiagram
107110

108111
### 4.1 Build Phase
109112

110-
The build phase runs automatically on every CI trigger, scheduled run, or manual queue. It is divided into three build stages plus a validation stage, based on the dependency graph.
113+
The build phase runs automatically on every CI trigger, scheduled run, or manual queue. It is divided into four build stages plus a validation stage, based on the dependency graph.
111114

112115
#### Stage 1 — `build_independent`: Independent Packages (no dependencies)
113116

114117
| Job Template | Package | Build Target | Condition |
115118
|--------------|---------|--------------|-----------|
116119
| `build-signed-csproj-package-job.yml` | `Microsoft.Data.SqlClient.Extensions.Logging` | `BuildLogging` / `PackLogging` | `buildAKVProvider OR buildSqlClient` |
117-
| `build-signed-csproj-package-job.yml` | `Microsoft.Data.SqlClient.Extensions.Abstractions` | `BuildAbstractions` / `PackAbstractions` | `buildSqlClient` |
118120
| `build-signed-csproj-package-job.yml` | `Microsoft.SqlServer.Server` | `PackSqlServer` | `buildSqlServerServer` |
119121

120122
- **`dependsOn`**: none
121123
- **Parallelism**: Jobs run in parallel (depending on which are enabled)
122124
- **Conditional builds**: Each job is wrapped with compile-time `${{ if }}` conditionals based on build parameters
123125
- csproj-based jobs (`build-signed-csproj-package-job.yml`) perform: **Build DLLs → ESRP DLL signing → NuGet pack (NoBuild=true) → ESRP NuGet signing** → publish artifact
124126

125-
#### Stage 2 — `buildMDS`: Core Packages (depend on Stage 1)
127+
#### Stage 2 — `build_abstractions`: Abstractions Package (depends on Stage 1)
126128

127129
| Job Template | Package | Build Target | Artifact Dependencies |
128130
|--------------|---------|--------------|----------------------|
129-
| `build-signed-package-job.yml` | `Microsoft.Data.SqlClient` | *(nuspec-based)* | `Extensions.Logging`, `Extensions.Abstractions` |
130-
| `build-signed-csproj-package-job.yml` | `Microsoft.Data.SqlClient.Extensions.Azure` | `BuildAzure` / `PackAzure` | `Extensions.Abstractions` |
131+
| `build-signed-csproj-package-job.yml` | `Microsoft.Data.SqlClient.Extensions.Abstractions` | `BuildAbstractions` / `PackAbstractions` | `Extensions.Logging` |
131132

132133
- **Stage condition**: `buildSqlClient = true` (entire stage is excluded when false)
133134
- **`dependsOn`**: `build_independent`
135+
- Downloads `Microsoft.Data.SqlClient.Extensions.Logging.nupkg` (from Stage 1) pipeline artifact
136+
137+
#### Stage 3 — `build_dependent`: Core Packages (depend on Stage 2)
138+
139+
| Job Template | Package | Build Target | Artifact Dependencies |
140+
|--------------|---------|--------------|----------------------|
141+
| `build-signed-package-job.yml` | `Microsoft.Data.SqlClient` | *(nuspec-based)* | `Extensions.Logging`, `Extensions.Abstractions` |
142+
| `build-signed-csproj-package-job.yml` | `Microsoft.Data.SqlClient.Extensions.Azure` | `BuildAzure` / `PackAzure` | `Extensions.Abstractions`, `Extensions.Logging` |
143+
144+
- **Stage condition**: `buildSqlClient = true` (entire stage is excluded when false)
145+
- **`dependsOn`**: `build_abstractions`
134146
- **Parallelism**: Both jobs run in parallel
135147
- The MDS (SqlClient) job also publishes symbol packages (`.snupkg`) when `publishSymbols` is true
136148
- All jobs configure APIScan with job-level `ob_sdl_apiscan_*` variables targeting package-specific folders
137149

138-
#### Stage 3`build_addons`: Add-on Packages (depend on Stage 2)
150+
#### Stage 4`build_addons`: Add-on Packages (depend on Stage 3)
139151

140152
| Job Template | Package | Artifact Dependencies |
141153
|--------------|---------|----------------------|
142154
| `build-akv-official-job.yml` | `Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider` | `SqlClient`, `Extensions.Logging` |
143155

144156
- **Stage condition**: `buildAKVProvider AND buildSqlClient` (both must be true)
145-
- **`dependsOn`**: `buildMDS`
146-
- Downloads `Microsoft.Data.SqlClient.nupkg` (from Stage 2) and `Microsoft.Data.SqlClient.Extensions.Logging.nupkg` (from Stage 1) pipeline artifacts
157+
- **`dependsOn`**: `build_dependent`
158+
- Downloads `Microsoft.Data.SqlClient.nupkg` (from Stage 3) and `Microsoft.Data.SqlClient.Extensions.Logging.nupkg` (from Stage 1) pipeline artifacts
147159
- Uses separate ESRP signing credentials (`Signing`-prefixed variables from `esrp-variables-v2` group)
148160

149161
### 4.2 Validation Stage — `mds_package_validation`
150162

151-
Validates the signed MDS (SqlClient) package after Stage 2 completes.
163+
Validates the signed MDS (SqlClient) package after Stage 3 completes.
152164

153165
- **Stage condition**: `buildSqlClient = true`
154-
- **`dependsOn`**: `buildMDS`
155-
- Runs in parallel with Stage 3 (`build_addons`)
166+
- **`dependsOn`**: `build_dependent`
167+
- Runs in parallel with Stage 4 (`build_addons`)
156168
- Uses `validate-signed-package-job.yml` template
157-
- Downloads the `drop_buildMDS_build_signed_package` artifact and validates against `CurrentNetFxVersion` (default: `net462`)
169+
- Downloads the `drop_build_dependent_build_signed_package` artifact and validates against `CurrentNetFxVersion` (default: `net462`)
158170

159171
### 4.3 Release Phase — `release`
160172

161173
The release stage is gated and only executes on demand when at least one release parameter is set to `true` at queue time.
162174

163175
- **`dependsOn`**: Conditional based on which build stages are enabled:
164-
- `build_independent` (always)
165-
- `buildMDS`, `mds_package_validation` (when `buildSqlClient = true`)
176+
- `build_independent` (when releasing SqlServer.Server or Logging)
177+
- `build_abstractions` (when releasing Abstractions)
178+
- `build_dependent`, `mds_package_validation` (when `buildSqlClient = true`)
166179
- `build_addons` (when `buildAKVProvider AND buildSqlClient`)
167180
- **Gate**: ADO Environment approvals (official pipeline only):
168181
- Official: `NuGet-Production` environment with configured approvals
@@ -186,11 +199,11 @@ The release stage is gated and only executes on demand when at least one release
186199

187200
| Package | Artifact Name | Publish Job |
188201
|---------|---------------|-------------|
189-
| `Microsoft.SqlServer.Server` | `drop_build_independent_build_signed_sqlserver_package` | `publish_SqlServer_Server` |
190-
| `Microsoft.Data.SqlClient.Extensions.Logging` | `drop_build_independent_build_signed_Logging_package` | `publish_Logging` |
191-
| `Microsoft.Data.SqlClient.Extensions.Abstractions` | `drop_build_independent_build_signed_Abstractions_package` | `publish_Abstractions` |
192-
| `Microsoft.Data.SqlClient` | `drop_buildMDS_build_signed_package` | `publish_SqlClient` |
193-
| `Microsoft.Data.SqlClient.Extensions.Azure` | `drop_buildMDS_build_signed_Azure_package` | `publish_Extensions_Azure` |
202+
| `Microsoft.SqlServer.Server` | `drop_build_independent_build_package_SqlServer` | `publish_SqlServer_Server` |
203+
| `Microsoft.Data.SqlClient.Extensions.Logging` | `drop_build_independent_build_package_Logging` | `publish_Logging` |
204+
| `Microsoft.Data.SqlClient.Extensions.Abstractions` | `drop_build_abstractions_build_package_Abstractions` | `publish_Abstractions` |
205+
| `Microsoft.Data.SqlClient` | `drop_build_dependent_build_package_SqlClient` | `publish_SqlClient` |
206+
| `Microsoft.Data.SqlClient.Extensions.Azure` | `drop_build_dependent_build_package_Azure` | `publish_Extensions_Azure` |
194207
| `Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider` | `drop_build_addons_buildSignedAkvPackage` | `publish_AKVProvider` |
195208

196209
Each publish job uses the reusable `publish-nuget-package-job.yml` template, which downloads the artifact and pushes `.nupkg`/`.snupkg` files via `NuGetCommand@2` with an external feed service connection.
@@ -442,7 +455,7 @@ Each job copies its signed DLLs and PDBs to a package-specific folder under `$(B
442455
## 9. Artifact Strategy
443456

444457
- Each build job publishes its output as a **pipeline artifact** managed by OneBranch's `ob_outputDirectory` convention.
445-
- Artifact names follow the OneBranch auto-generated pattern: `drop_<stageName>_<jobName>` (e.g., `drop_buildMDS_build_signed_package`).
458+
- Artifact names follow the OneBranch auto-generated pattern: `drop_<stageName>_<jobName>` (e.g., `drop_build_dependent_build_package_SqlClient`).
446459
- Downstream stages use `DownloadPipelineArtifact@2` to pull required packages into a local directory.
447460
- A local NuGet source is configured at build time pointing to the downloaded artifacts directory so `dotnet restore` resolves internal dependencies.
448461

BUILDGUIDE.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,17 @@ The following build targets are defined in `build.proj`:
6565

6666
|Target|Description|
6767
|-|-|
68-
|`BuildAbstractions`|Restore, build, and pack the Abstractions package, publishing the resulting NuGet into `packages/`.|
68+
|`BuildAbstractions`|Restore and build the Abstractions package.|
6969
|`BuildAllConfigurations`|Default target. Builds the .NET Framework and .NET drivers for all target frameworks and operating systems.|
70-
|`BuildAzure`|Restore, build, and pack the Azure package, publishing the resulting NuGet into `packages/`.|
70+
|`BuildAzure`|Restore and build the Azure package.|
71+
|`BuildLogging`|Restore and build the Logging package.|
7172
|`BuildNetCore`|Builds the .NET driver for all target frameworks.|
7273
|`BuildNetCoreAllOS`|Builds the .NET driver for all target frameworks and operating systems.|
7374
|`BuildNetFx`|Builds the .NET Framework driver for all target frameworks.|
7475
|`Clean`|Cleans all generated files.|
76+
|`PackAbstractions`|Pack the Abstractions NuGet package into `packages/`. Requires `BuildAbstractions` first.|
77+
|`PackAzure`|Pack the Azure NuGet package into `packages/`. Requires `BuildAzure` first.|
78+
|`PackLogging`|Pack the Logging NuGet package into `packages/`. Requires `BuildLogging` first.|
7579
|`Restore`|Restores NuGet packages.|
7680
|`RunTests`|Runs the unit, functional, and manual tests for the .NET Framework and .NET drivers|
7781
|`RunUnitTests`|Runs just the unit tests for the .NET Framework and .NET drivers|
@@ -188,8 +192,12 @@ packages in the root packages/ directory, and will be automatically searched by
188192
Then, you can specify `Package` references be used, for example:
189193

190194
```bash
191-
dotnet build -t:BuildAbstractions
195+
dotnet build -t:BuildLogging
196+
dotnet build -t:PackLogging
197+
dotnet build -t:BuildAbstractions -p:ReferenceType=Package
198+
dotnet build -t:PackAbstractions -p:ReferenceType=Package
192199
dotnet build -t:BuildAzure -p:ReferenceType=Package
200+
dotnet build -t:PackAzure -p:ReferenceType=Package
193201
dotnet build -t:BuildAll -p:ReferenceType=Package
194202
dotnet build -t:BuildAKVNetCore -p:ReferenceType=Package
195203
dotnet build -t:GenerateMdsPackage

build.proj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,14 +160,14 @@
160160
</AbstractionsProperties>
161161
</PropertyGroup>
162162

163-
<Target Name="RestoreAbstractions">
163+
<Target Name="RestoreAbstractions" DependsOnTargets="RestoreLogging">
164164
<MSBuild
165165
Projects="@(Abstractions)"
166166
Targets="Restore"
167167
Properties="$(AbstractionsProperties)" />
168168
</Target>
169169

170-
<Target Name="BuildAbstractions" DependsOnTargets="RestoreAbstractions">
170+
<Target Name="BuildAbstractions" DependsOnTargets="RestoreAbstractions;BuildLogging">
171171
<MSBuild
172172
Projects="@(Abstractions)"
173173
Targets="Build"

0 commit comments

Comments
 (0)