-
Notifications
You must be signed in to change notification settings - Fork 332
Enable SDL Roslyn analysis (incl. internal IA* analyzers) in the OneBranch build #4464
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
base: main
Are you sure you want to change the base?
Changes from all commits
0872d7c
c23bf26
e10842a
0c5751c
5300cc8
fb591ac
8304102
559bd43
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <configuration> | ||
| <!-- Analysis builds select this file explicitly. Keep governed and local in sync with NuGet.config. --> | ||
| <packageSources> | ||
| <clear /> | ||
| <add key="governed" value="https://sqlclientdrivers.pkgs.visualstudio.com/public/_packaging/sqlclient/nuget/v3/index.json" /> | ||
| <add key="local" value="packages/" /> | ||
| <!-- NuGet expands this environment variable before restoring internal analyzer packages. --> | ||
| <add key="internal-analyzers" value="%INTERNAL_ANALYZERS_FEED%" /> | ||
| </packageSources> | ||
| <packageSourceMapping> | ||
| <packageSource key="governed"> | ||
| <package pattern="*" /> | ||
| <!-- Repeat the exact local patterns so these packages remain eligible from governed. --> | ||
| <package pattern="Microsoft.Data.SqlClient" /> | ||
| <package pattern="Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider" /> | ||
| <package pattern="Microsoft.Data.SqlClient.Extensions.Abstractions" /> | ||
| <package pattern="Microsoft.Data.SqlClient.Extensions.Azure" /> | ||
| <package pattern="Microsoft.Data.SqlClient.Internal.Logging" /> | ||
| <package pattern="Microsoft.SqlServer.Server" /> | ||
| </packageSource> | ||
| <!-- Only packages produced by this repository may be restored from the local feed. --> | ||
| <packageSource key="local"> | ||
| <package pattern="Microsoft.Data.SqlClient" /> | ||
| <package pattern="Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider" /> | ||
| <package pattern="Microsoft.Data.SqlClient.Extensions.Abstractions" /> | ||
| <package pattern="Microsoft.Data.SqlClient.Extensions.Azure" /> | ||
| <package pattern="Microsoft.Data.SqlClient.Internal.Logging" /> | ||
| <package pattern="Microsoft.SqlServer.Server" /> | ||
| </packageSource> | ||
| <!-- | ||
| Use the Microsoft.Internal.* prefix instead of only Microsoft.Internal.Analyzers so companion | ||
| or transitive packages in the same internal namespace also restore from this feed. This prefix | ||
| is more specific than the governed/local "*" patterns, so NuGet gives it precedence. | ||
| --> | ||
| <packageSource key="internal-analyzers"> | ||
| <package pattern="Microsoft.Internal.*" /> | ||
| </packageSource> | ||
| </packageSourceMapping> | ||
| </configuration> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,6 +42,19 @@ steps: | |
| # add the new package source | ||
| $packageSources.AppendChild($newSource) | ||
|
|
||
| # Exact mappings take precedence over the governed feed's wildcard, ensuring validation SNI | ||
| # packages are restored from this source. Both package IDs are externally produced and are | ||
| # therefore intentionally not eligible for the repository's local feed. | ||
| $packageSourceMapping = $xml.SelectSingleNode('//ns:packageSourceMapping', $nsm) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This pipeline template was updated for completeness, but no pipelines actually invoke it currently. |
||
| $newMapping = $xml.CreateElement("packageSource") | ||
| $newMapping.SetAttribute("key","SNIValidation") | ||
| foreach ($packageId in @("Microsoft.Data.SqlClient.SNI", "Microsoft.Data.SqlClient.SNI.runtime")) { | ||
| $package = $xml.CreateElement("package") | ||
| $package.SetAttribute("pattern", $packageId) | ||
| $newMapping.AppendChild($package) | ||
| } | ||
| $packageSourceMapping.AppendChild($newMapping) | ||
|
|
||
| # save the xml file | ||
| $xml.Save($NugetCfg) | ||
| type $NugetCfg | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -131,12 +131,13 @@ jobs: | |
| # such as _CheckPwshToolRestored that run during RoslynAnalyzers and Build. | ||
| - template: /eng/pipelines/common/steps/restore-dotnet-tools.yml@self | ||
|
|
||
| # Perform Roslyn analysis before building, since this step will clobber build output. | ||
| # Run Roslyn analysis. This step is self-contained: it performs its own build into an | ||
| # isolated output location, so it can run at any point in the job without clobbering the | ||
| # real build output below. | ||
| - template: /eng/pipelines/onebranch/steps/roslyn-analyzers-buildproj-step.yml@self | ||
| parameters: | ||
| dependencyArguments: $(dependencyPackageArguments) | ||
| packageShortName: ${{ parameters.packageShortName }} | ||
| packageVersion: ${{ parameters.packageVersion }} | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Roslyn template no longer needs this value. |
||
|
|
||
| # Build the package, producing DLLs only (no NuGet package yet). | ||
| - template: /eng/pipelines/onebranch/steps/build-buildproj-step.yml@self | ||
|
|
||
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.
This allows the Official pipelines to inject the internal feed URL.