Skip to content

Commit

Permalink
Allow sni version override.
Browse files Browse the repository at this point in the history
  • Loading branch information
mdaigle committed Feb 27, 2025
1 parent 6151075 commit 0d228f2
Show file tree
Hide file tree
Showing 3 changed files with 139 additions and 9 deletions.
99 changes: 99 additions & 0 deletions eng/pipelines/common/templates/steps/override-sni-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
#################################################################################
# Licensed to the .NET Foundation under one or more agreements. #
# The .NET Foundation licenses this file to you under the MIT license. #
# See the LICENSE file in the project root for more information. #
#################################################################################

parameters:
- name: SNIVersion
type: string

- name: SNIValidationFeed
type: string

steps:
- task: PowerShell@2
displayName: Update SNI Version in Nuget.config
inputs:
targetType: inline
script: |
#Purpose: Updates Nuget.config to add SNIValidation Internal Feed and the required credentials
Write-Host "Starting update to Nuget.config"
Write-Host "SNI Version to test = ${{parameters.SNIVersion}}"
# define file to update
$NugetCfg = Join-Path -Path '.' -ChildPath 'NuGet.config'
type $NugetCfg
# define an xml object
$xml = New-Object XML
# load content of xml from file defined above
$xml.Load($NugetCfg)
# define namespace used to read a node
$nsm = New-Object Xml.XmlNamespaceManager($xml.NameTable)
$nsm.AddNamespace('ns', $xml.DocumentElement.NamespaceURI)
# get the package sources node
$packageSources = $xml.SelectSingleNode('//ns:packageSources', $nsm)
# define new package source
$newSource = $xml.CreateElement("add")
$newSource.SetAttribute("key","SNIValidation")
$newSource.SetAttribute("value","${{parameters.SNIValidationFeed}}")
# add the new package source
$packageSources.AppendChild($newSource)
# save the xml file
$xml.Save($NugetCfg)
type $NugetCfg
- task: PowerShell@2
displayName: Update SNI Version in Versions.props
inputs:
targetType: inline
script: |
#Purpose: Updates SNI Version
Write-Host "Starting update to Versions.props"
Write-Host "SNI Version to test = ${{parameters.SNIVersion}}"
#Get the SNI Version to test from the user entered version.
$SharedSNIVersion = "${{parameters.SNIVersion}}"
# define file to update
$PropsPath = Join-Path -Path '.' -ChildPath 'tools\props\Versions.props'
type $PropsPath
# new version number to update to
##Write-Host "SNI Version to test = $(SNIValidationVersion)"
Write-Host "SNI Version to test = $SharedSNIVersion"
# define an xml object
$xml = New-Object XML
# load content of xml from file defined above
$xml.Load($PropsPath)
# define namespace used to read a node
$nsm = New-Object Xml.XmlNamespaceManager($xml.NameTable)
$nsm.AddNamespace('ns', $xml.DocumentElement.NamespaceURI)
$netFxSniVersion = $xml.SelectSingleNode('//ns:MicrosoftDataSqlClientSniVersion', $nsm)
Write-Host "Node NetFx SNI Version = $($netFxSniVersion.InnerText)"
# update the node inner text
$netFxSniVersion.InnerText = "$SharedSNIVersion"
$netCoreSniVersion = $xml.SelectSingleNode('//ns:MicrosoftDataSqlClientSNIRuntimeVersion', $nsm)
# update the node inner text
$netCoreSniVersion.InnerText = "$SharedSNIVersion"
# save the xml file
$xml.Save($PropsPath)
type $PropsPath
- task: NuGetAuthenticate@1
displayName: 'NuGet Authenticate with SNI Validation Feed'
42 changes: 36 additions & 6 deletions eng/pipelines/dotnet-sqlclient-ci-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,18 @@ parameters:
type: object
default: [false, true]

- name: SNIVersion
displayName: |
Use a specific SNI version from the internal validation feed
type: string
default: ''

- name: SNIValidationFeed
displayName: |
The specific SNI test version is pulled from this feed
type: string
default: https://sqlclientdrivers.pkgs.visualstudio.com/ADO.Net/_packaging/SNIValidation/nuget/v3/index.json

- name: codeCovTargetFrameworks
displayName: 'Code Coverage Target Frameworks'
type: object
Expand Down Expand Up @@ -73,6 +85,12 @@ stages:
- template: common/templates/jobs/ci-build-nugets-job.yml@self
parameters:
artifactName: $(artifactName)
${{if ne(parameters.SNIVersion, '')}}:
prebuildSteps:
- template: common/templates/steps/override-sni-version.yml@self
parameters:
SNIVersion: ${{parameters.SNIVersion}}
SNIValidationFeed: ${{parameters.SNIValidationFeed}}

- template: common/templates/stages/ci-run-tests-stage.yml@self
parameters:
Expand All @@ -81,12 +99,24 @@ stages:
${{ if eq(parameters.buildType, 'Package') }}:
dependsOn: build_nugets

prebuildSteps: # steps to run prior to building and running tests on each job
- template: common/templates/steps/ci-prebuild-step.yml@self
parameters:
debug: ${{ parameters.debug }}
artifactName: $(artifactName)
buildType: ${{ parameters.buildType }}
${{if ne(parameters.SNIVersion, '')}}:
prebuildSteps: # steps to run prior to building and running tests on each job
- template: common/templates/steps/override-sni-version.yml@self
parameters:
SNIVersion: ${{parameters.SNIVersion}}
SNIValidationFeed: ${{parameters.SNIValidationFeed}}
- template: common/templates/steps/ci-prebuild-step.yml@self
parameters:
debug: ${{ parameters.debug }}
artifactName: $(artifactName)
buildType: ${{ parameters.buildType }}
${{else}}:
prebuildSteps: # steps to run prior to building and running tests on each job
- template: common/templates/steps/ci-prebuild-step.yml@self
parameters:
debug: ${{ parameters.debug }}
artifactName: $(artifactName)
buildType: ${{ parameters.buildType }}

