-
Notifications
You must be signed in to change notification settings - Fork 299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow sni version override for testing #3184
Open
mdaigle
wants to merge
3
commits into
main
Choose a base branch
from
dev/mdaigle/testing-sni-override
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
81 changes: 81 additions & 0 deletions
81
eng/pipelines/common/templates/steps/override-sni-version.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
################################################################################# | ||
# 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: Add SNI Validation Feed in Nuget.config | ||
inputs: | ||
targetType: inline | ||
script: | | ||
Write-Host "SNI validation feed to use = ${{parameters.SNIValidationFeed}}" | ||
|
||
# define file to update | ||
$NugetCfg = Join-Path -Path '.' -ChildPath 'NuGet.config' | ||
type $NugetCfg | ||
|
||
# load content of xml from file defined above | ||
$xml = New-Object XML | ||
$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: | | ||
Write-Host "SNI Version to test = ${{parameters.SNIVersion}}" | ||
|
||
# define file to update | ||
$PropsPath = Join-Path -Path '.' -ChildPath 'tools\props\Versions.props' | ||
type $PropsPath | ||
|
||
# load content of xml from file defined above | ||
$xml = New-Object XML | ||
$xml.Load($PropsPath) | ||
|
||
# define namespace used to read a node | ||
$nsm = New-Object Xml.XmlNamespaceManager($xml.NameTable) | ||
$nsm.AddNamespace('ns', $xml.DocumentElement.NamespaceURI) | ||
|
||
# update the node inner text for netfx | ||
$netFxSniVersion = $xml.SelectSingleNode('//ns:MicrosoftDataSqlClientSniVersion', $nsm) | ||
Write-Host "Current .NET Framework SNI Version = $($netFxSniVersion.InnerText)" | ||
$netFxSniVersion.InnerText = "${{parameters.SNIVersion}}" | ||
|
||
# update the node inner text for net core | ||
$netCoreSniVersion = $xml.SelectSingleNode('//ns:MicrosoftDataSqlClientSNIRuntimeVersion', $nsm) | ||
Write-Host "Current .NET Core SNI Version = $($netCoreSniVersion.InnerText)" | ||
$netCoreSniVersion.InnerText = "${{parameters.SNIVersion}}" | ||
|
||
# save the xml file | ||
$xml.Save($PropsPath) | ||
type $PropsPath | ||
- task: NuGetAuthenticate@1 | ||
displayName: 'NuGet Authenticate with SNI Validation Feed' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#Purpose: Updates SNI Version | ||
Write-Host "SNI Version to test = 123" | ||
|
||
##Get the shared SNI Version from the downloaded artifact | ||
#$SharedSNIVersion = Get-Content -path "$(Pipeline.Workspace)/SharedSNIVersion.txt" | ||
|
||
#Get the SNI Version to test from the user entered version. | ||
$SharedSNIVersion = "123" | ||
|
||
# define file to update | ||
$PropsPath = 'C:\Users\mdaigle\SqlClient\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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After spending so much time on the AKV pipeline, I've got a lot of preferences about style for pipeline yaml. On the one hand, I could lay it all out in this PR and make things annoying. On the other hand, I anticipate rewriting this pipeline as well, and we can hold off on stylistic changes until then. Which would you prefer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you're ok with waiting, I'd prefer that. I don't anticipate this to be a long term solution. I had other approaches in mind to facilitate SNI testing, but they were blocked on this pipeline migrating to onebranch. My idea was to keep this small and easily removable.
I'd also be happy to standardize on an IDE and formatter for yaml. Raw yaml editing is not the way to go.