Skip to content

Commit be6f8bf

Browse files
author
SqlClient Azure DevOps
committed
Merge in 'release/3.1' changes
2 parents d7ccad2 + 565ff67 commit be6f8bf

14 files changed

+183
-56
lines changed

eng/pipelines/common/templates/jobs/build-signed-akv-package-job.yml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ parameters:
1717

1818
jobs:
1919
- job: build_signed_akv_package
20+
displayName: 'Build Signed AKV Provider Package'
2021
pool:
2122
type: windows
2223

@@ -63,20 +64,11 @@ jobs:
6364
product: AKV
6465
referenceType: package
6566

66-
# Publish symbols to private server
67+
# Publish symbols to servers
6768
- template: ../steps/publish-symbols-step.yml@self
6869
parameters:
69-
SymAccount: $(PrivateSymAccount)
70-
referenceType: package
71-
symbolsVersion: ${{variables.AKVNuGetPackageVersion }}
72-
product: AKV
73-
publishSymbols: ${{ parameters['PublishSymbols'] }}
74-
75-
# Publish symbols to public server
76-
- template: ../steps/publish-symbols-step.yml@self
77-
parameters:
78-
SymAccount: $(PublicSymAccount)
7970
referenceType: package
8071
symbolsVersion: ${{variables.AKVNuGetPackageVersion }}
8172
product: AKV
8273
publishSymbols: ${{ parameters['PublishSymbols'] }}
74+
symbolsArtifactName: akv_symbols_$(System.TeamProject)_$(Build.Repository.Name)_$(Build.SourceBranchName)_$(NuGetPackageVersion)_$(System.TimelineId)

eng/pipelines/common/templates/jobs/build-signed-package-job.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ parameters:
1717

1818
jobs:
1919
- job: build_signed_package
20+
displayName: 'Build Signed MDS Package'
2021
pool:
2122
type: windows
2223

@@ -51,14 +52,8 @@ jobs:
5152
parameters:
5253
product: MDS
5354

54-
# Publish symbols to private server
55+
# Publish symbols to servers
5556
- template: ../steps/publish-symbols-step.yml@self
5657
parameters:
57-
SymAccount: $(PrivateSymAccount)
58-
publishSymbols: ${{ parameters['PublishSymbols'] }}
59-
60-
# Publish symbols to public server
61-
- template: ../steps/publish-symbols-step.yml@self
62-
parameters:
63-
SymAccount: $(PublicSymAccount)
6458
publishSymbols: ${{ parameters['PublishSymbols'] }}
59+
symbolsArtifactName: mds_symbols_$(System.TeamProject)_$(Build.Repository.Name)_$(Build.SourceBranchName)_$(NuGetPackageVersion)_$(System.TimelineId)

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ parameters:
1919

2020
jobs:
2121
- job: run_tests_package_reference
22+
displayName: 'Run tests with package reference'
23+
${{ if ne(parameters.dependsOn, 'empty')}}:
24+
dependsOn: '${{parameters.dependsOn }}'
2225
pool:
2326
type: windows # read more about custom job pool types at https://aka.ms/obpipelines/yaml/jobs
2427
isCustom: true

eng/pipelines/common/templates/jobs/validate-signed-package-job.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ parameters:
3939

4040
jobs:
4141
- job: validate_signed_package
42+
displayName: 'Verify signed package'
43+
${{ if ne(parameters.dependsOn, '')}}:
44+
dependsOn: '${{parameters.dependsOn }}'
4245
pool:
4346
type: windows # read more about custom job pool types at https://aka.ms/obpipelines/yaml/jobs
4447
isCustom: true

eng/pipelines/common/templates/steps/build-all-configurations-signed-dlls-step.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ steps:
3535
inputs:
3636
solution: '**/build.proj'
3737
configuration: '${{parameters.Configuration }}'
38-
msbuildArguments: '-p:AssemblyFileVersion=${{parameters.AssemblyFileVersion }} -t:BuildAllConfigurations -p:GenerateNuget=false -p:SignAssembly=true -p:AssemblyOriginatorKeyFile=$(Agent.TempDirectory)\netfxKeypair.snk'
38+
msbuildArguments: '-p:AssemblyFileVersion=${{parameters.AssemblyFileVersion }} -t:BuildAllConfigurations -p:GenerateNuget=false -p:SignAssembly=true -p:SigningKeyPath=$(Agent.TempDirectory)\netfxKeypair.snk'
3939

