Skip to content

Commit 9192601

Browse files
committed
User Story 37654: Create Extensions base package
- Added empty Extensions package with some sample class and docs to demonstrate packaging. - Created CI stage to build, test, pack, and publish the Extensions NuGet package. - Updated downstream CI stages/jobs to use the Extensions package. - Updated build.proj Clean target to not delete packages/ dir.
1 parent 27aaa9e commit 9192601

29 files changed

+870
-129
lines changed

.editorconfig

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ indent_size = 4
1414
[*.{json,jsonc}]
1515
indent_size = 2
1616

17+
[*.{yml,yaml}]
18+
indent_size = 2
19+
1720
# C# files
1821
[*.cs]
1922
# New line preferences
@@ -160,7 +163,7 @@ indent_size = 2
160163
indent_size = 2
161164

162165
# Xml files
163-
[*.{xml,stylecop,resx,ruleset}]
166+
[*.{xml,stylecop,resx,ruleset,slnx}]
164167
indent_size = 2
165168

166169
# Xml config files

NuGet.config

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@
22
<configuration>
33
<packageSources>
44
<clear />
5-
<add key="sqlclient" value="https://sqlclientdrivers.pkgs.visualstudio.com/public/_packaging/sqlclient/nuget/v3/index.json" />
5+
<!-- We use a curated, vetted ADO feed for our dependencies. -->
6+
<add key="curated" value="https://sqlclientdrivers.pkgs.visualstudio.com/public/_packaging/sqlclient/nuget/v3/index.json" />
67
</packageSources>
78
<auditSources>
89
<clear />
10+
11+
<!-- There is no curated, vetted ADO feed for auditing, so we use the official source. -->
912
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
1013
</auditSources>
1114
</configuration>

build.proj

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151

5252
<!-- Populate all managed projects -->
5353
<ItemGroup>
54+
<ExtensionsPackage Include="src/Microsoft.Data.SqlClient.Extensions/Extensions/Extensions.slnx" />
5455
<SqlServerLib Include="**/Microsoft.SqlServer.Server.csproj" />
5556
<NetFxDriver Include="**/netfx/**/Microsoft.Data.SqlClient*.csproj" Condition="'$(IsEnabledWindows)' == 'true'" />
5657
<NetCoreDriver Include="**/netcore/**/Microsoft.Data.SqlClient*.csproj" />
@@ -92,6 +93,26 @@
9293
<Target Name="BuildTestsNetFx" DependsOnTargets="RestoreTestsNetFx;BuildAKVNetFx;BuildUnitTestsNetFx;BuildFunctionalTestsNetFx;BuildManualTestsNetFx" Condition="$(IsEnabledWindows) == 'true'"/>
9394
<Target Name="BuildTests" DependsOnTargets="BuildTestsNetCore;BuildTestsNetFx"/>
9495

96+
<!--
97+
The Extensions package must be built and packed into the packages/
98+
directory before the MDS projects can be restored.
99+
-->
100+
<Target Name="BuildExtensionsPackage">
101+
<PropertyGroup>
102+
<!--
103+
Omit the ExtensionsPackageVersion property entirely if it is empty.
104+
Otherwise, the command-line property will override the default value,
105+
even if empty.
106+
-->
107+
<BuildProperties Condition="'$(ExtensionsPackageVersion)' != ''">ExtensionsPackageVersion=$(ExtensionsPackageVersion)</BuildProperties>
108+
</PropertyGroup>
109+
110+
<MSBuild
111+
Projects="@(ExtensionsPackage)"
112+
Targets="Restore;Build;Pack"
113+
Properties="$(BuildProperties)" />
114+
</Target>
115+
95116
<Target Name="RestoreSqlServerLib">
96117
<MSBuild Projects="@(SqlServerLib)" Targets="restore" />
97118
</Target>
@@ -347,13 +368,17 @@
347368
<Exec ConsoleToMsBuild="true" Command="$(TestCommand)" />
348369
</Target>
349370