${{ if eq(parameters.buildType, 'Project') }}: # only run the code coverage job if the build type is project
postTestJobs: # jobs to run after the tests are done
Expand Down
7 changes: 4 additions & 3 deletions src/Microsoft.Data.SqlClient.sln
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "steps", "steps", "{EABE3A3E
..\eng\pipelines\common\templates\steps\copy-dlls-for-test-step.yml = ..\eng\pipelines\common\templates\steps\copy-dlls-for-test-step.yml
..\eng\pipelines\common\templates\steps\esrp-code-signing-step.yml = ..\eng\pipelines\common\templates\steps\esrp-code-signing-step.yml
..\eng\pipelines\common\templates\steps\generate-nuget-package-step.yml = ..\eng\pipelines\common\templates\steps\generate-nuget-package-step.yml
..\eng\pipelines\common\templates\steps\override-sni-version.yml = ..\eng\pipelines\common\templates\steps\override-sni-version.yml
..\eng\pipelines\common\templates\steps\pre-build-step.yml = ..\eng\pipelines\common\templates\steps\pre-build-step.yml
..\eng\pipelines\common\templates\steps\prepare-test-db-step.yml = ..\eng\pipelines\common\templates\steps\prepare-test-db-step.yml
..\eng\pipelines\common\templates\steps\publish-symbols-step.yml = ..\eng\pipelines\common\templates\steps\publish-symbols-step.yml
Expand Down Expand Up @@ -559,6 +560,8 @@ Global
{8DC9D1A0-351B-47BC-A90F-B9DA542550E9} = {0CC4817A-12F3-4357-912C-09315FAAD008}
{D2D1E2D1-B6E0-489F-A36D-1F3047AB87B9} = {0CC4817A-12F3-4357-912C-09315FAAD008}
{37431336-5307-4184-9356-C4B7E47DC714} = {28E5EFE6-C9DD-4FF9-9FEC-532F72DFFA6E}
{28E5EFE6-C9DD-4FF9-9FEC-532F72DFFA6E} = {4F3CD363-B1E6-4D6D-9466-97D78A56BE45}
{3FDD425C-FE01-4B56-863E-1FCDD0677CF5} = {4F3CD363-B1E6-4D6D-9466-97D78A56BE45}
{D1392B54-998A-4F27-BC17-4CE149117BCC} = {CDE508A5-F5D0-4A59-A4EF-978833830727}
{45DB5F86-7AE3-45C6-870D-F9357B66BDB5} = {0CC4817A-12F3-4357-912C-09315FAAD008}
{6C88F00F-9597-43AD-9E5F-9B344DA3B16F} = {CDE508A5-F5D0-4A59-A4EF-978833830727}
Expand All @@ -568,6 +571,7 @@ Global
{1C9FC4B8-54BC-4B6C-BB3A-F5CD59D80A9B} = {A2E7E470-5EFF-4828-B55E-FCBA3650F51C}
{771F3F1E-7A68-4A9D-ADA8-A24F1D5BE71D} = {3FDD425C-FE01-4B56-863E-1FCDD0677CF5}
{412BCCC8-19F6-489A-B594-E9A506816155} = {771F3F1E-7A68-4A9D-ADA8-A24F1D5BE71D}
{9073ABEF-92E0-4702-BB23-2C99CEF9BDD7} = {4F3CD363-B1E6-4D6D-9466-97D78A56BE45}
{71F356DC-DFA3-4163-8BFE-D268722CE189} = {ED952CF7-84DF-437A-B066-F516E9BE1C2C}
{908C7DD3-C999-40A6-9433-9F5ACA7C36F5} = {71F356DC-DFA3-4163-8BFE-D268722CE189}
{0CE216CE-8072-4985-B248-61F0D0BE9C2E} = {71F356DC-DFA3-4163-8BFE-D268722CE189}
Expand All @@ -584,9 +588,6 @@ Global
{869A9BCC-D303-4365-9BF7-958CD6387916} = {71F356DC-DFA3-4163-8BFE-D268722CE189}
{CDE508A5-F5D0-4A59-A4EF-978833830727} = {0CC4817A-12F3-4357-912C-09315FAAD008}
{9A8996A8-6484-4AA7-B50F-F861430EDE2F} = {4F3CD363-B1E6-4D6D-9466-97D78A56BE45}
{9073ABEF-92E0-4702-BB23-2C99CEF9BDD7} = {4F3CD363-B1E6-4D6D-9466-97D78A56BE45}
{28E5EFE6-C9DD-4FF9-9FEC-532F72DFFA6E} = {4F3CD363-B1E6-4D6D-9466-97D78A56BE45}
{3FDD425C-FE01-4B56-863E-1FCDD0677CF5} = {4F3CD363-B1E6-4D6D-9466-97D78A56BE45}
{4CAE9195-4F1A-4D48-854C-1C9FBC512C66} = {4600328C-C134-499F-AAE2-964E8AD5472C}
{FD4D7A96-79B1-4F89-B64D-29FACCC9232F} = {4CAE9195-4F1A-4D48-854C-1C9FBC512C66}
{E76A4ED5-9137-4E4B-AE91-7AEDB2683823} = {FD4D7A96-79B1-4F89-B64D-29FACCC9232F}
Expand Down

0 comments on commit 0d228f2

Please sign in to comment.