4040
- ${{ if eq(parameters.product, 'AKV') }}:
4141
- task: MSBuild@1

eng/pipelines/common/templates/steps/code-analyze-step.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ steps:
3333
msBuildVersion: 17.0
3434
msBuildArchitecture: x64
3535
setupCommandlinePicker: vs2022
36-
msBuildCommandline: 'msbuild ${{parameters.sourceRoot}}\build.proj -p:configuration=Release -p:GenerateNuget=false -p:BuildTools=false'
36+
msBuildCommandline: 'msbuild ${{parameters.sourceRoot}}\build.proj -p:configuration=Release -p:GenerateNuget=false -p:BuildTools=false -p:SigningKeyPath=$(Agent.TempDirectory)\netfxKeypair.snk'
3737
- ${{ if eq(parameters.product, 'AKV') }}:
3838
- task: securedevelopmentteam.vss-secure-development-tools.build-task-roslynanalyzers.RoslynAnalyzers@3
3939
displayName: 'Guardian Dotnet Analyzers '

eng/pipelines/common/templates/steps/publish-symbols-step.yml

Lines changed: 96 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
#################################################################################
2-
# Licensed to the .NET Foundation under one or more agreements. #
3-
# The .NET Foundation licenses this file to you under the MIT license. #
4-
# See the LICENSE file in the project root for more information. #
5-
#################################################################################
1+
####################################################################################
2+
# Licensed to the .NET Foundation under one or more agreements. #
3+
# The .NET Foundation licenses this file to you under the MIT license. #
4+
# See the LICENSE file in the project root for more information. #
5+
# #
6+
# doc: https://www.osgwiki.com/wiki/Symbols_Publishing_Pipeline_to_SymWeb_and_MSDL #
7+
####################################################################################
68
parameters:
79
- name: SymAccount
810
type: string
11+
default: 'SqlClientDrivers'
912

1013
- name: publishSymbols
1114
type: string
@@ -15,6 +18,23 @@ parameters:
1518
type: string
1619
default: '$(NuGetPackageVersion)'
1720

21+
- name: symbolServer
22+
type: string
23+
default: '$(SymbolServer)'
24+
25+
- name: symbolTokenUri
26+
type: string
27+
default: '$(SymbolTokenUri)'
28+
29+
- name: symbolsArtifactName
30+
type: string
31+
32+
- name: publishToServers
33+
type: object
34+
default:
35+
internal: true
36+
public: true
37+
1838
- name: referenceType
1939
default: project
2040
values:
@@ -29,12 +49,12 @@ parameters:
2949

3050
steps:
3151
- powershell: 'Write-Host "##vso[task.setvariable variable=ArtifactServices.Symbol.AccountName;]${{parameters.SymAccount}}"'
32-
displayName: 'Update Symbol.AccountName ${{parameters.SymAccount}}'
52+
displayName: 'Update Symbol.AccountName with ${{parameters.SymAccount}}'
3353
condition: and(succeeded(), ${{ eq(parameters.publishSymbols, 'true') }})
3454

3555
- ${{ if eq(parameters.product, 'MDS') }}:
3656
- task: PublishSymbols@2
37-
displayName: 'Publish symbols path'
57+
displayName: 'Upload symbols to ${{parameters.SymAccount }} org'
3858
inputs:
3959
SymbolsFolder: '$(Build.SourcesDirectory)\artifacts\${{parameters.referenceType }}\bin'
4060
SearchPattern: |
@@ -43,13 +63,16 @@ steps:
4363
IndexSources: false
4464
SymbolServerType: TeamServices
4565
SymbolsMaximumWaitTime: 60
66+
SymbolExpirationInDays: 1825 # 5 years
4667
SymbolsProduct: Microsoft.Data.SqlClient
47-
SymbolsVersion: '{{parameters.symbolsVersion }}'
68+
SymbolsVersion: ${{parameters.symbolsVersion }}
69+
SymbolsArtifactName: ${{parameters.symbolsArtifactName }}
70+
Pat: $(System.AccessToken)
4871
condition: and(succeeded(), ${{ eq(parameters.publishSymbols, 'true') }})
4972