350-
<!-- Clean -->
371+
<!-- Clean all intermediate outputs. -->
351372
<Target Name="Clean">
352-
<RemoveDir Directories='$([System.IO.Directory]::GetDirectories(".","artifacts", SearchOption.AllDirectories))' />
353-
<RemoveDir Directories='$([System.IO.Directory]::GetDirectories(".","bin", SearchOption.AllDirectories))' />
354-
<RemoveDir Directories='$([System.IO.Directory]::GetDirectories(".","obj", SearchOption.AllDirectories))' />
355-
<RemoveDir Directories='$([System.IO.Directory]::GetDirectories(".","packages", SearchOption.AllDirectories))' />
356-
<RemoveDir Directories='$([System.IO.Directory]::GetDirectories(".",".nuget", SearchOption.AllDirectories))' />
373+
<RemoveDir Directories='$([System.IO.Directory]::GetDirectories(".", "artifacts", SearchOption.AllDirectories))' />
374+
<RemoveDir Directories='$([System.IO.Directory]::GetDirectories(".", "bin", SearchOption.AllDirectories))' />
375+
<RemoveDir Directories='$([System.IO.Directory]::GetDirectories(".", "obj", SearchOption.AllDirectories))' />
376+
<RemoveDir Directories='$([System.IO.Directory]::GetDirectories(".", ".nuget", SearchOption.AllDirectories))' />
377+
</Target>
378+
379+
<!-- Clean all outputs, including NuGet packages. -->
380+
<Target Name="CleanAll" DependsOnTargets="Clean">
381+
<RemoveDir Directories='$([System.IO.Directory]::GetDirectories(".", "packages", SearchOption.AllDirectories))' />
357382
</Target>
358383

359384
<!-- AKV Targets ========================================================= -->

eng/pipelines/common/templates/jobs/ci-build-nugets-job.yml

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,13 @@ parameters:
1212
type: string
1313
default: ADO-MMS22-SQL19
1414

15-
- name: artifactName
15+
- name: extensionsArtifactName
1616
type: string
17-
default: Artifacts
17+
default: Extensions.Artifact
18+
19+
- name: mdsArtifactName
20+
type: string
21+
default: MDS.Artifact
1822

1923
- name: platform
2024
type: string
@@ -28,6 +32,11 @@ parameters:
2832
type: stepList
2933
default: []
3034

35+
- name: extensionsPackageVersion
36+
displayName: Extensions Package Version Override
37+
type: string
38+
default: ''
39+
3140
jobs:
3241
- job: build_nugets
3342

@@ -44,12 +53,22 @@ jobs:
4453
- ${{ if ne(parameters.prebuildSteps, '') }}:
4554
- ${{ parameters.prebuildSteps }} # extra steps to run before the build like downloading sni and the required configuration
4655

56+
# Download the Extensions package artifacts and put them in the packages/
57+
# directory in the repo root. This is where the MDS NuGet.config file will
58+
# look for local packages.
59+
- task: DownloadPipelineArtifact@2
60+
displayName: Download Extensions Package Artifact
61+
inputs:
62+
artifactName: ${{ parameters.extensionsArtifactName }}
63+
targetPath: $(Build.SourcesDirectory)/packages
64+
4765
- template: ../steps/ci-project-build-step.yml@self
4866
parameters:
4967
platform: ${{ parameters.platform }}
5068
configuration: ${{ parameters.configuration }}
5169
operatingSystem: Windows
5270
build: all
71+
extensionsPackageVersion: ${{parameters.extensionsPackageVersion}}
5372

5473
- template: ../steps/generate-nuget-package-step.yml@self
5574
parameters:
@@ -70,8 +89,8 @@ jobs:
7089
installNuget: false
7190
displayName: 'Generate NuGet package AKV Provider'
7291

73-
- task: PublishBuildArtifacts@1
74-
displayName: 'Publish Artifact: Artifacts'
92+
- task: PublishPipelineArtifact@1
93+
displayName: 'Publish Pipeline Artifact'
7594
inputs:
76-
PathtoPublish: $(packagePath)
77-
ArtifactName: ${{ parameters.artifactName }}
95+
targetPath: $(packagePath)
96+
artifactName: ${{ parameters.mdsArtifactName }}

eng/pipelines/common/templates/jobs/ci-run-tests-job.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,18 @@ parameters:
2929
type: object
3030
default: {} # - key: 'value'
3131

32+
- name: extensionsPackageVersion
33+
displayName: Extensions Package Version Override
34+
type: string
35+
default: ''
36+
3237
- name: prebuildSteps
3338
type: stepList
3439
default: []
3540

