Skip to content

Commit f217d82

Browse files
authored
Official Build Cleanup (#4123)
* Cleanup step parameters * Parameter work for build-signed-csproj-package-job.yml: * Drop buildConfiguration parameter * Introduce symbols parameters * Signing parameters with prefix * Forward parameter defaults from build-signed-csproj-package-job to build-stages.yml * Forward default values for symbols/signing parameters in build-stages.yml to parameters. * Delete debug param from build-stages.yml Forward default values to parameters on sqlclient-non-official.yml and sqlclient-official.yml * Don't nest variables files. * Do not import variables templates outside of the pipeline root * OneBranch variable libraries moved to onebranch-variables.yml Replace old libraries with new libraries Replace old library references with new library references * Project for manintaining the pipelines folder * Parameterize package versions from the pipeline to the stages * Store "effective" package versions in new, parameterized variables file * Parameterize the artifact names * Parameterize the assembly versions * Parameterize the mds validation job * Sweep remaining $() references that are not to well-known variables. * Remove unused variables and cleanup remaining variables * Cleanup SDL parameters * AKVProvider -> AkvProvider * MDS -> SqlClient
1 parent a3172b1 commit f217d82

21 files changed

Lines changed: 985 additions & 796 deletions

eng/pipelines/Pipelines.csproj

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<!--
3+
This is an ultra-hack. We have a lot of files in the /eng/pipelines directory, and it would be
4+
nice to manage these inside an IDE. However, MSBuild doesn't have a good solution for including
5+
recursive folder trees of non-compilable files, with the only solution to be manually adding
6+
each file as a linked file in the solution. This is a terrible situation because it means each
7+
time a file is added or removed from this folder, it must be manually updated in the solution.
8+
It is also the case that most engineers forget to do this step, and it comes down to more
9+
diligent engineers to keep the pipelines folder up to date. Well, the diligent engineers have
10+
had enough and are tired of doing it.
11+
12+
So, this project was added as a way to automatically keep the pipelines directory up-to-date in
13+
the solution. It is *not built* in any configuration, and exists purely to collect all files
14+
under the /eng/pipelines folder.
15+
16+
No changes should be made to this project, perhaps updating the TargetFramework property if
17+
the framework specified goes out of support.
18+
-->
19+
20+
<PropertyGroup>
21+
<TargetFramework>net10.0</TargetFramework>
22+
<NoBuild>true</NoBuild>
23+
</PropertyGroup>
24+
25+
<ItemGroup>
26+
<None Include="**/*" />
27+
</ItemGroup>
28+
</Project>

eng/pipelines/onebranch/jobs/build-signed-csproj-package-job.yml

Lines changed: 81 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,49 @@
1515
# signed DLLs, and finally ESRP signs the NuGet packages.
1616

1717
parameters:
18+
19+
# Signing Parameters -----------------------------------------------------
20+
21+
- name: signingAppRegistrationClientId
22+
type: string
23+
24+
- name: signingAppRegistrationTenantId
25+
type: string
26+
27+
- name: signingAuthAkvName
28+
type: string
29+
30+
- name: signingAuthSignCertName
31+
type: string
32+
33+
- name: signingEsrpClientId
34+
type: string
35+
36+
- name: signingEsrpConnectedServiceName
37+
type: string
38+
39+
# Symbols Publishing Parameters ------------------------------------------
40+
41+
- name: symbolsAzureSubscription
42+
type: string
43+
default: 'Symbols publishing Workload Identity federation service-ADO.Net'
44+
45+
- name: symbolsPublishProjectName
46+
type: string
47+
default: 'Microsoft.Data.SqlClient.SNI'
48+
49+
- name: symbolsPublishServer
50+
type: string
51+
52+
- name: symbolsPublishTokenUri
53+
type: string
54+
55+
- name: symbolsUploadAccount
56+
type: string
57+
default: 'SqlClientDrivers'
58+
59+
# OTHERS +=====================================
60+
1861
# Short package name used in the job name, display strings, filesystem paths, and as a suffix for
1962
# the default Build and Pack targets if those aren't specified.
2063
- name: packageName
@@ -42,20 +85,17 @@ parameters:
4285
type: string
4386
default: ""
4487

88+
# True to enable ESRP malware scanning and code signing steps, which should not be
89+
# run on non-official pipelines as they access production resources.
90+
- name: isOfficial
91+
type: boolean
92+
4593
# The MSBuild pack target in build.proj (e.g. PackLogging). If not specified, defaults to
4694
# Pack<packageName>.
4795
- name: packTarget
4896
type: string
4997
default: ""
5098

51-
# The C# build configuration to build (e.g. Debug or Release).
52-
- name: buildConfiguration
53-
type: string
54-
values:
55-
- Debug
56-
- Release
57-
default: Release
58-
5999
# Additional MSBuild -p: arguments for version properties. These may include versions of
60100
# packages this package depends on, or versions for this package itself.
61101
- name: versionProperties
@@ -70,30 +110,6 @@ parameters:
70110
- name: publishSymbols
71111
type: boolean
72112

73-
# True to enable ESRP malware scanning and code signing steps, which should not be
74-
# run on non-official pipelines as they access production resources.
75-
- name: isOfficial
76-
type: boolean
77-
78-
# Values required by ESRP tasks.
79-
- name: esrpConnectedServiceName
80-
type: string
81-
82-
- name: esrpClientId
83-
type: string
84-
85-
- name: appRegistrationClientId
86-
type: string
87-
88-
- name: appRegistrationTenantId
89-
type: string
90-
91-
- name: authAkvName
92-
type: string
93-
94-
- name: authSignCertName
95-
type: string
96-
97113
# Optional list of pipeline artifacts to download before building. Each entry is an object
98114
# with 'artifactName' (the pipeline artifact name) and 'displayName' (used in the task label).
99115
# This replaces hard-coded packageName conditionals so callers declare their own dependencies.
@@ -108,15 +124,20 @@ jobs:
108124
type: windows
109125

110126
variables:
127+
# Inform OneBranch that files put in this directory should be uploaded as artifacts.
111128
ob_outputDirectory: $(PACK_OUTPUT)
129+
112130
# APIScan configuration for this Extension package
113131
ob_sdl_apiscan_enabled: true
114-
ob_sdl_apiscan_softwareFolder: $(Build.SourcesDirectory)/apiScan/${{ parameters.packageName }}/dlls
115-
ob_sdl_apiscan_symbolsFolder: $(Build.SourcesDirectory)/apiScan/${{ parameters.packageName }}/pdbs
132+
ob_sdl_apiscan_softwareFolder: $(REPO_ROOT)/apiScan/${{ parameters.packageName }}/dlls
133+
ob_sdl_apiscan_symbolsFolder: $(REPO_ROOT)/apiScan/${{ parameters.packageName }}/pdbs
116134
ob_sdl_apiscan_softwarename: ${{ parameters.packageFullName }}
117135
ob_sdl_apiscan_versionNumber: ${{ parameters.assemblyFileVersion }}
118136

137+
# If parameters.buildTarget is not provided, default to "Build{parameters.packageName}"
119138
buildTarget: ${{ coalesce(parameters.buildTarget, format('Build{0}', parameters.packageName)) }}
139+
140+
# If parameters.packTarget is not provided, default to "Pack{parameters.packageName}"
120141
packTarget: ${{ coalesce(parameters.packTarget, format('Pack{0}', parameters.packageName)) }}
121142

122143
steps:
@@ -128,46 +149,45 @@ jobs:
128149
displayName: Download ${{ artifact.displayName }}
129150
inputs:
130151
artifactName: ${{ artifact.artifactName }}
131-
targetPath: $(Build.SourcesDirectory)/packages
152+
targetPath: $(REPO_ROOT)/packages
132153

133154
# Install the .NET SDK.
134155
- template: /eng/pipelines/steps/install-dotnet.yml@self
135156

136157
# Perform Roslyn analysis before building, since this step will clobber build output.
137158
- template: /eng/pipelines/onebranch/steps/roslyn-analyzers-csproj-step.yml@self
138159
parameters:
160+
buildTarget: '${{ variables.buildTarget }}'
139161
msBuildArguments: >-
140-
-t:$(buildTarget)
141-
-p:Configuration=${{ parameters.buildConfiguration }}
162+
-p:Configuration=Release
142163
-p:ReferenceType=Package
143164
${{ parameters.versionProperties }}
144165
145166
# Build the package, producing DLLs only (no NuGet package yet).
146167
- template: /eng/pipelines/onebranch/steps/build-csproj-step.yml@self
147168
parameters:
148-
buildTarget: $(buildTarget)
149-
buildConfiguration: ${{ parameters.buildConfiguration }}
169+
buildTarget: '${{ variables.buildTarget }}'
150170
versionProperties: ${{ parameters.versionProperties }}
151171

152172
- ${{ if eq(parameters.isOfficial, true) }}:
153173
# ESRP sign the DLLs.
154174
- template: /eng/pipelines/onebranch/steps/esrp-dll-signing-step.yml@self
155175
parameters:
156-
appRegistrationClientId: ${{ parameters.appRegistrationClientId }}
157-
appRegistrationTenantId: ${{ parameters.appRegistrationTenantId }}
158-
authAkvName: ${{ parameters.authAkvName }}
159-
authSignCertName: ${{ parameters.authSignCertName }}
160-
esrpClientId: ${{ parameters.esrpClientId }}
161-
esrpConnectedServiceName: ${{ parameters.esrpConnectedServiceName }}
162-
pattern: ${{ parameters.packageFullName }}.dll
176+
appRegistrationClientId: '${{ parameters.signingAppRegistrationClientId }}'
177+
appRegistrationTenantId: '${{ parameters.signingAppRegistrationTenantId }}'
178+
authAkvName: '${{ parameters.signingAuthAkvName }}'
179+
authSignCertName: '${{ parameters.signingAuthSignCertName }}'
180+
esrpClientId: '${{ parameters.signingEsrpClientId }}'
181+
esrpConnectedServiceName: '${{ parameters.signingEsrpConnectedServiceName }}'
182+
pattern: '${{ parameters.packageFullName }}.dll'
163183

164184
# Copy signed/unsigned DLLs and PDBs to APIScan folders.
165185
- task: CopyFiles@2
166186
displayName: Copy DLLs for APIScan
167187
inputs:
168188
SourceFolder: $(BUILD_OUTPUT)/Package/bin
169189
Contents: "**/${{ parameters.packageFullName }}.dll"
170-
TargetFolder: $(ob_sdl_apiscan_softwareFolder)
190+
TargetFolder: ${{ variables.ob_sdl_apiscan_softwareFolder }}
171191
# We must preserve the folder structure since our C# projects may produce multiple
172192
# identically named DLLs for different target frameworks (e.g. netstandard2.0, net5.0,
173193
# etc.), and we need to keep those separate for APIScan to work correctly.
@@ -178,42 +198,41 @@ jobs:
178198
inputs:
179199
SourceFolder: $(BUILD_OUTPUT)/Package/bin
180200
Contents: "**/${{ parameters.packageFullName }}.pdb"
181-
TargetFolder: $(ob_sdl_apiscan_symbolsFolder)
201+
TargetFolder: ${{ variables.ob_sdl_apiscan_symbolsFolder }}
182202
flattenFolders: false
183203

184204
# Pack the signed DLLs into NuGet package (NoBuild=true).
185205
- template: /eng/pipelines/onebranch/steps/pack-csproj-step.yml@self
186206
parameters:
187-
packTarget: $(packTarget)
188-
buildConfiguration: ${{ parameters.buildConfiguration }}
207+
packTarget: ${{ variables.packTarget }}
189208
versionProperties: ${{ parameters.versionProperties }}
190209

191210
- ${{ if eq(parameters.isOfficial, true) }}:
192211
# ESRP sign the NuGet package.
193212
- template: /eng/pipelines/onebranch/steps/esrp-nuget-signing-step.yml@self
194213
parameters:
195-
appRegistrationClientId: ${{ parameters.appRegistrationClientId }}
196-
appRegistrationTenantId: ${{ parameters.appRegistrationTenantId }}
197-
authAkvName: ${{ parameters.authAkvName }}
198-
authSignCertName: ${{ parameters.authSignCertName }}
199-
esrpClientId: ${{ parameters.esrpClientId }}
200-
esrpConnectedServiceName: ${{ parameters.esrpConnectedServiceName }}
214+
appRegistrationClientId: '${{ parameters.signingAppRegistrationClientId }}'
215+
appRegistrationTenantId: '${{ parameters.signingAppRegistrationTenantId }}'
216+
authAkvName: '${{ parameters.signingAuthAkvName }}'
217+
authSignCertName: '${{ parameters.signingAuthSignCertName }}'
218+
esrpClientId: '${{ parameters.signingEsrpClientId }}'
219+
esrpConnectedServiceName: '${{ parameters.signingEsrpConnectedServiceName }}'
201220
searchPath: $(PACK_OUTPUT)
202-
searchPattern: '${{ parameters.packageFullName }}.*nupkg'
221+
searchPattern: '${{ parameters.packageFullName}}.*nupkg'
203222

204223
# Publish symbols to servers
205224
# @TODO: Get these parameters from variables/libraries
206225
- ${{ if eq(parameters.publishSymbols, true) }}:
207226
- template: /eng/pipelines/onebranch/steps/publish-symbols-step.yml@self
208227
parameters:
209228
artifactName: '${{ parameters.packageFullName }}_symbols_$(System.TeamProject)_$(Build.Repository.Name)_$(Build.SourceBranchName)_${{ parameters.packageVersion }}_$(System.TimelineId)'
210-
azureSubscription: 'Symbols publishing Workload Identity federation service-ADO.Net'
229+
azureSubscription: '${{ parameters.symbolsAzureSubscription }}'
211230
packageName: '${{ parameters.packageFullName }}'
212-
publishProjectName: 'Microsoft.Data.SqlClient.SNI' # This is used for all SqlClient packages. Don't know why, but it is.
213-
publishServer: '$(SymbolServer)'
231+
publishProjectName: '${{ parameters.symbolsPublishProjectName }}'
232+
publishServer: '${{ parameters.symbolsPublishServer }}'
214233
publishToInternal: 'true'
215234
publishToPublic: 'true'
216-
publishTokenUri: '$(SymbolTokenUri)'
235+
publishTokenUri: '${{ parameters.symbolsPublishTokenUri }}'
217236
searchPattern: '**/${{ parameters.packageFullName }}*.pdb'
218-
uploadAccount: 'SqlClientDrivers'
237+
uploadAccount: '${{ parameters.symbolsUploadAccount }}'
219238
version: '${{ parameters.packageVersion }}'

eng/pipelines/onebranch/jobs/build-signed-mds-package-job.yml renamed to eng/pipelines/onebranch/jobs/build-signed-sqlclient-package-job.yml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,14 @@ parameters:
6767
- name: loggingPackageVersion
6868
type: string
6969

70-
- name: mdsAssemblyFileVersion
70+
- name: sqlClientAssemblyFileVersion
7171
type: string
7272

73-
- name: mdsPackageVersion
73+
- name: sqlClientPackageVersion
7474
type: string
7575

7676
jobs:
77-
- job: build_package_Mds
77+
- job: build_package_SqlClient
7878
displayName: 'Build Microsoft.Data.SqlClient'
7979
pool:
8080
type: windows
@@ -84,7 +84,7 @@ jobs:
8484
ob_sdl_apiscan_softwareFolder: ${{ parameters.apiScanDllPath }}
8585
ob_sdl_apiscan_symbolsFolder: ${{ parameters.apiScanPdbPath }}
8686
ob_sdl_apiscan_softwarename: 'Microsoft.Data.SqlClient'
87-
ob_sdl_apiscan_versionNumber: ${{ parameters.mdsAssemblyFileVersion }}
87+
ob_sdl_apiscan_versionNumber: ${{ parameters.sqlClientAssemblyFileVersion }}
8888

8989
steps:
9090
# Dump environment and parameters
@@ -114,21 +114,21 @@ jobs:
114114
- template: /eng/pipelines/steps/install-dotnet.yml@self
115115

116116
# Perform analysis before building, since this step will clobber build output
117-
- template: /eng/pipelines/onebranch/steps/roslyn-analyzers-mds-step.yml@self
117+
- template: /eng/pipelines/onebranch/steps/roslyn-analyzers-sqlclient-step.yml@self
118118
parameters:
119119
abstractionsPackageVersion: '${{ parameters.abstractionsPackageVersion }}'
120120
loggingPackageVersion: '${{ parameters.loggingPackageVersion }}'
121-
mdsPackageVersion: '${{ parameters.mdsPackageVersion }}'
121+
sqlClientPackageVersion: '${{ parameters.sqlClientPackageVersion }}'
122122

123123
# Perform the actual build
124-
- template: /eng/pipelines/onebranch/steps/build-mds-step.yml@self
124+
- template: /eng/pipelines/onebranch/steps/build-sqlclient-step.yml@self
125125
parameters:
126126
abstractionsPackageVersion: '${{ parameters.abstractionsPackageVersion }}'
127127
loggingPackageVersion: '${{ parameters.loggingPackageVersion }}'
128-
mdsPackageVersion: '${{ parameters.mdsPackageVersion }}'
128+
sqlClientPackageVersion: '${{ parameters.sqlClientPackageVersion }}'
129129

130130
# Copy the built DLLs and PDBs to the APIScan output folder for APIScanning post-build
131-
- template: /eng/pipelines/onebranch/steps/copy-apiscan-files-mds-step.yml@self
131+
- template: /eng/pipelines/onebranch/steps/copy-apiscan-files-sqlclient-step.yml@self
132132
parameters:
133133
dllPath: '${{ parameters.apiScanDllPath }}'
134134
pdbPath: '${{ parameters.apiScanPdbPath }}'
@@ -147,11 +147,11 @@ jobs:
147147
pattern: 'Microsoft.Data.SqlClient*.dll'
148148

149149
# Package the build output into a NuGet package
150-
- template: /eng/pipelines/onebranch/steps/pack-mds-step.yml
150+
- template: /eng/pipelines/onebranch/steps/pack-sqlclient-step.yml
151151
parameters:
152152
abstractionsPackageVersion: '${{ parameters.abstractionsPackageVersion }}'
153153
loggingPackageVersion: '${{ parameters.loggingPackageVersion }}'
154-
mdsPackageVersion: '${{ parameters.mdsPackageVersion }}'
154+
sqlClientPackageVersion: '${{ parameters.sqlClientPackageVersion }}'
155155

156156
# Sign the NuGet packages
157157
- ${{ if parameters.isOfficial }}:
@@ -169,7 +169,7 @@ jobs:
169169
- ${{ if parameters.publishSymbols }}:
170170
- template: /eng/pipelines/onebranch/steps/publish-symbols-step.yml@self
171171
parameters:
172-
artifactName: 'Microsoft.Data.SqlClient_symbols_$(System.TeamProject)_$(Build.Repository.Name)_$(Build.SourceBranchName)_${{ parameters.mdsPackageVersion }}_$(System.TimelineId)'
172+
artifactName: 'Microsoft.Data.SqlClient_symbols_$(System.TeamProject)_$(Build.Repository.Name)_$(Build.SourceBranchName)_${{ parameters.sqlClientPackageVersion }}_$(System.TimelineId)'
173173
azureSubscription: '${{ parameters.symbolsAzureSubscription }}'
174174
packageName: 'Microsoft.Data.SqlClient'
175175
publishProjectName: '${{ parameters.symbolsPublishProjectName }}'
@@ -179,4 +179,4 @@ jobs:
179179
publishTokenUri: '${{ parameters.symbolsPublishTokenUri }}'
180180
searchPattern: '**/Microsoft.Data.SqlClient*.pdb' # @TODO: This seems very heavy
181181
uploadAccount: '${{ parameters.symbolsUploadAccount }}'
182-
version: '${{ parameters.mdsPackageVersion }}'
182+
version: '${{ parameters.sqlClientPackageVersion }}'

eng/pipelines/onebranch/jobs/publish-nuget-package-job.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jobs:
6565

6666
variables:
6767
- name: ob_outputDirectory
68-
value: $(Build.SourcesDirectory)/output
68+
value: $(PACK_OUTPUT)
6969

7070
- name: artifactPath
7171
value: $(Pipeline.Workspace)/${{ parameters.artifactName }}

0 commit comments

Comments
 (0)