5073
- ${{ if eq(parameters.product, 'AKV') }}:
5174
- task: PublishSymbols@2
52-
displayName: 'Publish symbols path'
75+
displayName: 'Upload symbols to ${{parameters.SymAccount }} org'
5376
inputs:
5477
SymbolsFolder: '$(Build.SourcesDirectory)\artifacts\${{parameters.referenceType }}\bin'
5578
SearchPattern: |
@@ -58,6 +81,69 @@ steps:
5881
IndexSources: false
5982
SymbolServerType: TeamServices
6083
SymbolsMaximumWaitTime: 60
84+
SymbolExpirationInDays: 1825 # 5 years
6185
SymbolsProduct: Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider
62-
SymbolsVersion: '{{parameters.symbolsVersion }}'
86+
SymbolsVersion: ${{parameters.symbolsVersion }}
87+
SymbolsArtifactName: ${{parameters.symbolsArtifactName }}
88+
Pat: $(System.AccessToken)
6389
condition: and(succeeded(), ${{ eq(parameters.publishSymbols, 'true') }})
90+
91+
- task: AzureCLI@2
92+
displayName: 'Publish symbols'
93+
condition: and(succeeded(), ${{ eq(parameters.publishSymbols, 'true') }})
94+
inputs:
95+
azureSubscription: 'Symbols publishing Workload Identity federation service-ADO.Net'
96+
scriptType: ps
97+
scriptLocation: inlineScript
98+
inlineScript: |
99+
$publishToInternalServer = "${{parameters.publishToServers.internal }}".ToLower()
100+
$publishToPublicServer = "${{parameters.publishToServers.public }}".ToLower()
101+
102+
echo "Publishing request name: ${{parameters.symbolsArtifactName }}"
103+
echo "Publish to internal server: $publishToInternalServer"
104+
echo "Publish to public server: $publishToPublicServer"
105+
106+
$symbolServer = "${{parameters.symbolServer }}"
107+
$tokenUri = "${{parameters.symbolTokenUri }}"
108+
# Registered project name in the symbol publishing pipeline: https://portal.microsofticm.com/imp/v3/incidents/incident/520844254/summary
109+
$projectName = "Microsoft.Data.SqlClient.SNI"
110+
111+
# Get the access token for the symbol publishing service
112+
$symbolPublishingToken = az account get-access-token --resource $tokenUri --query accessToken -o tsv
113+
114+
echo "> 1.Symbol publishing token acquired."
115+
116+
echo "Registering the request name ..."
117+
$requestName = "${{parameters.symbolsArtifactName }}"
118+
$requestNameRegistrationBody = "{'requestName': '$requestName'}"
119+
Invoke-RestMethod -Method POST -Uri "https://$symbolServer.trafficmanager.net/projects/$projectName/requests" -Headers @{ Authorization = "Bearer $symbolPublishingToken" } -ContentType "application/json" -Body $requestNameRegistrationBody
120+
121+
echo "> 2.Registration of request name succeeded."
122+
123+
echo "Publishing the symbols ..."
124+
$publishSymbolsBody = "{'publishToInternalServer': $publishToInternalServer, 'publishToPublicServer': $publishToPublicServer}"
125+
echo "Publishing symbols request body: $publishSymbolsBody"
126+
Invoke-RestMethod -Method POST -Uri "https://$symbolServer.trafficmanager.net/projects/$projectName/requests/$requestName" -Headers @{ Authorization = "Bearer $symbolPublishingToken" } -ContentType "application/json" -Body $publishSymbolsBody
127+
128+
echo "> 3.Request to publish symbols succeeded."
129+
130+
# The following REST calls are used to check publishing status.
131+
echo "> 4.Checking the status of the request ..."
132+
133+
Invoke-RestMethod -Method GET -Uri "https://$symbolServer.trafficmanager.net/projects/$projectName/requests/$requestName" -Headers @{ Authorization = "Bearer $symbolPublishingToken" } -ContentType "application/json"
134+
135+
echo "Use below tables to interpret the values of xxxServerStatus and xxxServerResult fields from the response."
136+
137+
echo "PublishingStatus"
138+
echo "-----------------"
139+
echo "0 NotRequested; The request has not been requested to publish."
140+
echo "1 Submitted; The request is submitted to be published"
141+
echo "2 Processing; The request is still being processed"
142+
echo "3 Completed; The request has been completed processing. It can be failed or successful. Check PublishingResult to get more details"
143+
144+
echo "PublishingResult"
145+
echo "-----------------"
146+
echo "0 Pending; The request has not completed or has not been requested."
147+
echo "1 Succeeded; The request has published successfully"
148+
echo "2 Failed; The request has failed to publish"
149+
echo "3 Cancelled; The request was cancelled"