36-
- name: artifactName
41+
- name: extensionsArtifactName
3742
type: string
38-
default: Artifacts
43+
default: Extensions.Artifact
3944

4045
- name: targetFramework
4146
type: string
@@ -89,6 +94,16 @@ jobs:
8994
value: '$(dotnetx86Path)'
9095

9196
steps:
97+
98+
# Download the Extensions package artifacts and put them in the packages/
99+
# directory in the repo root. This is where the MDS NuGet.config file will
100+
# look for local packages.
101+
- task: DownloadPipelineArtifact@2
102+
displayName: Download Extensions Package Artifact
103+
inputs:
104+
artifactName: ${{ parameters.extensionsArtifactName }}
105+
targetPath: $(Build.SourcesDirectory)/packages
106+
92107
- ${{ if ne(parameters.prebuildSteps, '') }}:
93108
- ${{ parameters.prebuildSteps }} # extra steps to run before the build like downloading sni and the required configuration
94109

@@ -220,6 +235,7 @@ jobs:
220235
targetFramework: ${{ parameters.targetFramework }}
221236
referenceType: ${{ parameters.buildType }}
222237
testSet: ${{ parameters.testSet }}
238+
extensionsPackageVersion: ${{ parameters.extensionsPackageVersion }}
223239
${{ if ne(parameters.operatingSystem, 'Windows') }}:
224240
OSGroup: Unix
225241

eng/pipelines/common/templates/stages/ci-run-tests-stage.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ parameters:
1212
type: object
1313

1414
- name: dependsOn
15-
type: string
16-
default: ''
15+
type: object
16+
default: []
1717

1818
- name: buildType
1919
displayName: 'Build Type'
@@ -22,6 +22,11 @@ parameters:
2222
- Project
2323
- Package
2424

25+
- name: extensionsPackageVersion
26+
displayName: Extensions Package Version Override
27+
type: string
28+
default: ''
29+
2530
- name: prebuildSteps
2631
type: stepList
2732
default: []
@@ -34,10 +39,7 @@ stages:
3439
- ${{ each config in parameters.testConfigurations }}:
3540
- ${{ each image in config.value.images }}:
3641
- stage: ${{ image.key }}
37-
${{ if ne(parameters.dependsOn, '') }}:
38-
dependsOn: ${{ parameters.dependsOn }}
39-
${{ else }}:
40-
dependsOn: []
42+
dependsOn: ${{ parameters.dependsOn }}
4143
jobs:
4244
- ${{ each targetFramework in config.value.TargetFrameworks }}:
4345
- ${{ each platform in config.value.buildPlatforms }}:
@@ -52,6 +54,7 @@ stages:
5254
image: ${{ image.value }}
5355
jobDisplayName: ${{ format('{0}_{1}_{2}', replace(targetFramework, '.', '_'), platform, testSet) }}
5456
configProperties: ${{ config.value.configProperties }}
57+
extensionsPackageVersion: ${{ parameters.extensionsPackageVersion }}
5558
prebuildSteps: ${{ parameters.prebuildSteps }}
5659
targetFramework: ${{ targetFramework }}
5760
netcoreVersionTestUtils: ${{config.value.netcoreVersionTestUtils }}
@@ -81,6 +84,7 @@ stages:
8184
jobDisplayName: ${{ format('{0}_{1}_{2}_{3}', replace(targetFramework, '.', '_'), platform, 'NativeSNI', testSet) }}
8285
configProperties: ${{ config.value.configProperties }}
8386
useManagedSNI: ${{ useManagedSNI }}
87+
extensionsPackageVersion: ${{ parameters.extensionsPackageVersion }}
8488
prebuildSteps: ${{ parameters.prebuildSteps }}
8589
targetFramework: ${{ targetFramework }}
8690
netcoreVersionTestUtils: ${{config.value.netcoreVersionTestUtils }}

eng/pipelines/common/templates/steps/build-all-tests-step.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ parameters:
3232
- name: testSet
3333
type: string
3434

35+
- name: extensionsPackageVersion
36+
displayName: Extensions Package Version Override
37+
type: string
38+
default: ''
39+
3540
steps:
3641
- ${{ if contains(parameters.targetFramework, 'net4') }}: # .NET Framework
3742
- task: MSBuild@1
@@ -40,7 +45,7 @@ steps:
4045
solution: build.proj
4146
platform: '${{parameters.platform }}'
4247
configuration: '${{parameters.configuration }}'
43-
msbuildArguments: '-t:BuildTestsNetFx -p:TF=${{parameters.targetFramework }} -p:TestSet=${{parameters.testSet }} -p:ReferenceType=${{parameters.referenceType }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.nugetPackageVersion }}'
48+
msbuildArguments: '-t:BuildTestsNetFx -p:TF=${{parameters.targetFramework }} -p:TestSet=${{parameters.testSet }} -p:ReferenceType=${{parameters.referenceType }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.nugetPackageVersion }} -p:ExtensionsPackageVersion=${{ parameters.extensionsPackageVersion }}.$(Build.BuildNumber)'
4449

4550
# - ${{else if contains(parameters.targetFramework, 'netstandard')}}: # .NET Standard
4651
# - task: MSBuild@1
@@ -59,7 +64,7 @@ steps:
5964
solution: build.proj
6065
platform: '${{parameters.platform }}'
6166
configuration: '${{parameters.configuration }}'
62-
msbuildArguments: '-t:BuildTestsNetCore -p:TF=${{parameters.targetFramework }} -p:TestSet=${{parameters.testSet }} -p:ReferenceType=${{parameters.referenceType }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.nugetPackageVersion }}'
67+
msbuildArguments: '-t:BuildTestsNetCore -p:TF=${{parameters.targetFramework }} -p:TestSet=${{parameters.testSet }} -p:ReferenceType=${{parameters.referenceType }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.nugetPackageVersion }} -p:ExtensionsPackageVersion=${{ parameters.extensionsPackageVersion }}.$(Build.BuildNumber)'
6368
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
6469

6570
- ${{ else }}: # .NET on Unix
@@ -69,7 +74,7 @@ steps:
6974
command: custom
7075
projects: build.proj
7176
custom: msbuild
72-
arguments: '-t:BuildTestsNetCore -p:TF=${{parameters.targetFramework }} -p:TestSet=${{parameters.testSet }} -p:ReferenceType=${{parameters.referenceType }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.nugetPackageVersion }} -p:OSGroup=${{parameters.OSGroup }} -p:platform=${{parameters.platform }} -p:Configuration=${{parameters.configuration }}'
77+
arguments: '-t:BuildTestsNetCore -p:TF=${{parameters.targetFramework }} -p:TestSet=${{parameters.testSet }} -p:ReferenceType=${{parameters.referenceType }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.nugetPackageVersion }} -p:OSGroup=${{parameters.OSGroup }} -p:platform=${{parameters.platform }} -p:Configuration=${{parameters.configuration }} -p:ExtensionsPackageVersion=${{ parameters.extensionsPackageVersion }}.$(Build.BuildNumber)'
7378
verbosityRestore: Detailed
7479
verbosityPack: Detailed
7580
condition: and(succeeded(), ne(variables['Agent.OS'], 'Windows_NT'))

eng/pipelines/common/templates/steps/ci-prebuild-step.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ parameters:
1919
- Project
2020
- Package
2121

22+
- name: extensionsPackageVersion
23+
displayName: Extensions Package Version Override
24+
type: string
25+
default: ''
26+
2227
steps:
2328
- template: ensure-dotnet-version.yml
2429
parameters:
@@ -50,8 +55,10 @@ steps:
5055
parameters:
5156
downloadedNugetPath: $(Pipeline.Workspace)\${{parameters.artifactName }}
5257
debug: ${{ parameters.debug }}
58+
extensionsPackageVersion: ${{ parameters.extensionsPackageVersion }}
5359

5460
- ${{ else }}: # project
5561
- template: ci-project-build-step.yml@self
5662
parameters:
5763
build: allNoDocs
64+
extensionsPackageVersion: ${{parameters.extensionsPackageVersion}}

eng/pipelines/common/templates/steps/ci-project-build-step.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ parameters:
3434
- all
3535
- allNoDocs
3636

37+
- name: extensionsPackageVersion
38+
displayName: Extensions Package Version Override
39+
type: string
40+
default: ''
41+
3742
steps:
3843
- template: ./ensure-dotnet-version.yml@self
3944
parameters:
@@ -53,7 +58,7 @@ steps:
5358
inputs:
5459
solution: build.proj
5560
msbuildArchitecture: x64
56-
msbuildArguments: '-t:restore'
61+
msbuildArguments: '-t:restore -p:ExtensionsPackageVersion=${{parameters.extensionsPackageVersion}}.${{parameters.buildNumber}}'
5762
retryCountOnTaskFailure: 1
5863