eng/pipelines/dotnet-sqlclient-signing-pipeline.yml

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -38,24 +38,33 @@ parameters: # parameters are shown up in ADO UI in a build queue time
3838
displayName: 'Enable debug output'
3939
type: boolean
4040
default: false
41-
- name: oneBranchType
42-
displayName: 'Select OneBranch template'
43-
default: Official
44-
values:
45-
- NonOfficial
46-
- Official
41+
4742
- name: publishSymbols
4843
type: boolean
4944
default: false
45+
5046
- name: MDS_PackageRef_Version
5147
displayName: 'MDS package version of AKV Provider (build AKV)'
5248
type: string
53-
default: 3.1.5
49+
default: 3.0.0
50+
5451
- name: CurrentNetFxVersion
5552
displayName: 'Lowest supported .NET Framework version (MDS validation)'
5653
type: string
5754
default: 'net461'
5855

56+
- name: enableAllSdlTools
57+
displayName: 'Enable all SDL tools'
58+
type: boolean
59+
default: true
60+
61+
- name: oneBranchType
62+
displayName: 'Select OneBranch template'
63+
default: Official
64+
values:
65+
- NonOfficial
66+
- Official
67+
5968
variables:
6069
- template: /eng/pipelines/libraries/variables.yml@self
6170
- name: packageFolderName
@@ -77,49 +86,50 @@ resources:
7786
ref: refs/heads/main
7887

7988
extends:
80-
template: v2/OneBranch.${{ parameters['oneBranchType'] }}.CrossPlat.yml@templates # https://aka.ms/obpipelines/templates
89+
template: v2/OneBranch.${{parameters.oneBranchType }}.CrossPlat.yml@templates # https://aka.ms/obpipelines/templates
8190
parameters:
8291
globalSdl: # https://aka.ms/obpipelines/sdl
8392
apiscan:
84-
enabled: true
93+
enabled: ${{parameters.enableAllSdlTools }}
8594
softwareFolder: $(softwareFolder)
8695
symbolsFolder: $(symbolsFolder)
8796
softwarename: Microsoft.Data.SqlClient
8897
versionNumber: $(AssemblyFileVersion)
8998
tsa:
90-
enabled: true # onebranch publish all sdl results to TSA. If TSA is disabled all SDL tools will forced into 'break' build mode.
99+
enabled: ${{parameters.enableAllSdlTools }} # onebranch publish all sdl results to TSA. If TSA is disabled all SDL tools will forced into 'break' build mode.
91100
codeql:
92101
compiled:
93102
enabled: false #[warning]Consider running CodeQL on the default branch only.
94103
sbom:
95-
enabled: true
104+
enabled: ${{parameters.enableAllSdlTools }}
96105
packageName: Microsoft.Data.SqlClient
97106
packageVersion: $(NugetPackageVersion)
98107
policheck:
99-
enabled: true
108+
enabled: ${{parameters.enableAllSdlTools }}
100109
break: true # always break the build on policheck issues. You can disable it by setting to 'false'
101110
exclusionsFile: $(REPOROOT)\.config\PolicheckExclusions.xml
102111
asyncSdl:
103112
enabled: false
104113
credscan:
105-
enabled: true
114+
enabled: ${{parameters.enableAllSdlTools }}
106115
suppressionsFile: $(REPOROOT)/.config/CredScanSuppressions.json
107116
binskim:
108-
enabled: true
117+
enabled: ${{parameters.enableAllSdlTools }}
109118
armory:
110-
enabled: true
119+
enabled: ${{parameters.enableAllSdlTools }}
111120
break: true
112121
eslint: # TypeScript and JavaScript
113122
enabled: false
114123
roslyn:
115-
enabled: true
124+
enabled: ${{parameters.enableAllSdlTools }}
116125
break: true
117126
publishLogs:
118-
enabled: true
127+
enabled: ${{parameters.enableAllSdlTools }}
119128
tsaOptionsPath: $(REPOROOT)\.config\tsaoptions.json
120129
disableLegacyManifest: true
121130
stages:
122131
- stage: buildAKV
132+
displayName: 'Build AKV Provider'
123133
jobs:
124134
- template: eng/pipelines/common/templates/jobs/build-signed-akv-package-job.yml@self
125135
parameters:
@@ -128,14 +138,16 @@ extends:
128138
publishSymbols: ${{ parameters['publishSymbols'] }}
129139