5964
- ${{ if eq(parameters.build, 'allNoDocs') }}:
@@ -65,7 +70,7 @@ steps:
6570
msbuildArchitecture: x64
6671
platform: '${{ parameters.platform }}'
6772
configuration: '${{ parameters.configuration }}'
68-
msbuildArguments: '-t:BuildAllConfigurations -p:GenerateDocumentationFile=false -p:GenerateNuGet=false -p:BuildNumber=${{ parameters.buildNumber }}'
73+
msbuildArguments: '-t:BuildAllConfigurations -p:GenerateDocumentationFile=false -p:GenerateNuGet=false -p:BuildNumber=${{ parameters.buildNumber }} -p:ExtensionsPackageVersion=${{parameters.extensionsPackageVersion}}.${{parameters.buildNumber}}'
6974
clean: true
7075

7176
- ${{ if or(eq(parameters.build, 'MDS'), eq(parameters.build, 'all')) }}:
@@ -77,7 +82,7 @@ steps:
7782
msbuildArchitecture: x64
7883
platform: '${{ parameters.platform }}'
7984
configuration: '${{ parameters.configuration }}'
80-
msbuildArguments: '-t:BuildAllConfigurations -p:GenerateNuGet=false -p:BuildNumber=${{ parameters.buildNumber }}'
85+
msbuildArguments: '-t:BuildAllConfigurations -p:GenerateNuGet=false -p:BuildNumber=${{ parameters.buildNumber }} -p:ExtensionsPackageVersion=${{parameters.extensionsPackageVersion}}.${{parameters.buildNumber}}'
8186
clean: true
8287

8388
- ${{ if or(eq(parameters.build, 'AKV'), eq(parameters.build, 'all'), eq(parameters.build, 'allNoDocs')) }}:
@@ -89,7 +94,7 @@ steps:
8994
msbuildArchitecture: x64
9095
platform: '${{ parameters.platform }}'
9196
configuration: '${{ parameters.configuration }}'
92-
msbuildArguments: '-t:BuildAKVNetFx -p:BuildNumber=${{ parameters.buildNumber }}'
97+
msbuildArguments: '-t:BuildAKVNetFx -p:BuildNumber=${{ parameters.buildNumber }} -p:ExtensionsPackageVersion=${{parameters.extensionsPackageVersion}}.${{parameters.buildNumber}}'
9398

9499
- task: MSBuild@1
95100
displayName: 'Build AKV Provider NetCore All OS [Win]'
@@ -99,7 +104,7 @@ steps:
99104
msbuildArchitecture: x64
100105
platform: '${{ parameters.platform }}'
101106
configuration: '${{ parameters.configuration }}'
102-
msbuildArguments: '-t:BuildAKVNetCoreAllOS -p:BuildNumber=${{ parameters.buildNumber }}'
107+
msbuildArguments: '-t:BuildAKVNetCoreAllOS -p:BuildNumber=${{ parameters.buildNumber }} -p:ExtensionsPackageVersion=${{parameters.extensionsPackageVersion}}.${{parameters.buildNumber}}'
103108

104109
- ${{ if or(eq(parameters.operatingSystem, 'Linux'), eq(parameters.operatingSystem, 'MacOS'), eq(parameters.operatingSystem, 'deferedToRuntime')) }}:
105110
- task: DotNetCoreCLI@2
@@ -109,7 +114,7 @@ steps:
109114
command: custom
110115
projects: build.proj
111116
custom: msbuild
112-
arguments: '-t:BuildAll -p:TestEnabled=true -p:GenerateDocumentationFile=false -p:configuration=${{ parameters.configuration }}'
117+
arguments: '-t:BuildAll -p:TestEnabled=true -p:GenerateDocumentationFile=false -p:configuration=${{ parameters.configuration }} -p:ExtensionsPackageVersion=${{parameters.extensionsPackageVersion}}.${{parameters.buildNumber}}'
113118
verbosityRestore: Detailed
114119
verbosityPack: Detailed
115120
retryCountOnTaskFailure: 1

0 commit comments

Comments
 (0)