130140
- stage: buildMDS
141+
displayName: 'Build MDS'
131142
jobs:
132143
- template: eng/pipelines/common/templates/jobs/build-signed-package-job.yml@self
133144
parameters:
134145
symbolsFolder: $(symbolsFolder)
135146
softwareFolder: $(softwareFolder)
136147
publishSymbols: ${{ parameters['publishSymbols'] }}
137148

138-
- stage: package_validation
149+
- stage: mds_package_validation
150+
displayName: 'MDS Package Validation'
139151
dependsOn: buildMDS
140152
jobs:
141153
- template: eng/pipelines/common/templates/jobs/validate-signed-package-job.yml@self

src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.csproj

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@
1818
<PropertyGroup Condition="'$(TargetGroup)' == 'netcoreapp'">
1919
<DefineConstants>$(DefineConstants);NETCOREAPP</DefineConstants>
2020
</PropertyGroup>
21+
<PropertyGroup Condition="$(CDP_BUILD_TYPE)==Official">
22+
<SignAssembly>true</SignAssembly>
23+
<DelaySign>true</DelaySign>
24+
<KeyFile>$(SigningKeyPath)</KeyFile>
25+
<AssemblyOriginatorKeyFile>$(SigningKeyPath)</AssemblyOriginatorKeyFile>
26+
</PropertyGroup>
27+
<PropertyGroup Condition="$(CDP_BUILD_TYPE)!=Official">
28+
<AssemblyOriginatorKeyFile>$(SigningKeyPath)</AssemblyOriginatorKeyFile>
29+
</PropertyGroup>
2130
<ItemGroup>
2231
<Compile Include="Microsoft.Data.SqlClient.cs" />
2332
<Compile Include="Microsoft.Data.SqlClient.Manual.cs" />

src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,15 @@
2828
<PropertyGroup Condition="'$(TargetGroup)' == 'netcoreapp' AND !$(TargetFramework.StartsWith('netcoreapp2.'))">
2929
<DefineConstants>$(DefineConstants);NETCOREAPP31_AND_ABOVE</DefineConstants>
3030
</PropertyGroup>
31+
<PropertyGroup Condition="$(CDP_BUILD_TYPE)==Official">
32+
<SignAssembly>true</SignAssembly>
33+
<DelaySign>true</DelaySign>
34+
<KeyFile>$(SigningKeyPath)</KeyFile>
35+
<AssemblyOriginatorKeyFile>$(SigningKeyPath)</AssemblyOriginatorKeyFile>
36+
</PropertyGroup>
37+
<PropertyGroup Condition="$(CDP_BUILD_TYPE)!=Official">
38+
<AssemblyOriginatorKeyFile>$(SigningKeyPath)</AssemblyOriginatorKeyFile>
39+
</PropertyGroup>
3140
<PropertyGroup>
3241
<DebugType>portable</DebugType>
3342
<DebugSymbols>true</DebugSymbols>

0 commit comments

Comments
 (0)