From bc1a32ee50619c4d0393fe513a9f746bac6a107a Mon Sep 17 00:00:00 2001 From: Paul Medynski <31868385+paulmedynski@users.noreply.github.com> Date: Mon, 19 Jan 2026 09:55:22 -0400 Subject: [PATCH 01/15] Task 41424: Merge feat/azure-split to main: Step 1 - Common changes Make all of the common changes that aren't directly related to the Azure Split work, but set the stage for it and will make subsequent PRs much easier to consume. --- .editorconfig | 2 +- .github/workflows/codeql.yml | 25 +- BUILDGUIDE.md | 123 +++++----- Directory.Packages.props | 41 +++- NuGet.config | 13 +- NuGet.config.local | 19 ++ build.proj | 98 +++++--- eng/pipelines/akv-official-pipeline.yml | 11 +- .../jobs/build-signed-package-job.yml | 52 +++-- .../templates/jobs/ci-build-nugets-job.yml | 80 +++++-- .../templates/jobs/ci-run-tests-job.yml | 108 +++++---- .../jobs/run-tests-package-reference-job.yml | 22 +- .../jobs/validate-signed-package-job.yml | 93 +++----- .../templates/stages/ci-run-tests-stage.yml | 58 +++-- ...ld-all-configurations-signed-dlls-step.yml | 37 +-- .../templates/steps/build-all-tests-step.yml | 73 +++--- .../build-and-run-tests-netcore-step.yml | 65 +++++- .../steps/build-and-run-tests-netfx-step.yml | 66 +++++- .../templates/steps/ci-prebuild-step.yml | 37 +-- .../templates/steps/ci-project-build-step.yml | 53 ++++- .../templates/steps/code-analyze-step.yml | 56 +++-- .../steps/configure-sql-server-step.yml | 6 +- .../steps/copy-dlls-for-test-step.yml | 4 +- .../steps/generate-nuget-package-step.yml | 35 ++- .../templates/steps/publish-symbols-step.yml | 2 +- .../steps/publish-test-results-step.yml | 2 +- .../templates/steps/run-all-tests-step.yml | 157 +++++++++++-- .../steps/update-config-file-step.yml | 7 +- .../update-nuget-config-local-feed-step.yml | 82 +++---- eng/pipelines/dotnet-sqlclient-ci-core.yml | 221 +++++++++--------- ...qlclient-ci-package-reference-pipeline.yml | 17 +- ...qlclient-ci-project-reference-pipeline.yml | 17 +- .../dotnet-sqlclient-signing-pipeline.yml | 15 +- eng/pipelines/jobs/build-akv-official-job.yml | 51 ++-- eng/pipelines/jobs/stress-tests-ci-job.yml | 2 +- eng/pipelines/libraries/build-variables.yml | 4 +- .../libraries/ci-build-variables.yml | 7 +- eng/pipelines/libraries/common-variables.yml | 24 +- .../libraries/mds-validation-variables.yml | 6 +- eng/pipelines/libraries/variables.yml | 2 +- .../sqlclient-pr-package-ref-pipeline.yml | 4 +- .../sqlclient-pr-project-ref-pipeline.yml | 4 +- .../stages/stress-tests-ci-stage.yml | 51 ++-- .../steps/compound-build-akv-step.yml | 12 +- .../steps/compound-nuget-pack-step.yml | 14 +- .../steps/roslyn-analyzers-akv-step.yml | 15 +- .../variables/akv-official-variables.yml | 6 +- src/Directory.Build.props | 11 +- ...waysEncrypted.AzureKeyVaultProvider.csproj | 15 +- .../add-ons/Directory.Build.props | 2 - .../add-ons/Directory.Packages.props | 6 - .../ref/Microsoft.Data.SqlClient.csproj | 7 +- .../src/Microsoft.Data.SqlClient.csproj | 2 +- .../netfx/ref/Microsoft.Data.SqlClient.csproj | 5 +- .../netfx/src/Microsoft.Data.SqlClient.csproj | 6 +- .../src/Microsoft.Data.SqlClient.csproj | 39 +++- .../Data/Common/AdapterUtil.netfx.cs | 3 + .../Connection/SqlConnectionInternal.cs | 46 ++-- .../DbConnectionPoolIdentity.cs | 3 - .../SqlClient/Diagnostics/SqlClientMetrics.cs | 2 + .../Microsoft/Data/SqlClient/SqlDependency.cs | 2 + .../Data/SqlClient/SqlErrorCollection.cs | 7 +- .../Microsoft/Data/SqlClient/SqlException.cs | 13 +- .../src/Microsoft/Data/SqlClient/SqlUtil.cs | 2 + .../src/Microsoft/Data/SqlClient/TdsParser.cs | 22 +- .../Data/SqlClient/TdsParserHelperClasses.cs | 43 +++- .../tests/Common/Common.csproj | 11 +- .../CustomRetryLogicProvider.csproj | 14 +- .../tests/Directory.Build.props | 1 - .../tests/Directory.Packages.props | 5 - .../tests/FunctionalTests/AssertExtensions.cs | 12 +- .../DummySqlAuthenticationProvider.cs | 5 +- .../FunctionalTests/DataCommon/TestUtility.cs | 16 +- .../tests/FunctionalTests/app.config | 1 + ....Data.SqlClient.ManualTesting.Tests.csproj | 40 +++- ...oft.Data.SqlClient.PerformanceTests.csproj | 12 +- .../tests/StressTests/Directory.Build.props | 2 +- .../StressTests/Directory.Packages.props | 15 +- .../Config.cs | 1 + ...rosoft.Data.SqlClient.TestUtilities.csproj | 9 +- .../Utils.cs | 1 - .../config.default.json | 3 +- .../xunit.runner.json | 23 +- .../Microsoft.SqlServer.Server.csproj | 2 +- .../StringsHelper.cs | 4 + tools/props/Versions.props | 67 +++--- tools/specs/Microsoft.Data.SqlClient.nuspec | 143 ++++++------ tools/specs/Microsoft.SqlServer.Server.nuspec | 17 +- ...waysEncrypted.AzureKeyVaultProvider.nuspec | 9 +- ...DllsForNetFxProjectReferenceBuilds.targets | 50 ++++ tools/targets/GenerateMdsPackage.targets | 14 ++ tools/targets/GenerateNugetPackage.targets | 31 --- .../targets/GenerateSqlServerPackage.targets | 13 ++ .../GenerateAKVProviderNugetPackage.targets | 12 - .../add-ons/GenerateAkvPackage.targets | 13 ++ 95 files changed, 1685 insertions(+), 996 deletions(-) create mode 100644 NuGet.config.local delete mode 100644 src/Microsoft.Data.SqlClient/add-ons/Directory.Packages.props create mode 100644 tools/targets/CopySniDllsForNetFxProjectReferenceBuilds.targets create mode 100644 tools/targets/GenerateMdsPackage.targets delete mode 100644 tools/targets/GenerateNugetPackage.targets create mode 100644 tools/targets/GenerateSqlServerPackage.targets delete mode 100644 tools/targets/add-ons/GenerateAKVProviderNugetPackage.targets create mode 100644 tools/targets/add-ons/GenerateAkvPackage.targets diff --git a/.editorconfig b/.editorconfig index 9d8000b43f..7d425474e2 100644 --- a/.editorconfig +++ b/.editorconfig @@ -162,7 +162,7 @@ dotnet_diagnostic.xUnit1031.severity=none dotnet_diagnostic.xUnit1030.severity=none # Xml files -[*.{xml,csproj,stylecop,resx,ruleset,props,targets,config,nuspec}] +[*.{xml,slnx,proj,csproj,stylecop,resx,ruleset,props,targets,config,nuspec}] indent_size = 2 # Shell scripts diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 2197bda5f6..f19ee63bfc 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -13,9 +13,9 @@ name: "CodeQL Advanced" on: push: - branches: [ "main" ] + branches: [ "main", "feat/*" ] pull_request: - branches: [ "main" ] + branches: [ "main", "feat/*" ] schedule: - cron: '33 23 * * 6' @@ -84,9 +84,26 @@ jobs: - name: Run manual build steps if: matrix.build-mode == 'manual' shell: bash + # TODO(https://sqlclientdrivers.visualstudio.com/ADO.Net/_workitems/edit/41729): + # For some reason, the StressTests projects fail to restore in this + # environment, so we skip them by explicitly building all of the other + # projects instead of the main solution file. run: | - mkdir packages - dotnet build src/ + dotnet build src/Microsoft.SqlServer.Server + dotnet build src/Microsoft.Data.SqlClient.Extensions/Abstractions/src + dotnet build src/Microsoft.Data.SqlClient.Extensions/Abstractions/test + dotnet build src/Microsoft.Data.SqlClient/netcore/ref + dotnet build src/Microsoft.Data.SqlClient/netcore/src + dotnet build src/Microsoft.Data.SqlClient/netfx/ref + dotnet build src/Microsoft.Data.SqlClient/netfx/src + dotnet build src/Microsoft.Data.SqlClient/src + dotnet build src/Microsoft.Data.SqlClient.Extensions/Azure/src + dotnet build src/Microsoft.Data.SqlClient.Extensions/Azure/test + dotnet build src/Microsoft.Data.SqlClient/add-ons/AzureKeyVaultProvider + dotnet build src/Microsoft.Data.SqlClient/tests/UnitTests + dotnet build src/Microsoft.Data.SqlClient/tests/FunctionalTests + dotnet build src/Microsoft.Data.SqlClient/tests/ManualTests + dotnet build src/Microsoft.Data.SqlClient/tests/PerformanceTests - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v4 diff --git a/BUILDGUIDE.md b/BUILDGUIDE.md index c168d4cd18..176e329438 100644 --- a/BUILDGUIDE.md +++ b/BUILDGUIDE.md @@ -25,6 +25,8 @@ Once the environment is setup properly, execute the desired set of commands belo ### Targets +The following build targets are defined in `build.proj`: + |Target|Description| |-|-| |`BuildAllConfigurations`|Default target. Builds the .NET Framework and .NET drivers for all target frameworks and operating systems.| @@ -33,20 +35,22 @@ Once the environment is setup properly, execute the desired set of commands belo |`BuildNetFx`|Builds the .NET Framework driver for all target frameworks.| |`BuildTestsNetCore`|Builds tests for the .NET driver.| |`BuildTestsNetFx`|Builds tests for the .NET Framework driver.| -|`Clean`|Cleans generated files.| -|`Restore`|Restores Nuget packages.| +|`Clean`|Cleans all generated files.| +|`Restore`|Restores NuGet packages.| |`RunTests`|Runs the unit, functional, and manual tests for the .NET Framework and .NET drivers| |`RunUnitTests`|Runs just the unit tests for the .NET Framework and .NET drivers| |`RunFunctionalTests`|Runs just the functional tests for the .NET Framework and .NET drivers| |`RunManualTests`|Runs just the manual tests for the .NET Framework and .NET drivers| |`BuildAkv`|Builds the Azure Key Vault Provider package for all supported platforms.| - ### Parameters + +The following parameters may be defined as MSBuild properties to configure the +build: + |Name|Supported Values|Default|Description| |-|-|-|-| |`Configuration`|`Debug`, `Release`|`Debug`|Sets the release configuration.| -|`BuildNetFx`|`true`, `false`|`true` (Windows), `false` (other)|If false, skips building the .NET Framework driver on Windows.| |`OSGroup`|`Unix`, `Windows_NT`, `AnyOS`|typically defaults to the client system's OS, unless using `BuildAllConfigurations` or an `AnyOS` specific target|The operating system to target.| |`Platform`|`AnyCPU`, `x86`, `x64`, `ARM`, `ARM64`|`AnyCPU`|May only be set when using package reference type or running tests.| |`TestSet`|`1`, `2`, `3`, `AE`|all|Build or run a subset of the manual tests. Omit (default) to target all tests.| @@ -54,12 +58,11 @@ Once the environment is setup properly, execute the desired set of commands belo |`TF`|`net8.0`, `net462`, `net47`, `net471`, `net472`, `net48`, `net481`|`net8.0` in netcore, `net462` in netfx|Sets the target framework when building or running tests. Not applicable when building the drivers.| |`ResultsDirectory`|An absolute file path|./TestResults relative to current directory|Specifies where to write test results.| - ## Example Workflows using MSBuild (Recommended) + Using the default configuration and running all tests: ```bash -msbuild msbuild -t:BuildTestsNetFx -p:TF=net462 msbuild -t:BuildTestsNetCore msbuild -t:RunTests @@ -68,28 +71,25 @@ msbuild -t:RunTests Using the Release configuration: ```bash -msbuild -p:configuration=Release -msbuild -t:BuildTestsNetFx -p:TF=net462 -p:configuration=Release -msbuild -t:BuildTestsNetCore -p:configuration=Release -msbuild -t:RunTests -p:configuration=Release +msbuild -t:BuildTestsNetFx -p:TF=net462 -p:Configuration=Release +msbuild -t:BuildTestsNetCore -p:Configuration=Release +msbuild -t:RunTests -p:Configuration=Release ``` Running only the unit tests: ```bash -msbuild msbuild -t:BuildTestsNetFx -p:TF=net462 msbuild -t:BuildTestsNetCore msbuild -t:RunUnitTests ``` -Using a specific dotnet version/architecture: +Using a specific .NET runtime to run tests: ```bash -msbuild -p:configuration=Release -msbuild -t:BuildTestsNetFx -p:TF=net462 -p:configuration=Release -msbuild -t:BuildTestsNetCore -p:configuration=Release -msbuild -t:RunTests -p:configuration=Release -p:DotnetPath=C:\net8-win-x86\ +msbuild -t:BuildTestsNetFx -p:TF=net462 +msbuild -t:BuildTestsNetCore +msbuild -t:RunTests -p:DotnetPath=C:\net8-win-x86\ ``` ### Running Manual Tests @@ -128,15 +128,13 @@ Manual Tests require the below setup to run: |IsManagedInstance | (Optional) When set to `true` **TVP** related tests will use on non-Azure bs files to compare test results. this is needed when testing against Managed Instances or TVP Tests will fail on Test set 3. The default value is `false`. | |PowerShellPath | The full path to PowerShell.exe. This is not required if the path is present in the PATH environment variable. | `D:\\escaped\\absolute\\path\\to\\PowerShell.exe` | - ## Example workflows using the Dotnet SDK -#### Run Functional Tests +### Run Functional Tests - Windows (`netfx x86`): ```bash -msbuild dotnet test "src\Microsoft.Data.SqlClient\tests\FunctionalTests\Microsoft.Data.SqlClient.Tests.csproj" -p:Platform="x86" -p:Configuration="Release" -p:TestTargetOS="Windowsnetfx" --no-build -v n --filter "category!=nonnetfxtests&category!=failing&category!=nonwindowstests" ``` @@ -161,7 +159,8 @@ dotnet test "src\Microsoft.Data.SqlClient\tests\FunctionalTests\Microsoft.Data.S ```bash dotnet test "src/Microsoft.Data.SqlClient/tests/FunctionalTests/Microsoft.Data.SqlClient.Tests.csproj" -p:Platform="AnyCPU" -p:Configuration="Release" -p:TestTargetOS="Unixnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonlinuxtests&category!=nonuaptests" ``` -#### Run Manual Tests + +### Run Manual Tests - Windows (`netfx x86`): @@ -201,37 +200,70 @@ dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlCl ## Testing with Custom ReferenceType -Tests can be built and run with custom "Reference Type" property that enables different styles of testing: +The MDS driver consists of several components, each of which produces its own +NuGet package. During development, components reference each other via +`` properties by default. This means that building +and testing one component will implicitly build its project referenced +dependencies. + +Alternatively, the `ReferenceType` build property property may be specified with +a value of `Package`. This will change inter-component dependencies to use +`` dependencies, and require that dependent components be +built and packaged before building the depending component. In this scenario, +the root `NuGet.config` file must be updated to include the following entry +under the `` element: + +```xml + + + ... + + + +``` -- "Project" => Build and run tests with Microsoft.Data.SqlClient as Project Reference -- "Package" => Build and run tests with Microsoft.Data.SqlClient as Package Reference with configured "TestMicrosoftDataSqlClientVersion" in "Versions.props" file. +As a convenience, a `NuGet.config.local` file is supplied with the above +package source already present. You may simply copy it over `NuGet.config` +when using `Package` references. + +Then, you can specify `Package` references be used, for example: + +```bash +dotnet build -t:BuildAll -p:ReferenceType=Package +dotnet build -t:BuildAKVNetCore -p:ReferenceType=Package +dotnet build -t:GenerateMdsPackage +dotnet build -t:GenerateAkvPackage +dotnet build -t:BuildTestsNetCore -p:ReferenceType=Package +``` -> ************** IMPORTANT NOTE BEFORE PROCEEDING WITH "PACKAGE" REFERENCE TYPE *************** -> CREATE A NUGET PACKAGE WITH BELOW COMMAND AND ADD TO LOCAL FOLDER + UPDATE NUGET CONFIG FILE TO READ FROM THAT LOCATION -> -> ```bash -> msbuild -p:configuration=Release -> ``` +The above will build the MDS and AKV components, place their NuGet packages into +the `packages/` directory, and then build the tests using those packages. -A non-AnyCPU platform reference can only be used with package reference type. Otherwise, the specified platform will be replaced with AnyCPU in the build process. +A non-AnyCPU platform reference can only be used with package reference type. +Otherwise, the specified platform will be replaced with AnyCPU in the build +process. ### Building Tests with Reference Type -For .NET, all 4 reference types are supported: +For .NET: ```bash +# Project is the default reference type. The below commands are equivalent: +msbuild -t:BuildTestsNetCore msbuild -t:BuildTestsNetCore -p:ReferenceType=Project -# Default setting uses Project Reference. +# Package reference type: msbuild -t:BuildTestsNetCore -p:ReferenceType=Package ``` -For .NET Framework, below reference types are supported: +For .NET Framework: ```bash +# Project is the default reference type. The below commands are equivalent: +msbuild -t:BuildTestsNetFx -p:TF=net462 msbuild -t:BuildTestsNetFx -p:TF=net462 -p:ReferenceType=Project -# Default setting uses Project Reference. +# Package reference type: msbuild -t:BuildTestsNetFx -p:TF=net462 -p:ReferenceType=Package ``` @@ -250,26 +282,25 @@ Tests can be built and run with custom Target Frameworks. See the below examples ### Building Tests with custom target framework ```bash -msbuild -t:BuildTestsNetFx -p:TF=net462 # Build the tests for custom .NET Framework target +msbuild -t:BuildTestsNetFx -p:TF=net462 ``` ```bash -msbuild -t:BuildTestsNetCore -p:TF=net8.0 # Build the tests for custom .NET target +msbuild -t:BuildTestsNetCore -p:TF=net8.0 ``` ### Running Tests with custom target framework (traditional) ```bash +# Run tests with custom .NET Framework target dotnet test -p:TargetNetFxVersion=net462 ... -# Use above property to run Functional Tests with custom .NET Framework target +# Run tests with custom .NET target dotnet test -p:TargetNetCoreVersion=net8.0 ... -# Use above property to run Functional Tests with custom .NET target ``` - ## Using Managed SNI on Windows Managed SNI can be enabled on Windows by enabling the below AppContext switch: @@ -294,20 +325,6 @@ When connecting to a server, if a protocol lower than TLS 1.2 is negotiated, a s `Switch.Microsoft.Data.SqlClient.SuppressInsecureTLSWarning` -### Troubleshooting Docker issues - -There may be times where connection cannot be made to SQL Server, we found below ideas helpful: - -- Clear Docker images to create clean image from time-to-time, and clear docker cache if needed by running `docker system prune` in Command Prompt. - -- If you face `Microsoft.Data.SqlClient.SNI.dll not found` errors when debugging, try updating the below properties in the netcore\Microsoft.Data.SqlClient.csproj file and try again: - - ```xml - Unix - false - true - ``` - ## Collecting Code Coverage ### Using VSTest diff --git a/Directory.Packages.props b/Directory.Packages.props index c339554838..33c19e1d2c 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -3,15 +3,30 @@ true true + + + + + + + + + - + + - + + @@ -20,7 +35,8 @@ - + + @@ -40,7 +56,8 @@ - + + @@ -54,14 +71,17 @@ --> + + - + + @@ -73,11 +93,13 @@ + + @@ -89,12 +111,17 @@ - + + + - + + + + diff --git a/NuGet.config b/NuGet.config index 3233e60161..6c4f535818 100644 --- a/NuGet.config +++ b/NuGet.config @@ -1,7 +1,18 @@  + + - + + + diff --git a/NuGet.config.local b/NuGet.config.local new file mode 100644 index 0000000000..3e23ac372c --- /dev/null +++ b/NuGet.config.local @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + diff --git a/build.proj b/build.proj index d42e94b50c..6154b7c4c3 100644 --- a/build.proj +++ b/build.proj @@ -2,8 +2,9 @@ - - + + + @@ -27,10 +28,13 @@ $(TF) $(TF) true - Configuration=$(Configuration);AssemblyVersion=$(SqlServerAssemblyVersion);AssemblyFileVersion=$(SqlServerAssemblyFileVersion);Version=$(SqlServerPackageVersion); - Configuration=$(Configuration);AssemblyFileVersion=$(AssemblyFileVersion);TargetsWindows=$(TargetsWindows);TargetsUnix=$(TargetsUnix); - BuildProjectReferences=false;$(ProjectProperties);BuildForRelease=false;TargetNetCoreVersion=$(TargetNetCoreVersion);TargetNetFxVersion=$(TargetNetFxVersion) + + Configuration=$(Configuration);ReferenceType=$(ReferenceType) + $(CommonProperties);AssemblyVersion=$(SqlServerAssemblyVersion);AssemblyFileVersion=$(SqlServerAssemblyFileVersion);Version=$(SqlServerPackageVersion); + $(CommonProperties);AssemblyFileVersion=$(AssemblyFileVersion);TargetsWindows=$(TargetsWindows);TargetsUnix=$(TargetsUnix); + $(ProjectProperties);BuildForRelease=false;TargetNetCoreVersion=$(TargetNetCoreVersion);TargetNetFxVersion=$(TargetNetFxVersion) TestResults + + @@ -89,43 +94,56 @@ - - - + + + + - + - - + + - + - - + + - + - - - dotnet build -c Release -p:ReferenceType=$(ReferenceType) - - + + + + + + - + @@ -134,19 +152,23 @@ - + - + - + - + @@ -169,7 +191,7 @@ - + @@ -320,13 +342,12 @@ - + - - - - - + + + + @@ -362,7 +383,10 @@ - + @@ -372,7 +396,9 @@ - + @@ -382,7 +408,9 @@ - + diff --git a/eng/pipelines/akv-official-pipeline.yml b/eng/pipelines/akv-official-pipeline.yml index d7bc900bb8..f21ca656d3 100644 --- a/eng/pipelines/akv-official-pipeline.yml +++ b/eng/pipelines/akv-official-pipeline.yml @@ -49,7 +49,7 @@ resources: ref: 'refs/heads/main' extends: - template: 'v2/OneBranch.${{ parameters.oneBranchType }}.CrossPlat.yml@templates' + template: /v2/OneBranch.${{ parameters.oneBranchType }}.CrossPlat.yml@templates parameters: featureFlags: @@ -105,7 +105,8 @@ extends: roslyn: enabled: ${{ parameters.runSdlTasks }} break: true - # Requires RoslynAnalyzers task to be added after build task + # Requires RoslynAnalyzers task to be added somewhere in + # the build stage. publishLogs: enabled: ${{ parameters.runSdlTasks }} @@ -113,7 +114,7 @@ extends: sbom: enabled: ${{ parameters.runSdlTasks }} packageName: 'Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider' - packageVersion: ${{ variables.nugetPackageVersion }} + packageVersion: ${{ variables.akvPackageVersion }} tsa: # OneBranch publishes all sdl results to TSA. If TSA is disabled all SDL tools will @@ -127,11 +128,11 @@ extends: jobs: - template: /eng/pipelines/jobs/build-akv-official-job.yml@self parameters: + akvAssemblyFileVersion: '${{ variables.assemblyFileVersion }}' + akvPackageVersion: '${{ variables.akvPackageVersion }}' apiScanDllPath: '${{ variables.apiScanDllPath }}' apiScanPdbPath: '${{ variables.apiScanPdbPath }}' - assemblyFileVersion: '${{ variables.assemblyFileVersion }}' buildConfiguration: '${{ parameters.buildConfiguration }}' - nugetPackageVersion: '${{ variables.nugetPackageVersion }}' mdsPackageVersion: '${{ variables.mdsPackageVersion }}' publishSymbols: '${{ parameters.publishSymbols }}' signingAppRegistrationClientId: '$(SigningAppRegistrationClientId)' diff --git a/eng/pipelines/common/templates/jobs/build-signed-package-job.yml b/eng/pipelines/common/templates/jobs/build-signed-package-job.yml index a482761610..af47081ed3 100644 --- a/eng/pipelines/common/templates/jobs/build-signed-package-job.yml +++ b/eng/pipelines/common/templates/jobs/build-signed-package-job.yml @@ -25,10 +25,10 @@ jobs: type: windows # read more about custom job pool types at https://aka.ms/obpipelines/yaml/jobs variables: - - template: ../../../libraries/variables.yml@self + - template: /eng/pipelines/libraries/variables.yml@self - ${{ if parameters.isPreview }}: - - name: NugetPackageVersion - value: $(PreviewNugetPackageVersion) + - name: mdsPackageVersion + value: $(previewMdsPackageVersion) steps: - script: SET @@ -37,37 +37,59 @@ jobs: - powershell: | Write-Host "##vso[task.setvariable variable=CDP_BUILD_TYPE_COPY;isOutput=true]$($env:CDP_BUILD_TYPE)" name: GetBuildType + + # Build our tooling, which is required by the analysis step below, but + # shouldn't be analyzed itself. + - task: MSBuild@1 + displayName: 'Build Tooling' + inputs: + solution: '**/build.proj' + configuration: $(Configuration) + msbuildArguments: -t:BuildTools + + # Perform analysis before building, since this step will clobber build output. + - template: /eng/pipelines/common/templates/steps/code-analyze-step.yml@self - - template: ../steps/build-all-configurations-signed-dlls-step.yml@self + # Update the root NuGet.config to use the packages/ directory as a source. + - template: /eng/pipelines/common/templates/steps/update-nuget-config-local-feed-step.yml@self parameters: - buildConfiguration: Release + packagePath: $(REPOROOT)/packages - - template: ../steps/code-analyze-step.yml@self + # Build MDS in Package mode, producing signed DLLs. + - template: /eng/pipelines/common/templates/steps/build-all-configurations-signed-dlls-step.yml@self parameters: - analyzeType: all - - - template: ../steps/esrp-code-signing-step.yml@self + buildConfiguration: $(Configuration) + # These variables are sourced from common-variables.yml. + mdsAssemblyFileVersion: $(mdsAssemblyFileVersion) + mdsPackageVersion: $(mdsPackageVersion) + referenceType: Package + + - template: /eng/pipelines/common/templates/steps/esrp-code-signing-step.yml@self parameters: artifactType: dll - - template: ../steps/generate-nuget-package-step.yml@self + - template: /eng/pipelines/common/templates/steps/generate-nuget-package-step.yml@self parameters: buildConfiguration: Release - OutputDirectory: $(artifactDirectory) + displayName: 'Create MDS NuGet Package' installNuget: false + nuspecPath: $(nuspecPath) + outputDirectory: $(artifactDirectory) + packageVersion: $(mdsPackageVersion) + referenceType: Package - - template: ../steps/esrp-code-signing-step.yml@self + - template: /eng/pipelines/common/templates/steps/esrp-code-signing-step.yml@self parameters: artifactType: pkg - - template: ../steps/copy-dlls-for-test-step.yml@self + - template: /eng/pipelines/common/templates/steps/copy-dlls-for-test-step.yml@self parameters: buildConfiguration: Release product: MDS # Publish symbols to servers - - template: ../steps/publish-symbols-step.yml@self + - template: /eng/pipelines/common/templates/steps/publish-symbols-step.yml@self parameters: buildConfiguration: Release publishSymbols: ${{ parameters['PublishSymbols'] }} - symbolsArtifactName: mds_symbols_$(System.TeamProject)_$(Build.Repository.Name)_$(Build.SourceBranchName)_$(NuGetPackageVersion)_$(System.TimelineId) + symbolsArtifactName: mds_symbols_$(System.TeamProject)_$(Build.Repository.Name)_$(Build.SourceBranchName)_$(mdsPackageVersion)_$(System.TimelineId) diff --git a/eng/pipelines/common/templates/jobs/ci-build-nugets-job.yml b/eng/pipelines/common/templates/jobs/ci-build-nugets-job.yml index 7ed13a45a9..1951c3ed37 100644 --- a/eng/pipelines/common/templates/jobs/ci-build-nugets-job.yml +++ b/eng/pipelines/common/templates/jobs/ci-build-nugets-job.yml @@ -4,6 +4,17 @@ # See the LICENSE file in the project root for more information. # ################################################################################# parameters: + + - name: 'debug' + type: boolean + default: false + + - name: referenceType + type: string + values: + - Package + - Project + - name: poolName type: string default: $(ci_var_defaultPoolName) @@ -12,9 +23,9 @@ parameters: type: string default: ADO-MMS22-SQL19 - - name: artifactName + - name: mdsArtifactName type: string - default: Artifacts + default: MDS.Artifact - name: platform type: string @@ -30,8 +41,12 @@ parameters: type: stepList default: [] + - name: mdsPackageVersion + type: string + jobs: -- job: build_nugets +- job: build_mds_akv_packages_job + displayName: Build MDS & AKV Packages pool: name: ${{parameters.poolName }} @@ -40,12 +55,22 @@ jobs: - msbuild variables: - - template: ../../../libraries/ci-build-variables.yml@self + - template: /eng/pipelines/libraries/ci-build-variables.yml@self steps: - ${{ if ne(parameters.prebuildSteps, '') }}: - ${{ parameters.prebuildSteps }} # extra steps to run before the build like downloading sni and the required configuration + # If we're testing in Package mode, create the packages/ directory and then + # setup the top-level NuGet.config to look in packages/ for local NuGet + # dependencies. + - ${{ if eq(parameters.referenceType, 'Package') }}: + - pwsh: New-Item -Path "$(RepoRoot)/packages" -ItemType Directory -Force + - template: /eng/pipelines/common/templates/steps/ci-prebuild-step.yml@self + parameters: + debug: ${{ parameters.debug }} + referenceType: ${{ parameters.referenceType }} + # Install the .NET SDK. - template: /eng/pipelines/steps/install-dotnet.yml@self @@ -54,41 +79,54 @@ jobs: # compilation errors. We won't use the Release artifacts for anything else # though. - ${{ if eq(parameters.buildConfiguration, 'Debug') }}: - - template: ../steps/ci-project-build-step.yml@self + - template: /eng/pipelines/common/templates/steps/ci-project-build-step.yml@self parameters: platform: ${{ parameters.platform }} buildConfiguration: Release operatingSystem: Windows build: all - - template: ../steps/ci-project-build-step.yml@self + - template: /eng/pipelines/common/templates/steps/ci-project-build-step.yml@self parameters: platform: ${{ parameters.platform }} buildConfiguration: ${{ parameters.buildConfiguration }} + referenceType: ${{ parameters.referenceType }} operatingSystem: Windows - build: all + build: MDS - - template: ../steps/generate-nuget-package-step.yml@self + - template: /eng/pipelines/common/templates/steps/generate-nuget-package-step.yml@self parameters: - NugetPackageVersion: $(NugetPackageVersion) buildConfiguration: ${{ parameters.buildConfiguration }} - nuspecPath: 'tools/specs/Microsoft.Data.SqlClient.nuspec' - OutputDirectory: $(packagePath) + displayName: 'Create MDS NuGet Package' generateSymbolsPackage: false - displayName: 'Generate NuGet package M.D.SqlClient' + packageVersion: ${{ parameters.mdsPackageVersion }} + nuspecPath: 'tools/specs/Microsoft.Data.SqlClient.nuspec' + outputDirectory: $(packagePath) + referenceType: ${{ parameters.referenceType }} - - template: ../steps/generate-nuget-package-step.yml@self + - template: /eng/pipelines/common/templates/steps/ci-project-build-step.yml@self parameters: - NugetPackageVersion: $(NugetPackageVersion) + platform: ${{ parameters.platform }} buildConfiguration: ${{ parameters.buildConfiguration }} - nuspecPath: 'tools/specs/add-ons/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.nuspec' - OutputDirectory: $(packagePath) + referenceType: ${{ parameters.referenceType }} + operatingSystem: Windows + build: AKV + mdsPackageVersion: ${{parameters.mdsPackageVersion}} + + - template: /eng/pipelines/common/templates/steps/generate-nuget-package-step.yml@self + parameters: + buildConfiguration: ${{ parameters.buildConfiguration }} + displayName: 'Create AKV NuGet Package' generateSymbolsPackage: false installNuget: false - displayName: 'Generate NuGet package AKV Provider' + nuspecPath: 'tools/specs/add-ons/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.nuspec' + outputDirectory: $(packagePath) + packageVersion: $(akvPackageVersion) + properties: 'MdsPackageVersion=${{ parameters.mdsPackageVersion }}' + referenceType: ${{ parameters.referenceType }} - - task: PublishBuildArtifacts@1 - displayName: 'Publish Artifact: Artifacts' + - task: PublishPipelineArtifact@1 + displayName: 'Publish Pipeline Artifact' inputs: - PathtoPublish: $(packagePath) - ArtifactName: ${{ parameters.artifactName }} + targetPath: $(packagePath) + artifactName: ${{ parameters.mdsArtifactName }} diff --git a/eng/pipelines/common/templates/jobs/ci-run-tests-job.yml b/eng/pipelines/common/templates/jobs/ci-run-tests-job.yml index 8ac7bcf087..b5ed70fd3f 100644 --- a/eng/pipelines/common/templates/jobs/ci-run-tests-job.yml +++ b/eng/pipelines/common/templates/jobs/ci-run-tests-job.yml @@ -4,12 +4,25 @@ # See the LICENSE file in the project root for more information. # ################################################################################# parameters: + - name: configProperties + type: object + default: {} # - key: 'value' + + - name: configSqlFor + type: string # local, azure, or enclave + default: local + - name: debug type: boolean default: false - - name: poolName - type: string + - name: enableX64Test + type: boolean + default: true + + - name: enableX86Test + type: boolean + default: false - name: hostedPool type: boolean @@ -21,46 +34,14 @@ parameters: - name: jobDisplayName type: string - - name: usemanagedSNI - type: boolean - default: false - - - name: configProperties - type: object - default: {} # - key: 'value' - - - name: prebuildSteps - type: stepList - default: [] - - - name: artifactName + - name: mdsArtifactName type: string - default: Artifacts - - name: targetFramework + - name: mdsPackageVersion type: string - name: netcoreVersionTestUtils type: string - - - name: enableX86Test - type: boolean - default: false - - - name: enableX64Test - type: boolean - default: true - - - name: testSet - type: string - - - name: publishTestResults - type: boolean - default: false - - - name: configSqlFor - type: string # local, azure, or enclave - default: local - name: operatingSystem type: string @@ -71,13 +52,30 @@ parameters: values: - Debug - Release + + - name: poolName + type: string + + - name: prebuildSteps + type: stepList + default: [] - - name: buildType - default: Project + - name: publishTestResults + type: boolean + default: false + + - name: referenceType + type: string values: - Project - Package + - name: targetFramework + type: string + + - name: testSet + type: string + # The timeout, in minutes, for this job. - name: timeout type: number @@ -87,6 +85,10 @@ parameters: type: boolean default: false + - name: usemanagedSNI + type: boolean + default: false + jobs: - job: ${{ format('{0}', coalesce(parameters.jobDisplayName, parameters.image, 'unknown_image')) }} @@ -108,6 +110,15 @@ jobs: steps: + # If we're testing in Package mode, download the MDS package + # artifacts and put them in the packages/ directory in the repo root. + - ${{ if eq(parameters.referenceType, 'Package') }}: + - task: DownloadPipelineArtifact@2 + displayName: Download MDS Package Artifact + inputs: + artifactName: ${{ parameters.mdsArtifactName }} + targetPath: $(Build.SourcesDirectory)/packages + # Install the .NET SDK and Runtimes. - template: /eng/pipelines/steps/install-dotnet.yml@self parameters: @@ -146,7 +157,7 @@ jobs: buildConfiguration: ${{ parameters.buildConfiguration }} - ${{ if ne(parameters.configProperties, '{}') }}: - - template: ../steps/update-config-file-step.yml@self # update config.json file + - template: /eng/pipelines/common/templates/steps/update-config-file-step.yml@self # update config.json file parameters: debug: ${{ parameters.debug }} UseManagedSNIOnWindows: ${{ parameters.usemanagedSNI }} @@ -221,7 +232,7 @@ jobs: displayName: 'Start Sql Browser' condition: eq(variables['Agent.OS'], 'Windows_NT') - ${{ elseif eq(parameters.configSqlFor, 'local') }}: - - template: ../steps/configure-sql-server-step.yml@self # configure SQL Server + - template: /eng/pipelines/common/templates/steps/configure-sql-server-step.yml@self # configure SQL Server parameters: operatingSystem: ${{ parameters.operatingSystem }} netcoreVersionTestUtils: ${{ parameters.netcoreVersionTestUtils }} @@ -252,22 +263,23 @@ jobs: ${{ if parameters.configProperties.FileStreamDirectory }}: fileStreamDirectory: ${{ parameters.configProperties.FileStreamDirectory }} - - template: ../steps/build-all-tests-step.yml@self # build tests + - template: /eng/pipelines/common/templates/steps/build-all-tests-step.yml@self # build tests parameters: targetFramework: ${{ parameters.targetFramework }} buildConfiguration: ${{ parameters.buildConfiguration }} - referenceType: ${{ parameters.buildType }} + referenceType: ${{ parameters.referenceType }} testSet: ${{ parameters.testSet }} + mdsPackageVersion: ${{ parameters.mdsPackageVersion }} ${{ if ne(parameters.operatingSystem, 'Windows') }}: OSGroup: Unix - ${{ if eq(parameters.enableX64Test, true) }}: # run native tests - - template: ../steps/run-all-tests-step.yml@self # run tests + - template: /eng/pipelines/common/templates/steps/run-all-tests-step.yml@self # run tests parameters: debug: ${{ parameters.debug }} targetFramework: ${{ parameters.targetFramework }} buildConfiguration: ${{ parameters.buildConfiguration }} - referenceType: ${{ parameters.buildType }} + referenceType: ${{ parameters.referenceType }} testSet: ${{ parameters.testSet }} operatingSystem: ${{ parameters.operatingSystem }} @@ -286,19 +298,19 @@ jobs: installDir: $(dotnetx86RootPath) runtimes: [8.x, 9.x] - - template: ../steps/run-all-tests-step.yml@self + - template: /eng/pipelines/common/templates/steps/run-all-tests-step.yml@self parameters: debug: ${{ parameters.debug }} targetFramework: ${{ parameters.targetFramework }} buildConfiguration: ${{ parameters.buildConfiguration }} - referenceType: ${{ parameters.buildType }} + referenceType: ${{ parameters.referenceType }} testSet: ${{ parameters.testSet }} msbuildArchitecture: x86 dotnetx86RootPath: $(dotnetx86RootPath) operatingSystem: ${{ parameters.operatingSystem }} - - ${{ if and(eq(parameters.publishTestResults, true), eq(parameters.buildType, 'Project')) }}: # publish test results if build type is project - - template: ../steps/publish-test-results-step.yml@self + - ${{ if and(eq(parameters.publishTestResults, true), eq(parameters.referenceType, 'Project')) }}: # publish test results if build type is project + - template: /eng/pipelines/common/templates/steps/publish-test-results-step.yml@self parameters: debug: ${{ parameters.debug }} targetFramework: ${{ parameters.targetFramework }} diff --git a/eng/pipelines/common/templates/jobs/run-tests-package-reference-job.yml b/eng/pipelines/common/templates/jobs/run-tests-package-reference-job.yml index 59700587f7..3817fcb483 100644 --- a/eng/pipelines/common/templates/jobs/run-tests-package-reference-job.yml +++ b/eng/pipelines/common/templates/jobs/run-tests-package-reference-job.yml @@ -41,39 +41,37 @@ jobs: vmImage: 'ADO-MMS22-SQL19' variables: # More settings at https://aka.ms/obpipelines/yaml/jobs - - template: ../../../libraries/mds-validation-variables.yml@self + - template: /eng/pipelines/libraries/mds-validation-variables.yml@self steps: - - template: ../steps/pre-build-step.yml + - template: /eng/pipelines/common/templates/steps/pre-build-step.yml - ${{parameters.downloadPackageStep }} - - template: ../steps/update-nuget-config-local-feed-step.yml + - template: /eng/pipelines/common/templates/steps/update-nuget-config-local-feed-step.yml parameters: - downloadedNugetPath: $(Pipeline.Workspace)\${{parameters.packageFolderName }} - ${{ if parameters.isPreview }}: - nugetPackageVersion: $(PreviewNugetPackageVersion) + packagePath: $(Pipeline.Workspace)\${{parameters.packageFolderName }} - - template: ../steps/update-config-file-step.yml + - template: /eng/pipelines/common/templates/steps/update-config-file-step.yml parameters: TCPConnectionString: $(SQL_TCP_CONN_STRING) NPConnectionString: $(SQL_NP_CONN_STRING) SupportsIntegratedSecurity: false - - template: ../steps/prepare-test-db-step.yml + - template: /eng/pipelines/common/templates/steps/prepare-test-db-step.yml # build & test - - template: ../steps/build-and-run-tests-netfx-step.yml + - template: /eng/pipelines/common/templates/steps/build-and-run-tests-netfx-step.yml parameters: referenceType: Package buildConfiguration: Release ${{ if parameters.isPreview }}: - nugetPackageVersion: $(PreviewNugetPackageVersion) + mdsPackageVersion: $(previewMdsPackageVersion) - - template: ../steps/build-and-run-tests-netcore-step.yml + - template: /eng/pipelines/common/templates/steps/build-and-run-tests-netcore-step.yml parameters: referenceType: Package buildConfiguration: Release cleanFirst: true ${{ if parameters.isPreview }}: - nugetPackageVersion: $(PreviewNugetPackageVersion) + mdsPackageVersion: $(previewMdsPackageVersion) diff --git a/eng/pipelines/common/templates/jobs/validate-signed-package-job.yml b/eng/pipelines/common/templates/jobs/validate-signed-package-job.yml index 009e6f2647..b734f70de7 100644 --- a/eng/pipelines/common/templates/jobs/validate-signed-package-job.yml +++ b/eng/pipelines/common/templates/jobs/validate-signed-package-job.yml @@ -25,14 +25,6 @@ parameters: - pdb - both - - name: assembly_file_version_netfx - type: string - default: $(AssemblyFileVersion) - - - name: assembly_file_version_core - type: string - default: $(AssemblyFileVersion) - - name: isPreview type: boolean @@ -48,24 +40,19 @@ jobs: vmImage: 'ADO-MMS22-SQL19' variables: # More settings at https://aka.ms/obpipelines/yaml/jobs - - template: ../../../libraries/mds-validation-variables.yml@self + - template: /eng/pipelines/libraries/mds-validation-variables.yml@self - name: pathToDownloadedNuget # path to the downloaded nuget files value: $(Pipeline.Workspace)\${{parameters.packageFolderName }} - - name: ProductVersion #MDS product version (MDS validation) - value: $(NugetPackageVersion) - - name: BuildType value: $[ stageDependencies.buildMDS.build_signed_package.outputs['GetBuildType.CDP_BUILD_TYPE_COPY'] ] - ${{ if parameters.isPreview }}: - name: extractedNugetPath - value: $(extractedNugetRootPath).$(PreviewNugetPackageVersion) - - name: NugetPackageVersion - value: $(PreviewNugetPackageVersion) - - name: ProductVersion - value: $(PreviewNugetPackageVersion) + value: $(extractedNugetRootPath).$(previewMdsPackageVersion) + - name: mdsPackageVersion + value: $(previewMdsPackageVersion) steps: - script: SET @@ -75,7 +62,7 @@ jobs: displayName: 'Use NuGet' - powershell: | - #Sets Variables for AssemblyFileVersion, AssemblyVersion and NugetPackageVersion + # Sets the pipeline ASSEMBLY_VERSION variable. [Xml] $versionprops = Get-Content -Path ".\tools\props\Versions.props" Write-Host $versionprops.Project.PropertyGroup[0].AssemblyFileVersion @@ -283,71 +270,53 @@ jobs: displayName: 'Verify all dlls status are Valid' - powershell: | - # This will check for ProductVersion and FileVersion. - # - # For NetFx we have a different FileVersion, but product versions are all - # the same. Some may have extra numbering at the end. We only check for - # the first parts. + # This will check each DLL's ProductVersion and FileVersion against + # expected values. + $failed = 0 foreach ( $pVersion in Get-ChildItem *.dll -Path $(extractedNugetPath) -Recurse | ForEach-Object versioninfo ) { - if ($pVersion.ProductVersion -Like '$(ProductVersion)*') + if ($pVersion.ProductVersion -Like '$(mdsPackageVersion)*') { - Write-Host Valid Product Version:"$pVersion.ProductVersion" $pVersion.ProductVersion detected for $pVersion.FileName -ForegroundColor Green + Write-Host -ForegroundColor Green "Correct ProductVersion detected for $($pVersion.FileName): $($pVersion.ProductVersion)" } else { - Write-Host "Wrong ProductVersion detected. Expected: '$(ProductVersion)', but Detected: "$pVersion.ProductVersion"" - Exit -1 + Write-Host -ForegroundColor Red "Wrong ProductVersion detected for $($pVersion.FileName); expected: $(mdsPackageVersion); found: $($pVersion.ProductVersion)" + $failed = 1 } - if($pVersion.FileName -like '*lib\$(CurrentNetFxVersion)*'){ - - if($pVersion.FileVersion -eq '${{parameters.assembly_file_version_netfx }}') - { - Write-Host 'Correct File version Detected for net46,' $pVersion.FileVersion -ForegroundColor Green - } - else - { - Write-Host 'Wrong File version Detected for net46,' $pVersion.FileVersion -ForegroundColor Red - Exit -1 - } + if ($pVersion.FileVersion -eq '$(mdsAssemblyFileVersion)') + { + Write-Host -ForegroundColor Green "Correct FileVersion detected for $($pVersion.FileName): $($pVersion.FileVersion)" } else { - - if($pVersion.FileVersion -eq '${{parameters.assembly_file_version_core}}') - { - Write-Host 'Correct File version Detected for netcore,' $pVersion.FileVersion -ForegroundColor Green - } - else - { - Write-Host 'Wrong File version Detected for netcore and ref folder,' $pVersion.FileVersion -ForegroundColor Red - Exit -1 - } + Write-Host -ForegroundColor Red "Wrong FileVersion detected for $($pVersion.FileName); expected $(mdsAssemblyFileVersion); found: $($pVersion.FileVersion)" + $failed = 1 } } - Get-ChildItem *.dll -Path $(extractedNugetPath) -Recurse | ForEach-Object versioninfo - displayName: 'Verify "File Version" matches provided pipeline variable "ASSEMBLY_FILE_VERSION" for DLLs' - - - powershell: | - # Change TestMicrosoftDataSqlClientVersion - - [Xml] $versionprops = Get-Content -Path "tools/props/Versions.props" - $versionpropspath = "tools\props\Versions.props" - $versionprops.Project.PropertyGroup[$versionprops.Project.PropertyGroup.Count-1].TestMicrosoftDataSqlClientVersion ="$(NugetPackageVersion)" - Write-Host "Saving Test nuget version at $rootfolder\props ...." -ForegroundColor Green - $versionprops.Save($versionpropspath) + if ($failed -ne 0) + { + Exit -1 + } - displayName: 'Modify TestMicrosoftDataSqlClientVersion' + Get-ChildItem *.dll -Path $(extractedNugetPath) -Recurse | ForEach-Object VersionInfo | Format-List + displayName: 'Verify "File Version" matches expected values for DLLs' - powershell: | # Check assembly versions. + # + # GOTCHA: This expects the Versions.props file having XML elements in a + # certain order. If the order changes, this check will fail! + # + # TODO: This also isn't checking the versions of the actual assemblies in + # the package, so it isn't terribly useful. [Xml] $versionprops = Get-Content -Path "tools/props/Versions.props" - $AssemblyFileVersion = $versionprops.Project.PropertyGroup[0].AssemblyFileVersion - $AssemblyVersion = $versionprops.Project.PropertyGroup[0].AssemblyVersion + $AssemblyFileVersion = $versionprops.Project.PropertyGroup[2].AssemblyFileVersion + $AssemblyVersion = $versionprops.Project.PropertyGroup[2].AssemblyVersion if($AssemblyFileVersion -eq $AssemblyVersion) { diff --git a/eng/pipelines/common/templates/stages/ci-run-tests-stage.yml b/eng/pipelines/common/templates/stages/ci-run-tests-stage.yml index 7676574451..ca09328738 100644 --- a/eng/pipelines/common/templates/stages/ci-run-tests-stage.yml +++ b/eng/pipelines/common/templates/stages/ci-run-tests-stage.yml @@ -4,37 +4,44 @@ # See the LICENSE file in the project root for more information. # ################################################################################# parameters: + - name: buildConfiguration + type: string + values: + - Debug + - Release + - name: debug type: boolean default: false - - name: testConfigurations + - name: dependsOn type: object + default: [] - - name: dependsOn + - name: mdsArtifactName type: string - default: '' + default: MDS.Artifact - - name: buildType - default: Project - values: - - Project - - Package - - - name: buildConfiguration + - name: mdsPackageVersion type: string - values: - - Debug - - Release - - - name: prebuildSteps - type: stepList - default: [] - name: postTestJobs type: jobList default: [] + - name: prebuildSteps + type: stepList + default: [] + + - name: referenceType + default: Project + values: + - Project + - Package + + - name: testConfigurations + type: object + # The timeout, in minutes, for each test job. - name: testJobTimeout type: number @@ -43,26 +50,25 @@ stages: - ${{ each config in parameters.testConfigurations }}: - ${{ each image in config.value.images }}: - stage: ${{ image.key }} - ${{ if ne(parameters.dependsOn, '') }}: - dependsOn: ${{ parameters.dependsOn }} - ${{ else }}: - dependsOn: [] + dependsOn: ${{ parameters.dependsOn }} jobs: - ${{ each targetFramework in config.value.TargetFrameworks }}: - ${{ each platform in config.value.buildPlatforms }}: - ${{ each testSet in config.value.TestSets }}: - ${{ if contains(targetFramework, 'net4') }}: # .NET Framework - - template: ../jobs/ci-run-tests-job.yml@self + - template: /eng/pipelines/common/templates/jobs/ci-run-tests-job.yml@self parameters: debug: ${{ parameters.debug }} buildConfiguration: ${{ parameters.buildConfiguration }} - buildType: ${{ parameters.buildType }} + referenceType: ${{ parameters.referenceType }} timeout: ${{ parameters.testJobTimeout }} poolName: ${{ config.value.pool }} hostedPool: ${{ eq(config.value.hostedPool, true) }} image: ${{ image.value }} jobDisplayName: ${{ format('{0}_{1}_{2}', replace(targetFramework, '.', '_'), platform, testSet) }} configProperties: ${{ config.value.configProperties }} + mdsArtifactName: ${{ parameters.mdsArtifactName }} + mdsPackageVersion: ${{ parameters.mdsPackageVersion }} prebuildSteps: ${{ parameters.prebuildSteps }} targetFramework: ${{ targetFramework }} netcoreVersionTestUtils: ${{config.value.netcoreVersionTestUtils }} @@ -80,11 +86,11 @@ stages: enableX64Test: false - ${{ else }}: # .NET - ${{ each useManagedSNI in config.value.useManagedSNI }}: - - template: ../jobs/ci-run-tests-job.yml@self + - template: /eng/pipelines/common/templates/jobs/ci-run-tests-job.yml@self parameters: debug: ${{ parameters.debug }} buildConfiguration: ${{ parameters.buildConfiguration }} - buildType: ${{ parameters.buildType }} + referenceType: ${{ parameters.referenceType }} timeout: ${{ parameters.testJobTimeout }} poolName: ${{ config.value.pool }} hostedPool: ${{ eq(config.value.hostedPool, true) }} @@ -95,6 +101,8 @@ stages: jobDisplayName: ${{ format('{0}_{1}_{2}_{3}', replace(targetFramework, '.', '_'), platform, 'NativeSNI', testSet) }} configProperties: ${{ config.value.configProperties }} useManagedSNI: ${{ useManagedSNI }} + mdsArtifactName: ${{ parameters.mdsArtifactName }} + mdsPackageVersion: ${{ parameters.mdsPackageVersion }} prebuildSteps: ${{ parameters.prebuildSteps }} targetFramework: ${{ targetFramework }} netcoreVersionTestUtils: ${{config.value.netcoreVersionTestUtils }} diff --git a/eng/pipelines/common/templates/steps/build-all-configurations-signed-dlls-step.yml b/eng/pipelines/common/templates/steps/build-all-configurations-signed-dlls-step.yml index 8981f2d392..0f980f6eb1 100644 --- a/eng/pipelines/common/templates/steps/build-all-configurations-signed-dlls-step.yml +++ b/eng/pipelines/common/templates/steps/build-all-configurations-signed-dlls-step.yml @@ -4,25 +4,24 @@ # See the LICENSE file in the project root for more information. # ################################################################################# parameters: - - name: AssemblyFileVersion - type: string - default: $(AssemblyFileVersion) - + - name: buildConfiguration type: string values: - Debug - Release - - name: packageRefMdsVersion + - name: mdsAssemblyFileVersion + type: string + + - name: mdsPackageVersion type: string - default: '' - - name: product - default: MDS + - name: referenceType + type: string values: - - MDS - - MSS + - Package + - Project steps: - task: DownloadSecureFile@1 @@ -34,10 +33,14 @@ steps: # Install the .NET SDK. - template: /eng/pipelines/steps/install-dotnet.yml@self - - ${{ if eq(parameters.product, 'MDS') }}: - - task: MSBuild@1 - displayName: 'BuildAllConfigurations using build.proj' - inputs: - solution: '**/build.proj' - configuration: '${{parameters.buildConfiguration }}' - msbuildArguments: '-p:AssemblyFileVersion=${{parameters.AssemblyFileVersion }} -t:BuildAllConfigurations -p:GenerateNuget=false -p:SigningKeyPath=$(Agent.TempDirectory)\netfxKeypair.snk' + - task: MSBuild@1 + displayName: 'BuildAllConfigurations using build.proj' + inputs: + solution: '**/build.proj' + configuration: '${{ parameters.buildConfiguration }}' + msbuildArguments: >- + -t:BuildAllConfigurations + -p:ReferenceType=${{ parameters.referenceType }} + -p:GenerateNuget=false + -p:SigningKeyPath=$(Agent.TempDirectory)\netfxKeypair.snk + -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} diff --git a/eng/pipelines/common/templates/steps/build-all-tests-step.yml b/eng/pipelines/common/templates/steps/build-all-tests-step.yml index 1074c97632..c8a090c3ff 100644 --- a/eng/pipelines/common/templates/steps/build-all-tests-step.yml +++ b/eng/pipelines/common/templates/steps/build-all-tests-step.yml @@ -4,33 +4,33 @@ # See the LICENSE file in the project root for more information. # ################################################################################# parameters: - - name: targetFramework + + - name: buildConfiguration + type: string + values: + - Debug + - Release + + - name: mdsPackageVersion type: string - - name: nugetPackageVersion + - name: osGroup type: string - default: $(NugetPackageVersion) + default: '' - name: platform type: string default: $(Platform) - - - name: buildConfiguration - type: string - values: - - Debug - - Release - name: referenceType - default: Package + type: string values: - Project - Package - - - name: OSGroup - type: string - default: '' + - name: targetFramework + type: string + - name: testSet type: string @@ -40,28 +40,27 @@ steps: displayName: 'Build Tests NetFx' inputs: solution: build.proj - platform: '${{parameters.platform }}' - configuration: '${{parameters.buildConfiguration }}' - msbuildArguments: '-t:BuildTestsNetFx -p:TF=${{parameters.targetFramework }} -p:TestSet=${{parameters.testSet }} -p:ReferenceType=${{parameters.referenceType }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.nugetPackageVersion }}' - -# - ${{else if contains(parameters.targetFramework, 'netstandard')}}: # .NET Standard -# - task: MSBuild@1 -# displayName: 'Build Tests NetStandard' -# inputs: -# solution: build.proj -# platform: '${{parameters.platform }}' -# configuration: '${{parameters.buildConfiguration }}' -# msbuildArguments: '-t:BuildTestsNetCore -p:ReferenceType=NetStandard -p:TargetNetStandardVersion=${{parameters.targetNetStandardVersion }} -p:TF=${{parameters.targetFramework }} -p:ReferenceType=${{parameters.referenceType }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.nugetPackageVersion }}' -# condition: and(succeeded(), not(startsWith(variables['TF'], 'net4')), startsWith(variables['TargetNetStandardVersion'], 'netstandard')) - -- ${{elseif eq(parameters.OSGroup, '')}}: # .NET on Windows + platform: '${{ parameters.platform }}' + configuration: '${{ parameters.buildConfiguration }}' + msbuildArguments: >- + -t:BuildTestsNetFx + -p:TF=${{ parameters.targetFramework }} + -p:TestSet=${{ parameters.testSet }} + -p:ReferenceType=${{ parameters.referenceType }} + -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} +- ${{elseif eq(parameters.osGroup, '')}}: # .NET on Windows - task: MSBuild@1 displayName: 'Build Tests NetCore [Win]' inputs: solution: build.proj - platform: '${{parameters.platform }}' - configuration: '${{parameters.buildConfiguration }}' - msbuildArguments: '-t:BuildTestsNetCore -p:TF=${{parameters.targetFramework }} -p:TestSet=${{parameters.testSet }} -p:ReferenceType=${{parameters.referenceType }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.nugetPackageVersion }}' + platform: '${{ parameters.platform }}' + configuration: '${{ parameters.buildConfiguration }}' + msbuildArguments: >- + -t:BuildTestsNetCore + -p:TF=${{ parameters.targetFramework }} + -p:TestSet=${{ parameters.testSet }} + -p:ReferenceType=${{ parameters.referenceType }} + -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) - ${{ else }}: # .NET on Unix @@ -71,7 +70,15 @@ steps: command: custom projects: build.proj custom: msbuild - arguments: '-t:BuildTestsNetCore -p:TF=${{parameters.targetFramework }} -p:TestSet=${{parameters.testSet }} -p:ReferenceType=${{parameters.referenceType }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.nugetPackageVersion }} -p:OSGroup=${{parameters.OSGroup }} -p:platform=${{parameters.platform }} -p:Configuration=${{parameters.buildConfiguration }}' + arguments: >- + -t:BuildTestsNetCore + -p:TF=${{ parameters.targetFramework }} + -p:TestSet=${{ parameters.testSet }} + -p:ReferenceType=${{ parameters.referenceType }} + -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} + -p:OSGroup=${{ parameters.osGroup }} + -p:platform=${{ parameters.platform }} + -p:Configuration=${{ parameters.buildConfiguration }} verbosityRestore: Detailed verbosityPack: Detailed condition: and(succeeded(), ne(variables['Agent.OS'], 'Windows_NT')) diff --git a/eng/pipelines/common/templates/steps/build-and-run-tests-netcore-step.yml b/eng/pipelines/common/templates/steps/build-and-run-tests-netcore-step.yml index a15863fce0..dded524027 100644 --- a/eng/pipelines/common/templates/steps/build-and-run-tests-netcore-step.yml +++ b/eng/pipelines/common/templates/steps/build-and-run-tests-netcore-step.yml @@ -20,9 +20,9 @@ parameters: - Project - Package - - name: NugetPackageVersion + - name: mdsPackageVersion type: string - default: $(NugetPackageVersion) + default: $(mdsPackageVersion) - name: platform type: string @@ -57,14 +57,23 @@ steps: inputs: solution: build.proj msbuildArchitecture: x64 - msbuildArguments: '-p:Configuration=${{parameters.buildConfiguration }} -t:BuildAKVNetCore -p:ReferenceType=${{parameters.referenceType }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.NugetPackageVersion }}' + msbuildArguments: >- + -p:Configuration=${{ parameters.buildConfiguration }} + -t:BuildAKVNetCore + -p:ReferenceType=${{ parameters.referenceType }} + -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} - task: MSBuild@1 displayName: 'MSBuild Build Tests for ${{parameters.TargetNetCoreVersion }}' inputs: solution: build.proj msbuildArchitecture: x64 - msbuildArguments: '-t:BuildTestsNetCore -p:ReferenceType=${{parameters.referenceType }} -p:TargetNetCoreVersion=${{parameters.TargetNetCoreVersion }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.NugetPackageVersion }} -p:Configuration=${{parameters.buildConfiguration }}' + msbuildArguments: >- + -t:BuildTestsNetCore + -p:ReferenceType=${{ parameters.referenceType }} + -p:TargetNetCoreVersion=${{ parameters.TargetNetCoreVersion }} + -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} + -p:Configuration=${{ parameters.buildConfiguration }} # Don't run unit tests using package reference. Unit tests are only run using project reference. @@ -73,14 +82,32 @@ steps: inputs: command: test projects: 'src\Microsoft.Data.SqlClient\tests\FunctionalTests\Microsoft.Data.SqlClient.FunctionalTests.csproj' - arguments: '-p:Platform=${{parameters.platform }} -p:TestTargetOS="${{parameters.TestTargetOS }}" -p:TargetNetCoreVersion=${{parameters.TargetNetCoreVersion }} -p:ReferenceType=${{parameters.referenceType }} -p:Configuration=${{parameters.buildConfiguration }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.NugetPackageVersion }} --no-build -v n --filter "category!=failing&category!=flaky"' + arguments: >- + -p:Platform=${{ parameters.platform }} + -p:TestTargetOS=${{ parameters.TestTargetOS }} + -p:TargetNetCoreVersion=${{ parameters.TargetNetCoreVersion }} + -p:ReferenceType=${{ parameters.referenceType }} + -p:Configuration=${{ parameters.buildConfiguration }} + -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} + --no-build + -v n + --filter "category!=failing&category!=flaky" - task: DotNetCoreCLI@2 displayName: 'Run Flaky Functional Tests for ${{parameters.TargetNetCoreVersion }}' inputs: command: test projects: 'src\Microsoft.Data.SqlClient\tests\FunctionalTests\Microsoft.Data.SqlClient.FunctionalTests.csproj' - arguments: '-p:Platform=${{parameters.platform }} -p:TestTargetOS="${{parameters.TestTargetOS }}" -p:TargetNetCoreVersion=${{parameters.TargetNetCoreVersion }} -p:ReferenceType=${{parameters.referenceType }} -p:Configuration=${{parameters.buildConfiguration }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.NugetPackageVersion }} --no-build -v n --filter "category=flaky"' + arguments: >- + -p:Platform=${{ parameters.platform }} + -p:TestTargetOS=${{ parameters.TestTargetOS }} + -p:TargetNetCoreVersion=${{ parameters.TargetNetCoreVersion }} + -p:ReferenceType=${{ parameters.referenceType }} + -p:Configuration=${{ parameters.buildConfiguration }} + -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} + --no-build + -v n + --filter "category=flaky" continueOnError: true - task: DotNetCoreCLI@2 @@ -88,7 +115,17 @@ steps: inputs: command: test projects: 'src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj' - arguments: '-p:Platform=${{parameters.platform }} -p:TestTargetOS="${{parameters.TestTargetOS }}" -p:TargetNetCoreVersion=${{parameters.TargetNetCoreVersion }} -p:ReferenceType=${{parameters.referenceType }} -p:Configuration=${{parameters.buildConfiguration }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.NugetPackageVersion }} --no-build -v n --filter "category!=failing&category!=flaky" --collect "Code Coverage"' + arguments: >- + -p:Platform=${{ parameters.platform }} + -p:TestTargetOS=${{ parameters.TestTargetOS }} + -p:TargetNetCoreVersion=${{ parameters.TargetNetCoreVersion }} + -p:ReferenceType=${{ parameters.referenceType }} + -p:Configuration=${{ parameters.buildConfiguration }} + -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} + --no-build + -v n + --filter "category!=failing&category!=flaky" + --collect "Code Coverage" retryCountOnTaskFailure: ${{parameters.retryCountOnManualTests }} - task: DotNetCoreCLI@2 @@ -96,6 +133,16 @@ steps: inputs: command: test projects: 'src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj' - arguments: '-p:Platform=${{parameters.platform }} -p:TestTargetOS="${{parameters.TestTargetOS }}" -p:TargetNetCoreVersion=${{parameters.TargetNetCoreVersion }} -p:ReferenceType=${{parameters.referenceType }} -p:Configuration=${{parameters.buildConfiguration }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.NugetPackageVersion }} --no-build -v n --filter "category=flaky" --collect "Code Coverage"' + arguments: >- + -p:Platform=${{ parameters.platform }} + -p:TestTargetOS=${{ parameters.TestTargetOS }} + -p:TargetNetCoreVersion=${{ parameters.TargetNetCoreVersion }} + -p:ReferenceType=${{ parameters.referenceType }} + -p:Configuration=${{ parameters.buildConfiguration }} + -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} + --no-build + -v n + --filter "category=flaky" + --collect "Code Coverage" retryCountOnTaskFailure: ${{parameters.retryCountOnManualTests }} - continueOnError: true \ No newline at end of file + continueOnError: true diff --git a/eng/pipelines/common/templates/steps/build-and-run-tests-netfx-step.yml b/eng/pipelines/common/templates/steps/build-and-run-tests-netfx-step.yml index b52bbf5686..f2c719e9a3 100644 --- a/eng/pipelines/common/templates/steps/build-and-run-tests-netfx-step.yml +++ b/eng/pipelines/common/templates/steps/build-and-run-tests-netfx-step.yml @@ -20,9 +20,9 @@ parameters: - Project - Package - - name: NugetPackageVersion + - name: mdsPackageVersion type: string - default: $(NugetPackageVersion) + default: $(mdsPackageVersion) - name: platform type: string @@ -57,13 +57,23 @@ steps: inputs: solution: build.proj msbuildArchitecture: x64 - msbuildArguments: '-p:Configuration=${{parameters.buildConfiguration }} -t:BuildAKVNetFx -p:ReferenceType=${{parameters.referenceType }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.NugetPackageVersion }}' + msbuildArguments: >- + -p:Configuration=${{ parameters.buildConfiguration }} + -t:BuildAKVNetFx + -p:ReferenceType=${{ parameters.referenceType }} + -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} - task: MSBuild@1 displayName: 'MSBuild Build Tests for ${{parameters.TargetNetFxVersion }}' inputs: solution: build.proj - msbuildArguments: ' -t:BuildTestsNetFx -p:ReferenceType=${{parameters.referenceType }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.NugetPackageVersion }} -p:TargetNetFxVersion=${{parameters.TargetNetFxVersion }} -p:Configuration=${{parameters.buildConfiguration }} -p:Platform=${{parameters.platform }}' + msbuildArguments: >- + -t:BuildTestsNetFx + -p:ReferenceType=${{ parameters.referenceType }} + -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} + -p:TargetNetFxVersion=${{ parameters.TargetNetFxVersion }} + -p:Configuration=${{ parameters.buildConfiguration }} + -p:Platform=${{ parameters.platform }} # Don't run unit tests using package reference. Unit tests are only run using project reference. @@ -72,14 +82,34 @@ steps: inputs: command: test projects: 'src\Microsoft.Data.SqlClient\tests\FunctionalTests\Microsoft.Data.SqlClient.FunctionalTests.csproj' - arguments: '-p:Platform=${{parameters.platform }} -p:TestTargetOS="${{parameters.TestTargetOS }}" -p:TargetNetFxVersion=${{parameters.TargetNetFxVersion }} -p:ReferenceType=${{parameters.referenceType }} -p:Configuration=${{parameters.buildConfiguration }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.NugetPackageVersion }} --no-build -v n --filter "category!=failing&category!=flaky" --collect "Code Coverage"' + arguments: >- + -p:Platform=${{ parameters.platform }} + -p:TestTargetOS=${{ parameters.TestTargetOS }} + -p:TargetNetFxVersion=${{ parameters.TargetNetFxVersion }} + -p:ReferenceType=${{ parameters.referenceType }} + -p:Configuration=${{ parameters.buildConfiguration }} + -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} + --no-build + -v n + --filter "category!=failing&category!=flaky" + --collect "Code Coverage" - task: DotNetCoreCLI@2 displayName: 'Run Flaky Functional Tests for ${{parameters.TargetNetFxVersion }}' inputs: command: test projects: 'src\Microsoft.Data.SqlClient\tests\FunctionalTests\Microsoft.Data.SqlClient.FunctionalTests.csproj' - arguments: '-p:Platform=${{parameters.platform }} -p:TestTargetOS="${{parameters.TestTargetOS }}" -p:TargetNetFxVersion=${{parameters.TargetNetFxVersion }} -p:ReferenceType=${{parameters.referenceType }} -p:Configuration=${{parameters.buildConfiguration }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.NugetPackageVersion }} --no-build -v n --filter "category=flaky" --collect "Code Coverage"' + arguments: >- + -p:Platform=${{ parameters.platform }} + -p:TestTargetOS=${{ parameters.TestTargetOS }} + -p:TargetNetFxVersion=${{ parameters.TargetNetFxVersion }} + -p:ReferenceType=${{ parameters.referenceType }} + -p:Configuration=${{ parameters.buildConfiguration }} + -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} + --no-build + -v n + --filter "category=flaky" + --collect "Code Coverage" continueOnError: true - task: DotNetCoreCLI@2 @@ -87,7 +117,17 @@ steps: inputs: command: test projects: 'src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj' - arguments: '-p:Platform=${{parameters.platform }} -p:TestTargetOS="${{parameters.TestTargetOS }}" -p:TargetNetFxVersion=${{parameters.TargetNetFxVersion }} -p:ReferenceType=${{parameters.referenceType }} -p:Configuration=${{parameters.buildConfiguration }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.NugetPackageVersion }} --no-build -v n --filter "category!=failing&category!=flaky" --collect "Code Coverage"' + arguments: >- + -p:Platform=${{ parameters.platform }} + -p:TestTargetOS=${{ parameters.TestTargetOS }} + -p:TargetNetFxVersion=${{ parameters.TargetNetFxVersion }} + -p:ReferenceType=${{ parameters.referenceType }} + -p:Configuration=${{ parameters.buildConfiguration }} + -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} + --no-build + -v n + --filter "category!=failing&category!=flaky" + --collect "Code Coverage" retryCountOnTaskFailure: ${{parameters.retryCountOnManualTests }} - task: DotNetCoreCLI@2 @@ -95,6 +135,16 @@ steps: inputs: command: test projects: 'src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj' - arguments: '-p:Platform=${{parameters.platform }} -p:TestTargetOS="${{parameters.TestTargetOS }}" -p:TargetNetFxVersion=${{parameters.TargetNetFxVersion }} -p:ReferenceType=${{parameters.referenceType }} -p:Configuration=${{parameters.buildConfiguration }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.NugetPackageVersion }} --no-build -v n --filter "category=flaky" --collect "Code Coverage"' + arguments: >- + -p:Platform=${{ parameters.platform }} + -p:TestTargetOS=${{ parameters.TestTargetOS }} + -p:TargetNetFxVersion=${{ parameters.TargetNetFxVersion }} + -p:ReferenceType=${{ parameters.referenceType }} + -p:Configuration=${{ parameters.buildConfiguration }} + -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} + --no-build + -v n + --filter "category=flaky" + --collect "Code Coverage" retryCountOnTaskFailure: ${{parameters.retryCountOnManualTests }} continueOnError: true diff --git a/eng/pipelines/common/templates/steps/ci-prebuild-step.yml b/eng/pipelines/common/templates/steps/ci-prebuild-step.yml index 3774363ec3..e356dc1984 100644 --- a/eng/pipelines/common/templates/steps/ci-prebuild-step.yml +++ b/eng/pipelines/common/templates/steps/ci-prebuild-step.yml @@ -8,38 +8,19 @@ parameters: type: boolean default: false - - name: artifactName - type: string - default: Artifacts - - - name: buildConfiguration + - name: referenceType type: string - values: - - Debug - - Release - - - name: buildType - default: Project values: - Project - Package steps: -- ${{if eq(parameters.debug, true)}}: - - powershell: | - Get-ChildItem env: | Sort-Object Name - displayName: 'List Environment Variables [debug]' - -- ${{if eq(parameters.buildType, 'Package')}}: - - task: DownloadPipelineArtifact@2 - displayName: 'Download NuGet Package' - inputs: - buildType: current - artifact: ${{parameters.artifactName }} - patterns: '**/*.nupkg' - targetPath: $(Pipeline.Workspace)/${{parameters.artifactName }} + - ${{if eq(parameters.debug, true)}}: + - powershell: | + Get-ChildItem env: | Sort-Object Name + displayName: '[Debug] List Environment Variables' - - template: update-nuget-config-local-feed-step.yml@self - parameters: - downloadedNugetPath: $(Pipeline.Workspace)\${{parameters.artifactName }} - debug: ${{ parameters.debug }} + - ${{if eq(parameters.referenceType, 'Package')}}: + - template: /eng/pipelines/common/templates/steps/update-nuget-config-local-feed-step.yml@self + parameters: + debug: ${{ parameters.debug }} diff --git a/eng/pipelines/common/templates/steps/ci-project-build-step.yml b/eng/pipelines/common/templates/steps/ci-project-build-step.yml index 919958e8a2..204ae98a14 100644 --- a/eng/pipelines/common/templates/steps/ci-project-build-step.yml +++ b/eng/pipelines/common/templates/steps/ci-project-build-step.yml @@ -13,6 +13,12 @@ parameters: values: - Debug - Release + + - name: referenceType + type: string + values: + - Package + - Project - name: buildNumber type: string @@ -35,29 +41,41 @@ parameters: - AKV - all - allNoDocs + + # Used when AKV is built with ReferenceType = Package. + - name: mdsPackageVersion + type: string + default: '' steps: - ${{ if or(eq(parameters.operatingSystem, 'Windows'), eq(parameters.operatingSystem, 'deferedToRuntime')) }}: - ${{ if or(eq(parameters.build, 'MDS'), eq(parameters.build, 'all'), eq(parameters.build, 'allNoDocs')) }}: - task: MSBuild@1 - displayName: 'Restore nugets [Win]' + displayName: 'Restore [Win]' condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) inputs: solution: build.proj msbuildArchitecture: x64 - msbuildArguments: '-t:restore' + msbuildArguments: >- + -t:restore + -p:ReferenceType=${{ parameters.ReferenceType }} retryCountOnTaskFailure: 1 - ${{ if eq(parameters.build, 'allNoDocs') }}: - task: MSBuild@1 - displayName: 'Build Driver [Win]' + displayName: 'Build Driver (no docs) [Win]' condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) inputs: solution: build.proj msbuildArchitecture: x64 platform: '${{ parameters.platform }}' configuration: '${{ parameters.buildConfiguration }}' - msbuildArguments: '-t:BuildAllConfigurations -p:GenerateDocumentationFile=false -p:GenerateNuGet=false -p:BuildNumber=${{ parameters.buildNumber }}' + msbuildArguments: >- + -t:BuildAllConfigurations + -p:ReferenceType=${{ parameters.ReferenceType }} + -p:GenerateDocumentationFile=false + -p:GenerateNuGet=false + -p:BuildNumber=${{ parameters.buildNumber }} clean: true - ${{ if or(eq(parameters.build, 'MDS'), eq(parameters.build, 'all')) }}: @@ -69,7 +87,11 @@ steps: msbuildArchitecture: x64 platform: '${{ parameters.platform }}' configuration: '${{ parameters.buildConfiguration }}' - msbuildArguments: '-t:BuildAllConfigurations -p:GenerateNuGet=false -p:BuildNumber=${{ parameters.buildNumber }}' + msbuildArguments: + -t:BuildAllConfigurations + -p:ReferenceType=${{ parameters.ReferenceType }} + -p:GenerateNuGet=false + -p:BuildNumber=${{ parameters.buildNumber }} clean: true - ${{ if or(eq(parameters.build, 'AKV'), eq(parameters.build, 'all'), eq(parameters.build, 'allNoDocs')) }}: @@ -81,7 +103,11 @@ steps: msbuildArchitecture: x64 platform: '${{ parameters.platform }}' configuration: '${{ parameters.buildConfiguration }}' - msbuildArguments: '-t:BuildAKVNetFx -p:BuildNumber=${{ parameters.buildNumber }}' + msbuildArguments: >- + -t:BuildAKVNetFx + -p:ReferenceType=${{ parameters.ReferenceType }} + -p:BuildNumber=${{ parameters.buildNumber }} + -p:MdsPackageVersion=${{parameters.mdsPackageVersion}} - task: MSBuild@1 displayName: 'Build AKV Provider NetCore All OS [Win]' @@ -91,17 +117,26 @@ steps: msbuildArchitecture: x64 platform: '${{ parameters.platform }}' configuration: '${{ parameters.buildConfiguration }}' - msbuildArguments: '-t:BuildAKVNetCoreAllOS -p:BuildNumber=${{ parameters.buildNumber }}' + msbuildArguments: >- + -t:BuildAKVNetCoreAllOS + -p:ReferenceType=${{ parameters.ReferenceType }} + -p:BuildNumber=${{ parameters.buildNumber }} + -p:MdsPackageVersion=${{parameters.mdsPackageVersion}} - ${{ if or(eq(parameters.operatingSystem, 'Linux'), eq(parameters.operatingSystem, 'MacOS'), eq(parameters.operatingSystem, 'deferedToRuntime')) }}: - task: DotNetCoreCLI@2 - displayName: 'Build Driver [non-Win]' + displayName: 'Build Driver [${{ parameters.operatingSystem }}]' condition: and(succeeded(), ne(variables['Agent.OS'], 'Windows_NT')) inputs: command: custom projects: build.proj custom: msbuild - arguments: '-t:BuildAll -p:TestEnabled=true -p:GenerateDocumentationFile=false -p:configuration=${{ parameters.buildConfiguration }}' + arguments: >- + -t:BuildAll + -p:ReferenceType=${{ parameters.ReferenceType }} + -p:TestEnabled=true + -p:GenerateDocumentationFile=false + -p:configuration=${{ parameters.configuration }} verbosityRestore: Detailed verbosityPack: Detailed retryCountOnTaskFailure: 1 diff --git a/eng/pipelines/common/templates/steps/code-analyze-step.yml b/eng/pipelines/common/templates/steps/code-analyze-step.yml index 9807541a70..ec226e134c 100644 --- a/eng/pipelines/common/templates/steps/code-analyze-step.yml +++ b/eng/pipelines/common/templates/steps/code-analyze-step.yml @@ -3,40 +3,36 @@ # 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: analyzeType - values: - - roslyn - - inspect - - all +# This template defines a step to run Roslyn Analyzers on the MDS project build. +# It uses the RoslynAnalyzers@3 task from the Secure Development Team's SDL +# extension: +# +# https://eng.ms/docs/cloud-ai-platform/devdiv/one-engineering-system-1es/1es-mohanb/security-integration/guardian-wiki/sdl-azdo-extension/roslyn-analyzers-build-task +# +# GOTCHA: This step will clobber any existing build output. It should be run +# _before_ any build steps that perform versioning or signing. + +# @TODO: This can probably be made generic and pass in the command lines for msbuild +# BUT, they should be kept separate by now as we rebuild build.proj in parallel, we won't +# affect >1 project at a time. + +parameters: - name: sourceRoot type: string default: $(REPOROOT) - - name: packageRefMdsVersion - type: string - default: '' - - - name: product - default: MDS - values: - - MDS - - MSS - steps: -- ${{ if or(eq(parameters.analyzeType, 'roslyn'), eq(parameters.analyzeType, 'all')) }}: - - ${{ if eq(parameters.product, 'MDS') }}: - - task: securedevelopmentteam.vss-secure-development-tools.build-task-roslynanalyzers.RoslynAnalyzers@3 - displayName: 'Guardian Dotnet Analyzers ' - inputs: - msBuildVersion: 17.0 - msBuildArchitecture: x64 - setupCommandlinePicker: vs2022 - msBuildCommandline: 'msbuild ${{parameters.sourceRoot}}\build.proj -p:configuration=Release -p:GenerateNuget=false -p:BuildTools=false -p:SigningKeyPath=$(Agent.TempDirectory)\netfxKeypair.snk' - -- ${{ if or(eq(parameters.analyzeType, 'inspect'), eq(parameters.analyzeType, 'all')) }}: - - task: securedevelopmentteam.vss-secure-development-tools.build-task-codeinspector.CodeInspector@2 - displayName: 'Run Code Inspector' + - task: securedevelopmentteam.vss-secure-development-tools.build-task-roslynanalyzers.RoslynAnalyzers@3 + displayName: Roslyn Analyzers inputs: - LogLevel: Error + msBuildVersion: 17.0 + msBuildArchitecture: x64 + setupCommandlinePicker: vs2022 + msBuildCommandline: >- + msbuild + ${{parameters.sourceRoot}}\build.proj + -p:configuration=Release + -p:GenerateNuget=false + -p:BuildTools=false + -p:SigningKeyPath=$(Agent.TempDirectory)\netfxKeypair.snk diff --git a/eng/pipelines/common/templates/steps/configure-sql-server-step.yml b/eng/pipelines/common/templates/steps/configure-sql-server-step.yml index bfb89e34b9..a11dd38409 100644 --- a/eng/pipelines/common/templates/steps/configure-sql-server-step.yml +++ b/eng/pipelines/common/templates/steps/configure-sql-server-step.yml @@ -71,7 +71,7 @@ parameters: steps: - ${{ if eq(parameters.operatingSystem, 'Windows') }}: # windows only steps - - template: configure-sql-server-win-step.yml@self + - template: /eng/pipelines/common/templates/steps/configure-sql-server-win-step.yml@self parameters: instanceName: ${{parameters.instanceName}} user: ${{parameters.user}} @@ -89,13 +89,13 @@ steps: - ${{ elseif eq(parameters.operatingSystem, 'Linux') }}: # Linux only steps - - template: configure-sql-server-linux-step.yml@self + - template: /eng/pipelines/common/templates/steps/configure-sql-server-linux-step.yml@self parameters: password: ${{parameters.password}} - ${{ elseif eq(parameters.operatingSystem, 'Mac') }}: # macOS only steps - - template: configure-sql-server-macos-step.yml@self + - template: /eng/pipelines/common/templates/steps/configure-sql-server-macos-step.yml@self parameters: password: ${{parameters.password}} diff --git a/eng/pipelines/common/templates/steps/copy-dlls-for-test-step.yml b/eng/pipelines/common/templates/steps/copy-dlls-for-test-step.yml index c33bd36645..711c3a9b8f 100644 --- a/eng/pipelines/common/templates/steps/copy-dlls-for-test-step.yml +++ b/eng/pipelines/common/templates/steps/copy-dlls-for-test-step.yml @@ -85,6 +85,6 @@ steps: $software = '${{parameters.softwareFolder}}' $symbols = '${{parameters.symbolsFolder}}' - Get-ChildItem -recurse "$software\*.dll" - Get-ChildItem -recurse "$symbols\*.pdb" + Get-ChildItem -recurse "$software\*.dll" | ForEach-Object VersionInfo | Format-List + Get-ChildItem -recurse "$symbols\*.pdb" | ForEach-Object VersionInfo | Format-List displayName: 'List the prepared files' diff --git a/eng/pipelines/common/templates/steps/generate-nuget-package-step.yml b/eng/pipelines/common/templates/steps/generate-nuget-package-step.yml index 0754735e28..47d0e02b1a 100644 --- a/eng/pipelines/common/templates/steps/generate-nuget-package-step.yml +++ b/eng/pipelines/common/templates/steps/generate-nuget-package-step.yml @@ -6,13 +6,11 @@ parameters: - name: nuspecPath type: string - default: '$(nuspecPath)' - - name: NugetPackageVersion + - name: packageVersion type: string - default: '$(NugetPackageVersion)' - - name: OutputDirectory + - name: outputDirectory type: string default: '$(Build.SourcesDirectory)/packages' @@ -29,17 +27,22 @@ parameters: - name: displayName type: string - default: 'NuGet pack with snupkg' - name: installNuget type: boolean default: true - name: referenceType - default: project + type: string values: - - project - - package + - Package + - Project + + # Semi-colon separated properties to pass to nuget via the -properties + # argument. + - name: properties + type: string + default: '' steps: - ${{ if parameters.installNuget }}: @@ -58,6 +61,18 @@ steps: inputs: command: custom ${{ if parameters.generateSymbolsPackage }}: - arguments: 'pack -Symbols -SymbolPackageFormat snupkg ${{parameters.nuspecPath}} -Version ${{parameters.NugetPackageVersion}} -OutputDirectory ${{parameters.OutputDirectory}} -properties "COMMITID=$(CommitHead);Configuration=${{parameters.buildConfiguration}};ReferenceType=${{parameters.referenceType}}"' + arguments: >- + pack + -Symbols + -SymbolPackageFormat snupkg + ${{parameters.nuspecPath}} + -Version ${{parameters.packageVersion}} + -OutputDirectory ${{parameters.outputDirectory}} + -properties "COMMITID=$(CommitHead);Configuration=${{parameters.buildConfiguration}};ReferenceType=${{parameters.referenceType}};${{parameters.properties}}" ${{else }}: - arguments: 'pack ${{parameters.nuspecPath}} -Version ${{parameters.NugetPackageVersion}} -OutputDirectory ${{parameters.OutputDirectory}} -properties "COMMITID=$(CommitHead);Configuration=${{parameters.buildConfiguration}};ReferenceType=${{parameters.referenceType}}"' + arguments: >- + pack + ${{parameters.nuspecPath}} + -Version ${{parameters.packageVersion}} + -OutputDirectory ${{parameters.outputDirectory}} + -properties "COMMITID=$(CommitHead);Configuration=${{parameters.buildConfiguration}};ReferenceType=${{parameters.referenceType}};${{parameters.properties}}" diff --git a/eng/pipelines/common/templates/steps/publish-symbols-step.yml b/eng/pipelines/common/templates/steps/publish-symbols-step.yml index a3cd272958..3f80ae8d2d 100644 --- a/eng/pipelines/common/templates/steps/publish-symbols-step.yml +++ b/eng/pipelines/common/templates/steps/publish-symbols-step.yml @@ -15,7 +15,7 @@ parameters: - name: symbolsVersion type: string - default: '$(NuGetPackageVersion)' + default: '$(mdsPackageVersion)' - name: symbolServer type: string diff --git a/eng/pipelines/common/templates/steps/publish-test-results-step.yml b/eng/pipelines/common/templates/steps/publish-test-results-step.yml index b4a5ec9f0c..06f4f98a7c 100644 --- a/eng/pipelines/common/templates/steps/publish-test-results-step.yml +++ b/eng/pipelines/common/templates/steps/publish-test-results-step.yml @@ -52,7 +52,7 @@ steps: - powershell: | cd TestResults Get-ChildItem -Filter “*.coverage” -Recurse - displayName: 'List test result coverage files [debug]' + displayName: '[Debug] List test result coverage files' - task: PublishPipelineArtifact@1 displayName: 'Publish Pipeline Artifact' diff --git a/eng/pipelines/common/templates/steps/run-all-tests-step.yml b/eng/pipelines/common/templates/steps/run-all-tests-step.yml index c4042dd8b5..8d8983b044 100644 --- a/eng/pipelines/common/templates/steps/run-all-tests-step.yml +++ b/eng/pipelines/common/templates/steps/run-all-tests-step.yml @@ -11,9 +11,9 @@ parameters: - name: targetFramework type: string - - name: nugetPackageVersion + - name: mdsPackageVersion type: string - default: $(NugetPackageVersion) + default: $(mdsPackageVersion) - name: platform type: string @@ -55,7 +55,7 @@ parameters: steps: - ${{ if parameters.debug }}: - powershell: 'dotnet sdk check' - displayName: '.NET sdk check [debug]' + displayName: '[Debug] .NET sdk check' condition: succeededOrFailed() - ${{if eq(parameters.operatingSystem, 'Windows')}}: @@ -68,9 +68,16 @@ steps: platform: '${{parameters.platform }}' configuration: '${{parameters.buildConfiguration }}' ${{ if eq(parameters.msbuildArchitecture, 'x64') }}: - msbuildArguments: '-t:RunUnitTests -p:TF=${{parameters.targetFramework }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.nugetPackageVersion }}' + msbuildArguments: >- + -t:RunUnitTests + -p:TF=${{ parameters.targetFramework }} + -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} ${{ else }}: # x86 - msbuildArguments: '-t:RunUnitTests -p:TF=${{parameters.targetFramework }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.nugetPackageVersion }} -p:DotnetPath=${{parameters.dotnetx86RootPath }}' + msbuildArguments: >- + -t:RunUnitTests + -p:TF=${{ parameters.targetFramework }} + -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} + -p:DotnetPath=${{ parameters.dotnetx86RootPath }} - task: MSBuild@1 displayName: 'Run Flaky Unit Tests ${{parameters.msbuildArchitecture }}' @@ -80,9 +87,20 @@ steps: platform: '${{parameters.platform }}' configuration: '${{parameters.buildConfiguration }}' ${{ if eq(parameters.msbuildArchitecture, 'x64') }}: - msbuildArguments: '-t:RunUnitTests -p:TF=${{parameters.targetFramework }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.nugetPackageVersion }} -p:Filter="category=flaky" -p:CollectCodeCoverage=false' + msbuildArguments: >- + -t:RunUnitTests + -p:TF=${{ parameters.targetFramework }} + -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} + -p:Filter="category=flaky" + -p:CollectCodeCoverage=false ${{ else }}: # x86 - msbuildArguments: '-t:RunUnitTests -p:TF=${{parameters.targetFramework }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.nugetPackageVersion }} -p:DotnetPath=${{parameters.dotnetx86RootPath }} -p:Filter="category=flaky" -p:CollectCodeCoverage=false' + msbuildArguments: >- + -t:RunUnitTests + -p:TF=${{ parameters.targetFramework }} + -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} + -p:DotnetPath=${{ parameters.dotnetx86RootPath }} + -p:Filter="category=flaky" + -p:CollectCodeCoverage=false continueOnError: true - task: MSBuild@1 @@ -93,9 +111,20 @@ steps: platform: '${{parameters.platform }}' configuration: '${{parameters.buildConfiguration }}' ${{ if eq(parameters.msbuildArchitecture, 'x64') }}: - msbuildArguments: '-t:RunFunctionalTests -p:TF=${{parameters.targetFramework }} -p:TestSet=${{parameters.testSet }} -p:ReferenceType=${{parameters.referenceType }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.nugetPackageVersion }}' + msbuildArguments: >- + -t:RunFunctionalTests + -p:TF=${{ parameters.targetFramework }} + -p:TestSet=${{ parameters.testSet }} + -p:ReferenceType=${{ parameters.referenceType }} + -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} ${{ else }}: # x86 - msbuildArguments: '-t:RunFunctionalTests -p:TF=${{parameters.targetFramework }} -p:TestSet=${{parameters.testSet }} -p:ReferenceType=${{parameters.referenceType }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.nugetPackageVersion }} -p:DotnetPath=${{parameters.dotnetx86RootPath }}' + msbuildArguments: >- + -t:RunFunctionalTests + -p:TF=${{ parameters.targetFramework }} + -p:TestSet=${{ parameters.testSet }} + -p:ReferenceType=${{ parameters.referenceType }} + -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} + -p:DotnetPath=${{ parameters.dotnetx86RootPath }} - task: MSBuild@1 displayName: 'Run Flaky Functional Tests ${{parameters.msbuildArchitecture }}' @@ -105,9 +134,24 @@ steps: platform: '${{parameters.platform }}' configuration: '${{parameters.buildConfiguration }}' ${{ if eq(parameters.msbuildArchitecture, 'x64') }}: - msbuildArguments: '-t:RunFunctionalTests -p:TF=${{parameters.targetFramework }} -p:TestSet=${{parameters.testSet }} -p:ReferenceType=${{parameters.referenceType }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.nugetPackageVersion }} -p:Filter="category=flaky" -p:CollectCodeCoverage=false' + msbuildArguments: >- + -t:RunFunctionalTests + -p:TF=${{ parameters.targetFramework }} + -p:TestSet=${{ parameters.testSet }} + -p:ReferenceType=${{ parameters.referenceType }} + -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} + -p:Filter="category=flaky" + -p:CollectCodeCoverage=false ${{ else }}: # x86 - msbuildArguments: '-t:RunFunctionalTests -p:TF=${{parameters.targetFramework }} -p:TestSet=${{parameters.testSet }} -p:ReferenceType=${{parameters.referenceType }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.nugetPackageVersion }} -p:DotnetPath=${{parameters.dotnetx86RootPath }} -p:Filter="category=flaky" -p:CollectCodeCoverage=false' + msbuildArguments: >- + -t:RunFunctionalTests + -p:TF=${{ parameters.targetFramework }} + -p:TestSet=${{ parameters.testSet }} + -p:ReferenceType=${{ parameters.referenceType }} + -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} + -p:DotnetPath=${{ parameters.dotnetx86RootPath }} + -p:Filter="category=flaky" + -p:CollectCodeCoverage=false continueOnError: true - task: MSBuild@1 @@ -118,9 +162,20 @@ steps: platform: '${{parameters.platform }}' configuration: '${{parameters.buildConfiguration }}' ${{ if eq(parameters.msbuildArchitecture, 'x64') }}: - msbuildArguments: '-t:RunManualTests -p:TF=${{parameters.targetFramework }} -p:TestSet=${{parameters.testSet }} -p:ReferenceType=${{parameters.referenceType }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.nugetPackageVersion }}' + msbuildArguments: >- + -t:RunManualTests + -p:TF=${{ parameters.targetFramework }} + -p:TestSet=${{ parameters.testSet }} + -p:ReferenceType=${{ parameters.referenceType }} + -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} ${{ else }}: # x86 - msbuildArguments: '-t:RunManualTests -p:TF=${{parameters.targetFramework }} -p:TestSet=${{parameters.testSet }} -p:ReferenceType=${{parameters.referenceType }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.nugetPackageVersion }} -p:DotnetPath=${{parameters.dotnetx86RootPath }}' + msbuildArguments: >- + -t:RunManualTests + -p:TF=${{ parameters.targetFramework }} + -p:TestSet=${{ parameters.testSet }} + -p:ReferenceType=${{ parameters.referenceType }} + -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} + -p:DotnetPath=${{ parameters.dotnetx86RootPath }} retryCountOnTaskFailure: ${{parameters.retryCountOnManualTests }} - task: MSBuild@1 @@ -131,9 +186,24 @@ steps: platform: '${{parameters.platform }}' configuration: '${{parameters.buildConfiguration }}' ${{ if eq(parameters.msbuildArchitecture, 'x64') }}: - msbuildArguments: '-t:RunManualTests -p:TF=${{parameters.targetFramework }} -p:TestSet=${{parameters.testSet }} -p:ReferenceType=${{parameters.referenceType }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.nugetPackageVersion }} -p:Filter="category=flaky" -p:CollectCodeCoverage=false' + msbuildArguments: >- + -t:RunManualTests + -p:TF=${{ parameters.targetFramework }} + -p:TestSet=${{ parameters.testSet }} + -p:ReferenceType=${{ parameters.referenceType }} + -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} + -p:Filter="category=flaky" + -p:CollectCodeCoverage=false ${{ else }}: # x86 - msbuildArguments: '-t:RunManualTests -p:TF=${{parameters.targetFramework }} -p:TestSet=${{parameters.testSet }} -p:ReferenceType=${{parameters.referenceType }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.nugetPackageVersion }} -p:DotnetPath=${{parameters.dotnetx86RootPath }} -p:Filter="category=flaky" -p:CollectCodeCoverage=false' + msbuildArguments: >- + -t:RunManualTests + -p:TF=${{ parameters.targetFramework }} + -p:TestSet=${{ parameters.testSet }} + -p:ReferenceType=${{ parameters.referenceType }} + -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} + -p:DotnetPath=${{ parameters.dotnetx86RootPath }} + -p:Filter="category=flaky" + -p:CollectCodeCoverage=false continueOnError: true retryCountOnTaskFailure: ${{parameters.retryCountOnManualTests }} @@ -145,7 +215,14 @@ steps: command: custom projects: build.proj custom: msbuild - arguments: '-t:RunUnitTests -p:TF=${{parameters.targetFramework }} -p:TestSet=${{parameters.testSet }} -p:ReferenceType=${{parameters.referenceType }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.nugetPackageVersion }} -p:platform=${{parameters.platform }} -p:Configuration=${{parameters.buildConfiguration }}' + arguments: >- + -t:RunUnitTests + -p:TF=${{ parameters.targetFramework }} + -p:TestSet=${{ parameters.testSet }} + -p:ReferenceType=${{ parameters.referenceType }} + -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} + -p:platform=${{ parameters.platform }} + -p:Configuration=${{ parameters.buildConfiguration }} verbosityRestore: Detailed verbosityPack: Detailed @@ -155,7 +232,15 @@ steps: command: custom projects: build.proj custom: msbuild - arguments: '-t:RunUnitTests -p:TF=${{parameters.targetFramework }} -p:TestSet=${{parameters.testSet }} -p:ReferenceType=${{parameters.referenceType }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.nugetPackageVersion }} -p:platform=${{parameters.platform }} -p:Configuration=${{parameters.buildConfiguration }} -p:Filter="category=flaky"' + arguments: >- + -t:RunUnitTests + -p:TF=${{ parameters.targetFramework }} + -p:TestSet=${{ parameters.testSet }} + -p:ReferenceType=${{ parameters.referenceType }} + -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} + -p:platform=${{ parameters.platform }} + -p:Configuration=${{ parameters.buildConfiguration }} + -p:Filter="category=flaky" verbosityRestore: Detailed verbosityPack: Detailed continueOnError: true @@ -166,7 +251,14 @@ steps: command: custom projects: build.proj custom: msbuild - arguments: '-t:RunFunctionalTests -p:TF=${{parameters.targetFramework }} -p:TestSet=${{parameters.testSet }} -p:ReferenceType=${{parameters.referenceType }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.nugetPackageVersion }} -p:platform=${{parameters.platform }} -p:Configuration=${{parameters.buildConfiguration }}' + arguments: >- + -t:RunFunctionalTests + -p:TF=${{ parameters.targetFramework }} + -p:TestSet=${{ parameters.testSet }} + -p:ReferenceType=${{ parameters.referenceType }} + -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} + -p:platform=${{ parameters.platform }} + -p:Configuration=${{ parameters.buildConfiguration }} verbosityRestore: Detailed verbosityPack: Detailed @@ -176,7 +268,15 @@ steps: command: custom projects: build.proj custom: msbuild - arguments: '-t:RunFunctionalTests -p:TF=${{parameters.targetFramework }} -p:TestSet=${{parameters.testSet }} -p:ReferenceType=${{parameters.referenceType }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.nugetPackageVersion }} -p:platform=${{parameters.platform }} -p:Configuration=${{parameters.buildConfiguration }} -p:Filter="category=flaky"' + arguments: >- + -t:RunFunctionalTests + -p:TF=${{ parameters.targetFramework }} + -p:TestSet=${{ parameters.testSet }} + -p:ReferenceType=${{ parameters.referenceType }} + -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} + -p:platform=${{ parameters.platform }} + -p:Configuration=${{ parameters.buildConfiguration }} + -p:Filter="category=flaky" verbosityRestore: Detailed verbosityPack: Detailed continueOnError: true @@ -187,7 +287,14 @@ steps: command: custom projects: build.proj custom: msbuild - arguments: '-t:RunManualTests -p:TF=${{parameters.targetFramework }} -p:TestSet=${{parameters.testSet }} -p:ReferenceType=${{parameters.referenceType }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.nugetPackageVersion }} -p:platform=${{parameters.platform }} -p:Configuration=${{parameters.buildConfiguration }}' + arguments: >- + -t:RunManualTests + -p:TF=${{ parameters.targetFramework }} + -p:TestSet=${{ parameters.testSet }} + -p:ReferenceType=${{ parameters.referenceType }} + -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} + -p:platform=${{ parameters.platform }} + -p:Configuration=${{ parameters.buildConfiguration }} verbosityRestore: Detailed verbosityPack: Detailed retryCountOnTaskFailure: ${{parameters.retryCountOnManualTests }} @@ -198,7 +305,15 @@ steps: command: custom projects: build.proj custom: msbuild - arguments: '-t:RunManualTests -p:TF=${{parameters.targetFramework }} -p:TestSet=${{parameters.testSet }} -p:ReferenceType=${{parameters.referenceType }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.nugetPackageVersion }} -p:platform=${{parameters.platform }} -p:Configuration=${{parameters.buildConfiguration }} -p:Filter="category=flaky"' + arguments: >- + -t:RunManualTests + -p:TF=${{ parameters.targetFramework }} + -p:TestSet=${{ parameters.testSet }} + -p:ReferenceType=${{ parameters.referenceType }} + -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} + -p:platform=${{ parameters.platform }} + -p:Configuration=${{ parameters.buildConfiguration }} + -p:Filter="category=flaky" verbosityRestore: Detailed verbosityPack: Detailed continueOnError: true diff --git a/eng/pipelines/common/templates/steps/update-config-file-step.yml b/eng/pipelines/common/templates/steps/update-config-file-step.yml index f49e552323..65ac9ecf08 100644 --- a/eng/pipelines/common/templates/steps/update-config-file-step.yml +++ b/eng/pipelines/common/templates/steps/update-config-file-step.yml @@ -124,6 +124,10 @@ parameters: type: boolean default: true + - name: WorkloadIdentityFederationServiceConnectionId + type: string + default: '' + steps: # All properties should be added here, and this template should be used for any manipulation of the config.json file. - pwsh: | @@ -180,6 +184,7 @@ steps: $p.IsDNSCachingSupportedCR=[System.Convert]::ToBoolean("${{parameters.IsDNSCachingSupportedCR }}") $p.TracingEnabled=[System.Convert]::ToBoolean("${{parameters.TracingEnabled }}") $p.EnclaveEnabled=[System.Convert]::ToBoolean("${{parameters.EnclaveEnabled }}") + $p.WorkloadIdentityFederationServiceConnectionId="${{parameters.WorkloadIdentityFederationServiceConnectionId }}" } $jdata | ConvertTo-Json | Set-Content "config.json" workingDirectory: src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities @@ -196,4 +201,4 @@ steps: } } workingDirectory: src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities - displayName: 'Read config.json [debug]' + displayName: '[Debug] Emit config.json' diff --git a/eng/pipelines/common/templates/steps/update-nuget-config-local-feed-step.yml b/eng/pipelines/common/templates/steps/update-nuget-config-local-feed-step.yml index 4eac341108..f85ff87bc0 100644 --- a/eng/pipelines/common/templates/steps/update-nuget-config-local-feed-step.yml +++ b/eng/pipelines/common/templates/steps/update-nuget-config-local-feed-step.yml @@ -8,76 +8,56 @@ parameters: type: boolean default: false - - name: downloadedNugetPath # path to the downloaded nuget files + # The path to add as a NuGet source. + - name: packagePath type: string - - name: nugetPackageVersion - type: string - default: $(NugetPackageVersion) - steps: -- powershell: | +- pwsh: | + # Resolve the path to an absolute path. + # + # Resolve-Path throws an error if the path doesn't exist yet, which is an + # expected scenario here, so we must dance around it. + $PackagePath = Resolve-Path "${{ parameters.packagePath }}" -ErrorAction SilentlyContinue -ErrorVariable resolveError + if (-Not ($PackagePath)) + { + $PackagePath = $resolveError[0].TargetObject + } + + # Ensure the package path exists, for example if we are going to generate + # packages in a later step. + if (-Not (Test-Path -Path "$PackagePath")) + { + New-Item -ItemType Directory -Path "$PackagePath" -Force + Write-Host "Created package path: $PackagePath" + } + + Write-Host "Adding package path: $PackagePath" + # Get a list of package sources available Get-PackageSource - #Current location + # Current location Get-Location # Register the local nuget folder to be used by nuget.config - Register-PackageSource -Name "Package Source" -Location ${{parameters.downloadedNugetPath }} -Force -ProviderName NuGet -Trusted + Register-PackageSource -Name "Pipeline Source" -Location "$PackagePath" -Force -ProviderName NuGet -Trusted # Get a list of package sources available after the change Get-PackageSource - #Set the NuGet.config file in the project to use extracted package + # Set the NuGet.config file in the project to use extracted package $rootFolder = Get-location [Xml] $nugetConfig = Get-Content -Path "NuGet.config" - $Value = Resolve-Path ${{parameters.downloadedNugetPath }} $newAdd = $nugetConfig.CreateElement("add") - $newAdd.SetAttribute("key","Package source") - $newAdd.SetAttribute("value", "$Value/" ) + $newAdd.SetAttribute("key","pipeline_source") + $newAdd.SetAttribute("value", "$PackagePath" ) $nugetConfig.configuration.packageSources.AppendChild($newAdd) $nugetConfig.Save("$rootFolder/NuGet.config") - displayName: 'Update NuGet config file to read from Nuget folder' + displayName: 'Add source to NuGet.config' - ${{ if parameters.debug }}: - - powershell: | + - pwsh: | # Display the content of the NuGet.config file Get-Content -Path "NuGet.config" - displayName: 'Read NuGet.config [debug]' - -- task: DotNetCoreCLI@2 - displayName: 'Restore NuGets' - inputs: - command: 'custom' - custom: 'msbuild' - arguments: 'build.proj -t:restore' - feedsToUse: 'select' - -- powershell: | - $Doc = [xml](Get-Content "./Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.csproj") - $parent_xpath = '/Project/ItemGroup/ProjectReference' - $node = $Doc.SelectSingleNode($parent_xpath) - $parentNode = $node.ParentNode - while($node -ne $null) { - $node.ParentNode.RemoveChild($node) - $node = $Doc.SelectSingleNode($parent_xpath) - } - - $parent_xpath = '/Project/ItemGroup/PackageReference[@Include="Microsoft.Data.SqlClient"]' - $node = $Doc.SelectSingleNode($parent_xpath) - - if($node -eq $null){ - $packagerefnode = $doc.createelement("packagereference") - $value = $doc.selectsinglenode('/project/itemgroup/projectreference') - $attrinclude = $doc.createattribute("include") - $attrinclude.value = "microsoft.data.sqlclient" - $packagerefnode.attributes.append($attrinclude) - $parentNode.AppendChild($packageRefNode) - } - - $currentFolder = Get-Location - $filePath = Join-Path $currentFolder "Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.csproj" - $Doc.Save($filePath) - workingDirectory: 'src/Microsoft.Data.SqlClient/add-ons/AzureKeyVaultProvider' - displayName: 'Update AKV Project Ref to Package Ref (.NET Framework/Core)' + displayName: '[Debug] Emit NuGet.config' diff --git a/eng/pipelines/dotnet-sqlclient-ci-core.yml b/eng/pipelines/dotnet-sqlclient-ci-core.yml index f1aaef6ec6..5bfcf9214b 100644 --- a/eng/pipelines/dotnet-sqlclient-ci-core.yml +++ b/eng/pipelines/dotnet-sqlclient-ci-core.yml @@ -68,9 +68,12 @@ parameters: type: object default: [net462, net8.0, net9.0, net10.0] -- name: buildType - displayName: 'Build Type' - default: Project +# The way we will reference sibling projects in the .csproj files: +# Project - use references. +# Package - use references to NuGet packages in the +# packages/ directory. +- name: referenceType + displayName: 'Reference Type' values: - Project - Package @@ -100,72 +103,86 @@ parameters: type: boolean default: true +- name: dotnetVerbosity + displayName: dotnet CLI Verbosity + type: string + default: normal + values: + - quiet + - minimal + - normal + - detailed + - diagnostic + variables: - - template: libraries/ci-build-variables.yml@self - - - name: artifactName - value: Artifacts + - template: /eng/pipelines/libraries/ci-build-variables.yml@self + + - name: mdsArtifactName + value: MDS.Artifact stages: - - stage: build_nugets - displayName: 'Build NuGet Packages' + + # Build MDS and its NuGet packages. + - stage: build_mds_akv_packages_stage + displayName: 'Build MDS & AKV Packages' + jobs: - - template: common/templates/jobs/ci-build-nugets-job.yml@self + - template: /eng/pipelines/common/templates/jobs/ci-build-nugets-job.yml@self parameters: buildConfiguration: ${{ parameters.buildConfiguration }} - artifactName: $(artifactName) + referenceType: ${{ parameters.referenceType }} + mdsPackageVersion: $(mdsPackageVersion) + mdsArtifactName: $(mdsArtifactName) ${{if ne(parameters.SNIVersion, '')}}: prebuildSteps: - - template: common/templates/steps/override-sni-version.yml@self + - template: /eng/pipelines/common/templates/steps/override-sni-version.yml@self parameters: SNIVersion: ${{parameters.SNIVersion}} SNIValidationFeed: ${{parameters.SNIValidationFeed}} + # Run the stress tests, if desired. - ${{ if eq(parameters.enableStressTests, true) }}: - - template: stages/stress-tests-ci-stage.yml@self + - template: /eng/pipelines/stages/stress-tests-ci-stage.yml@self parameters: buildConfiguration: ${{ parameters.buildConfiguration }} - dependsOn: [build_nugets] + dependsOn: + - build_mds_akv_packages_stage pipelineArtifactName: $(artifactName) - mdsPackageVersion: $(NugetPackageVersion) - ${{ if eq(parameters.debug, 'true') }}: - verbosity: 'detailed' - - - template: common/templates/stages/ci-run-tests-stage.yml@self + mdsPackageVersion: $(mdsPackageVersion) + dotnetVerbosity: ${{ parameters.dotnetVerbosity }} + + # Run the MDS and AKV tests. + - template: /eng/pipelines/common/templates/stages/ci-run-tests-stage.yml@self parameters: debug: ${{ parameters.debug }} buildConfiguration: ${{ parameters.buildConfiguration }} - buildType: ${{ parameters.buildType }} + referenceType: ${{ parameters.referenceType }} + mdsArtifactName: $(mdsArtifactName) + mdsPackageVersion: $(mdsPackageVersion) testJobTimeout: ${{ parameters.testJobTimeout }} - ${{ if eq(parameters.buildType, 'Package') }}: - dependsOn: build_nugets - ${{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 + # When testing MDS via packages, we must depend on the MDS package. + ${{ if eq(parameters.referenceType, 'Package') }}: + dependsOn: + - build_mds_akv_packages_stage + + prebuildSteps: # steps to run prior to building and running tests on each job + - ${{if ne(parameters.SNIVersion, '')}}: + - template: /eng/pipelines/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 }} - buildConfiguration: ${{ parameters.buildConfiguration }} - ${{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 }} - buildConfiguration: ${{ parameters.buildConfiguration }} - + + - template: /eng/pipelines/common/templates/steps/ci-prebuild-step.yml@self + parameters: + debug: ${{ parameters.debug }} + referenceType: ${{ parameters.referenceType }} + # Include the code coverage job if the build type is Project. - ${{ if eq(parameters.buildType, 'Project') }}: + ${{ if eq(parameters.referenceType, 'Project') }}: # Jobs to run as part of the tests stage, after the tests are done. postTestJobs: - - template: common/templates/jobs/ci-code-coverage-job.yml@self + - template: /eng/pipelines/common/templates/jobs/ci-code-coverage-job.yml@self parameters: debug: ${{ parameters.debug }} image: ADO-MMS22-CodeCov @@ -382,9 +399,8 @@ stages: # ways to detect if they were present) won't run consistently across forks and non-forks. ${{ if eq(variables['system.pullRequest.isFork'], 'False') }}: AADPasswordConnectionString: $(AAD_PASSWORD_CONN_STR) - AADServicePrincipalId: $(AADServicePrincipalId) - ${{ if eq(variables['system.pullRequest.isFork'], 'False') }}: AADServicePrincipalSecret: $(AADServicePrincipalSecret) + AADServicePrincipalId: $(AADServicePrincipalId) AzureKeyVaultUrl: $(AzureKeyVaultUrl) AzureKeyVaultTenantId: $(AzureKeyVaultTenantId) SupportsIntegratedSecurity: false @@ -412,9 +428,8 @@ stages: AADAuthorityURL: $(AADAuthorityURL) ${{ if eq(variables['system.pullRequest.isFork'], 'False') }}: AADPasswordConnectionString: $(AAD_PASSWORD_CONN_STR_eastus) - AADServicePrincipalId: $(AADServicePrincipalId) - ${{ if eq(variables['system.pullRequest.isFork'], 'False') }}: AADServicePrincipalSecret: $(AADServicePrincipalSecret) + AADServicePrincipalId: $(AADServicePrincipalId) AzureKeyVaultUrl: $(AzureKeyVaultUrl) AzureKeyVaultTenantId: $(AzureKeyVaultTenantId) SupportsIntegratedSecurity: false @@ -422,39 +437,6 @@ stages: LocalDbAppName: $(LocalDbAppName) LocalDbSharedInstanceName: $(LocalDbSharedInstanceName) - # Only run the AE tests if enable and if we have access to the necessary - # secrets. - ${{ if and(eq(parameters.runAlwaysEncryptedTests, true), eq(variables['system.pullRequest.isFork'], 'False')) }}: - windows_enclave_sql: - pool: ADO-CI-AE-1ES-Pool - images: - Win22_Enclave_Sql19: ADO-MMS22-SQL19 - TargetFrameworks: ${{parameters.targetFrameworks }} - netcoreVersionTestUtils: ${{parameters.netcoreVersionTestUtils }} - buildPlatforms: ${{parameters.buildPlatforms }} - testSets: [AE] - useManagedSNI: ${{parameters.useManagedSNI }} - codeCovTargetFrameworks: ${{parameters.codeCovTargetFrameworks }} - configSqlFor: enclave - operatingSystem: Windows - configProperties: - # config.json properties - TCPConnectionStringHGSVBS: $(SQL_TCP_CONN_STRING_HGSVBS) - TCPConnectionStringNoneVBS: $(SQL_TCP_CONN_STRING_NoneVBS) - TCPConnectionStringAASSGX: $(SQL_TCP_CONN_STRING_AASSGX) - EnclaveEnabled: true - AADAuthorityURL: $(AADAuthorityURL) - AADServicePrincipalId: $(AADServicePrincipalId) - ${{ if eq(variables['system.pullRequest.isFork'], 'False') }}: - AADServicePrincipalSecret: $(AADServicePrincipalSecret) - AzureKeyVaultUrl: $(AzureKeyVaultUrl) - AzureKeyVaultTenantId: $(AzureKeyVaultTenantId) - SupportsIntegratedSecurity: $(SupportsIntegratedSecurity) - UserManagedIdentityClientId: $(UserManagedIdentityClientId) - AliasName: $(SQLAliasName) - LocalDbAppName: $(LocalDbAppName) - LocalDbSharedInstanceName: $(LocalDbSharedInstanceName) - # self hosted SQL Server on Linux linux_ub20_22_sql_22: pool: ${{parameters.defaultPoolName }} @@ -501,9 +483,8 @@ stages: AADAuthorityURL: $(AADAuthorityURL) ${{ if eq(variables['system.pullRequest.isFork'], 'False') }}: AADPasswordConnectionString: $(AAD_PASSWORD_CONN_STR) - AADServicePrincipalId: $(AADServicePrincipalId) - ${{ if eq(variables['system.pullRequest.isFork'], 'False') }}: AADServicePrincipalSecret: $(AADServicePrincipalSecret) + AADServicePrincipalId: $(AADServicePrincipalId) AzureKeyVaultUrl: $(AzureKeyVaultUrl) AzureKeyVaultTenantId: $(AzureKeyVaultTenantId) SupportsIntegratedSecurity: false @@ -511,9 +492,64 @@ stages: LocalDbAppName: $(LocalDbAppName) LocalDbSharedInstanceName: $(LocalDbSharedInstanceName) + # Self hosted SQL Server on Mac + mac_sql_22: + pool: Azure Pipelines + hostedPool: true + images: + MacOSLatest_Sql22: macos-latest + TargetFrameworks: ${{parameters.targetFrameworksUnix }} + netcoreVersionTestUtils: ${{parameters.netcoreVersionTestUtils }} + buildPlatforms: [AnyCPU] + testSets: ${{parameters.testSets }} + useManagedSNI: [true] + codeCovTargetFrameworks: ${{parameters.codeCovTargetFrameworks }} + configSqlFor: local + operatingSystem: Mac + configProperties: + # config.json properties + TCPConnectionString: $(SQL_TCP_CONN_STRING) + NPConnectionString: $(SQL_NP_CONN_STRING) + SupportsIntegratedSecurity: false + ManagedIdentitySupported: false + LocalDbAppName: $(LocalDbAppName) + LocalDbSharedInstanceName: $(LocalDbSharedInstanceName) + + # Enclave tests + # # Only run the AE tests if enable and if we have access to the necessary # secrets. ${{ if and(eq(parameters.runAlwaysEncryptedTests, true), eq(variables['system.pullRequest.isFork'], 'False')) }}: + windows_enclave_sql: + pool: ADO-CI-AE-1ES-Pool + images: + Win22_Enclave_Sql19: ADO-MMS22-SQL19 + TargetFrameworks: ${{parameters.targetFrameworks }} + netcoreVersionTestUtils: ${{parameters.netcoreVersionTestUtils }} + buildPlatforms: ${{parameters.buildPlatforms }} + testSets: [AE] + useManagedSNI: ${{parameters.useManagedSNI }} + codeCovTargetFrameworks: ${{parameters.codeCovTargetFrameworks }} + configSqlFor: enclave + operatingSystem: Windows + configProperties: + # config.json properties + TCPConnectionStringHGSVBS: $(SQL_TCP_CONN_STRING_HGSVBS) + TCPConnectionStringNoneVBS: $(SQL_TCP_CONN_STRING_NoneVBS) + TCPConnectionStringAASSGX: $(SQL_TCP_CONN_STRING_AASSGX) + EnclaveEnabled: true + AADAuthorityURL: $(AADAuthorityURL) + AADServicePrincipalId: $(AADServicePrincipalId) + ${{ if eq(variables['system.pullRequest.isFork'], 'False') }}: + AADServicePrincipalSecret: $(AADServicePrincipalSecret) + AzureKeyVaultUrl: $(AzureKeyVaultUrl) + AzureKeyVaultTenantId: $(AzureKeyVaultTenantId) + SupportsIntegratedSecurity: $(SupportsIntegratedSecurity) + UserManagedIdentityClientId: $(UserManagedIdentityClientId) + AliasName: $(SQLAliasName) + LocalDbAppName: $(LocalDbAppName) + LocalDbSharedInstanceName: $(LocalDbSharedInstanceName) + linux_enclave_sql: pool: ADO-CI-AE-1ES-Pool images: @@ -541,26 +577,3 @@ stages: UserManagedIdentityClientId: $(UserManagedIdentityClientId) LocalDbAppName: $(LocalDbAppName) LocalDbSharedInstanceName: $(LocalDbSharedInstanceName) - - # Self hosted SQL Server on Mac - mac_sql_22: - pool: Azure Pipelines - hostedPool: true - images: - MacOSLatest_Sql22: macos-latest - TargetFrameworks: ${{parameters.targetFrameworksUnix }} - netcoreVersionTestUtils: ${{parameters.netcoreVersionTestUtils }} - buildPlatforms: [AnyCPU] - testSets: ${{parameters.testSets }} - useManagedSNI: [true] - codeCovTargetFrameworks: ${{parameters.codeCovTargetFrameworks }} - configSqlFor: local - operatingSystem: Mac - configProperties: - # config.json properties - TCPConnectionString: $(SQL_TCP_CONN_STRING) - NPConnectionString: $(SQL_NP_CONN_STRING) - SupportsIntegratedSecurity: false - ManagedIdentitySupported: false - LocalDbAppName: $(LocalDbAppName) - LocalDbSharedInstanceName: $(LocalDbSharedInstanceName) diff --git a/eng/pipelines/dotnet-sqlclient-ci-package-reference-pipeline.yml b/eng/pipelines/dotnet-sqlclient-ci-package-reference-pipeline.yml index 81183d5ad2..3cf72c4bd5 100644 --- a/eng/pipelines/dotnet-sqlclient-ci-package-reference-pipeline.yml +++ b/eng/pipelines/dotnet-sqlclient-ci-package-reference-pipeline.yml @@ -168,14 +168,27 @@ parameters: type: object default: [false, true] + # Dotnet CLI verbosity level. + - name: dotnetVerbosity + displayName: dotnet CLI Verbosity + type: string + default: normal + values: + - quiet + - minimal + - normal + - detailed + - diagnostic + extends: - template: dotnet-sqlclient-ci-core.yml@self + template: /eng/pipelines/dotnet-sqlclient-ci-core.yml@self parameters: buildConfiguration: ${{ parameters.buildConfiguration }} buildPlatforms: ${{ parameters.buildPlatforms }} - buildType: Package + referenceType: Package codeCovTargetFrameworks: ${{ parameters.codeCovTargetFrameworks }} debug: ${{ parameters.debug }} + dotnetVerbosity: ${{ parameters.dotnetVerbosity }} enableStressTests: ${{ parameters.enableStressTests }} targetFrameworks: ${{ parameters.targetFrameworks }} targetFrameworksUnix: ${{ parameters.targetFrameworksUnix }} diff --git a/eng/pipelines/dotnet-sqlclient-ci-project-reference-pipeline.yml b/eng/pipelines/dotnet-sqlclient-ci-project-reference-pipeline.yml index 02ce475e9c..3a2adc3a49 100644 --- a/eng/pipelines/dotnet-sqlclient-ci-project-reference-pipeline.yml +++ b/eng/pipelines/dotnet-sqlclient-ci-project-reference-pipeline.yml @@ -168,14 +168,27 @@ parameters: type: object default: [false, true] + # Dotnet CLI verbosity level. + - name: dotnetVerbosity + displayName: dotnet CLI Verbosity + type: string + default: normal + values: + - quiet + - minimal + - normal + - detailed + - diagnostic + extends: - template: dotnet-sqlclient-ci-core.yml@self + template: /eng/pipelines/dotnet-sqlclient-ci-core.yml@self parameters: buildConfiguration: ${{ parameters.buildConfiguration }} buildPlatforms: ${{ parameters.buildPlatforms }} - buildType: Project + referenceType: Project codeCovTargetFrameworks: ${{ parameters.codeCovTargetFrameworks }} debug: ${{ parameters.debug }} + dotnetVerbosity: ${{ parameters.dotnetVerbosity }} enableStressTests: ${{ parameters.enableStressTests }} targetFrameworks: ${{ parameters.targetFrameworks }} targetFrameworksUnix: ${{ parameters.targetFrameworksUnix }} diff --git a/eng/pipelines/dotnet-sqlclient-signing-pipeline.yml b/eng/pipelines/dotnet-sqlclient-signing-pipeline.yml index 111412a0dd..66b46aadd2 100644 --- a/eng/pipelines/dotnet-sqlclient-signing-pipeline.yml +++ b/eng/pipelines/dotnet-sqlclient-signing-pipeline.yml @@ -8,6 +8,9 @@ name: $(Year:YY)$(DayOfYear)$(Rev:.r) trigger: branches: include: + + # This pipeline is intended to only run against the ADO dotnet-sqlclient + # repo. - internal/main paths: include: @@ -86,7 +89,7 @@ resources: ref: refs/heads/main extends: - template: v2/OneBranch.${{parameters.oneBranchType }}.CrossPlat.yml@templates # https://aka.ms/obpipelines/templates + template: /v2/OneBranch.${{parameters.oneBranchType }}.CrossPlat.yml@templates # https://aka.ms/obpipelines/templates parameters: featureFlags: # Suggested by MerlinBot (https://sqlclientdrivers.visualstudio.com/ADO.Net/_git/dotnet-sqlclient/pullrequest/4882) @@ -108,14 +111,14 @@ extends: softwareFolder: $(softwareFolder) symbolsFolder: $(symbolsFolder) softwarename: Microsoft.Data.SqlClient - versionNumber: $(AssemblyFileVersion) + versionNumber: $(mdsAssemblyFileVersion) codeql: compiled: enabled: ${{ not(parameters['isPreview']) }} sbom: enabled: ${{ not(parameters['isPreview']) }} packageName: Microsoft.Data.SqlClient - packageVersion: $(NugetPackageVersion) + packageVersion: $(mdsPackageVersion) policheck: enabled: ${{ not(parameters['isPreview']) }} break: true # always break the build on policheck issues. You can disable it by setting to 'false' @@ -143,7 +146,7 @@ extends: - stage: buildMDS displayName: 'Build MDS' jobs: - - template: eng/pipelines/common/templates/jobs/build-signed-package-job.yml@self + - template: /eng/pipelines/common/templates/jobs/build-signed-package-job.yml@self parameters: symbolsFolder: $(symbolsFolder) softwareFolder: $(softwareFolder) @@ -154,7 +157,7 @@ extends: displayName: 'MDS Package Validation' dependsOn: buildMDS jobs: - - template: eng/pipelines/common/templates/jobs/validate-signed-package-job.yml@self + - template: /eng/pipelines/common/templates/jobs/validate-signed-package-job.yml@self parameters: packageFolderName: $(packageFolderName) isPreview: ${{ parameters['isPreview'] }} @@ -165,7 +168,7 @@ extends: displayName: 'Download NuGet Package' # Disabling as of 10/15/2025 due to OneBranch apparently disallowing MSBuild tasks in validation stages. -# - template: eng/pipelines/common/templates/jobs/run-tests-package-reference-job.yml@self +# - template: /eng/pipelines/common/templates/jobs/run-tests-package-reference-job.yml@self # parameters: # packageFolderName: $(packageFolderName) # isPreview: ${{ parameters['isPreview'] }} diff --git a/eng/pipelines/jobs/build-akv-official-job.yml b/eng/pipelines/jobs/build-akv-official-job.yml index 5ce8376845..5b2f15d3f4 100644 --- a/eng/pipelines/jobs/build-akv-official-job.yml +++ b/eng/pipelines/jobs/build-akv-official-job.yml @@ -5,14 +5,17 @@ ################################################################################# parameters: + - name: akvAssemblyFileVersion + type: string + + - name: akvPackageVersion + type: string + - name: apiScanDllPath type: string - name: apiScanPdbPath type: string - - - name: assemblyFileVersion - type: string - name: buildConfiguration type: string @@ -20,9 +23,6 @@ parameters: - Debug - Release - - name: nugetPackageVersion - type: string - - name: mdsPackageVersion type: string @@ -82,21 +82,30 @@ jobs: ob_outputDirectory: '$(ARTIFACT_PATH)' steps: - - template: ../steps/script-output-environment-variables-step.yml@self + - template: /eng/pipelines/steps/script-output-environment-variables-step.yml@self - powershell: | $jsonParams = '${{ convertToJson(parameters) }}' -replace '\\', '\\' $jsonParams | ConvertFrom-Json | Format-List displayName: 'Output Job Parameters' - - template: ../steps/compound-build-akv-step.yml@self + # Perform analysis before building, since this step will clobber build + # output. + - template: /eng/pipelines/steps/roslyn-analyzers-akv-step.yml@self parameters: - assemblyFileVersion: '${{ parameters.assemblyFileVersion }}' + akvPackageVersion: '${{ parameters.akvPackageVersion }}' + buildConfiguration: '${{ parameters.buildConfiguration }}' + mdsPackageVersion: '${{ parameters.mdsPackageVersion }}' + + - template: /eng/pipelines/steps/compound-build-akv-step.yml@self + parameters: + akvAssemblyFileVersion: '${{ parameters.akvAssemblyFileVersion }}' + akvPackageVersion: '${{ parameters.akvPackageVersion }}' buildConfiguration: '${{ parameters.buildConfiguration }}' mdsPackageVersion: '${{ parameters.mdsPackageVersion }}' - ${{ each targetFramework in parameters.targetFrameworks }}: - - template: ../steps/compound-extract-akv-apiscan-files-step.yml + - template: /eng/pipelines/steps/compound-extract-akv-apiscan-files-step.yml@self parameters: buildConfiguration: '${{ parameters.buildConfiguration }}' dllPath: '${{ parameters.apiScanDllPath }}' @@ -104,12 +113,7 @@ jobs: referenceType: Package targetFramework: '${{ targetFramework }}' - - template: ../steps/roslyn-analyzers-akv-step.yml@self - parameters: - buildConfiguration: '${{ parameters.buildConfiguration }}' - mdsPackageVersion: '${{ parameters.mdsPackageVersion }}' - - - template: ../steps/compound-esrp-code-signing-step.yml@self + - template: /eng/pipelines/steps/compound-esrp-code-signing-step.yml@self parameters: appRegistrationClientId: '${{ parameters.signingAppRegistrationClientId }}' appRegistrationTenantId: '${{ parameters.signingAppRegistrationTenantId }}' @@ -119,16 +123,17 @@ jobs: esrpClientId: '${{ parameters.signingEsrpClientId }}' esrpConnectedServiceName: '${{ parameters.signingEsrpConnectedServiceName }}' - - template: ../steps/compound-nuget-pack-step.yml@self + - template: /eng/pipelines/steps/compound-nuget-pack-step.yml@self parameters: buildConfiguration: '${{ parameters.buildConfiguration }}' generateSymbolsPackage: true # Always generate symbols, even if they are not published - packageVersion: '${{ parameters.nugetPackageVersion }}' + packageVersion: '${{ parameters.akvPackageVersion }}' nuspecPath: '$(REPO_ROOT)/tools/specs/add-ons/$(PACKAGE_NAME).nuspec' outputDirectory: '$(ARTIFACT_PATH)' - referenceType: 'Package' + referenceType: Package + properties: MdsPackageVersion=${{ parameters.mdsPackageVersion }} - - template: ../steps/compound-esrp-code-signing-step.yml@self + - template: /eng/pipelines/steps/compound-esrp-code-signing-step.yml@self parameters: appRegistrationClientId: '${{ parameters.signingAppRegistrationClientId }}' appRegistrationTenantId: '${{ parameters.signingAppRegistrationTenantId }}' @@ -139,9 +144,9 @@ jobs: esrpConnectedServiceName: '${{ parameters.signingEsrpConnectedServiceName }}' - ${{ if parameters.publishSymbols }}: - - template: ../steps/compound-publish-symbols-step.yml@self + - template: /eng/pipelines/steps/compound-publish-symbols-step.yml@self parameters: - artifactName: 'akv_symbols_$(System.TeamProject)_$(Build.Repository.Name)_$(Build.SourceBranchName)_${{ parameters.nugetPackageVersion }}_$(System.TimelineId)' + artifactName: 'akv_symbols_$(System.TeamProject)_$(Build.Repository.Name)_$(Build.SourceBranchName)_${{ parameters.akvPackageVersion }}_$(System.TimelineId)' azureSubscription: '${{ parameters.symbolsAzureSubscription }}' publishProjectName: '${{ parameters.symbolsPublishProjectName }}' packageName: '$(PACKAGE_NAME)' @@ -154,4 +159,4 @@ jobs: Windows_NT/${{ parameters.buildConfiguration }}.AnyCPU/AzureKeyVaultProvider/**/$(PACKAGE_NAME).pdb AnyOS/${{ parameters.buildConfiguration }}.AnyCPU/AzureKeyVaultProvider/**/$(PACKAGE_NAME).pdb uploadAccount: '${{ parameters.symbolsUploadAccount }}' - version: '${{ parameters.nugetPackageVersion }}' + version: '${{ parameters.akvPackageVersion }}' diff --git a/eng/pipelines/jobs/stress-tests-ci-job.yml b/eng/pipelines/jobs/stress-tests-ci-job.yml index 5683382597..ccdf3378c4 100644 --- a/eng/pipelines/jobs/stress-tests-ci-job.yml +++ b/eng/pipelines/jobs/stress-tests-ci-job.yml @@ -4,7 +4,7 @@ # file in the project root for more information. ################################################################################ -# This stage builds and runs stress tests against an MDS NuGet package available +# This job builds and runs stress tests against an MDS NuGet package available # as a pipeline artifact. # # The stress tests are located here: diff --git a/eng/pipelines/libraries/build-variables.yml b/eng/pipelines/libraries/build-variables.yml index 3dd87fe7d7..a5b9fc99c4 100644 --- a/eng/pipelines/libraries/build-variables.yml +++ b/eng/pipelines/libraries/build-variables.yml @@ -5,5 +5,5 @@ ################################################################################# variables: - - template: common-variables.yml@self - - template: mds-variables.yml@self + - template: /eng/pipelines/libraries/common-variables.yml@self + - template: /eng/pipelines/libraries/mds-variables.yml@self diff --git a/eng/pipelines/libraries/ci-build-variables.yml b/eng/pipelines/libraries/ci-build-variables.yml index 0d9154da16..b15de7af5b 100644 --- a/eng/pipelines/libraries/ci-build-variables.yml +++ b/eng/pipelines/libraries/ci-build-variables.yml @@ -6,15 +6,16 @@ variables: - group: 'ADO Build properties' - - group: 'ADO CI Packaging' - group: 'ADO Test Configuration Properties' - name: buildNumber value: '$(Build.BuildNumber)' - name: SQLTarget value: 'localhost' - - name: NugetPackageVersion - value: $(Major).$(Minor)$(Patch)-pull.1$(buildnumber) + - name: akvPackageVersion + value: 7.0.0.$(buildNumber)-ci + - name: mdsPackageVersion + value: 7.0.0.$(buildNumber)-ci - name: skipComponentGovernanceDetection value: true - name: runCodesignValidationInjection diff --git a/eng/pipelines/libraries/common-variables.yml b/eng/pipelines/libraries/common-variables.yml index 9dd1726c44..8b02561124 100644 --- a/eng/pipelines/libraries/common-variables.yml +++ b/eng/pipelines/libraries/common-variables.yml @@ -24,6 +24,20 @@ variables: - name: artifactDirectory value: '$(REPOROOT)/packages' + # C# assembly versions must be in the format: Major.Minor.Build.Revision, but + # $(Build.BuildNumber) has the format XXX.YY. Additionally, each version part + # must be a positive 16-bit integer less than 65535. Simply concatenating + # both parts of $(Build.BuildNumber) could produce values larger than 65534, + # so we must omit the second part entirely. Unfortunately, this may result + # in multiple subsequent pipline builds using the same C# assembly versions. + # The package versions will not be affected and will show the complete + # $(Build.BuildNumber) values. + - name: assemblyBuildNumber + value: $[ split(variables['Build.BuildNumber'], '.')[0] ] + + # ---------------------------------------------------------------------------- + # MDS Package Versions + # Update this after every release. This is used to generate the MDS NuGet package version. - name: Major value: '7' @@ -32,17 +46,17 @@ variables: - name: Patch value: '0' - # Update this for preview releases. + # Update this for preview releases. - name: Preview value: '-preview' - name: Revision value: '3' - - name: NugetPackageVersion + - name: mdsPackageVersion value: $(Major).$(Minor).$(Patch) - - name: PreviewNugetPackageVersion + - name: previewMdsPackageVersion value: $(Major).$(Minor).$(Patch)$(Preview)$(Revision).$(Build.BuildNumber) - - name: AssemblyFileVersion - value: '$(Major).$(Minor)$(Patch).$(Build.BuildNumber)' + - name: mdsAssemblyFileVersion + value: $(Major).$(Minor).$(Patch).$(assemblyBuildNumber) - name: nuspecPath value: '$(REPOROOT)/tools/specs/Microsoft.Data.SqlClient.nuspec' diff --git a/eng/pipelines/libraries/mds-validation-variables.yml b/eng/pipelines/libraries/mds-validation-variables.yml index d7723a059f..f465c9c390 100644 --- a/eng/pipelines/libraries/mds-validation-variables.yml +++ b/eng/pipelines/libraries/mds-validation-variables.yml @@ -5,15 +5,15 @@ ################################################################################# variables: - - template: common-variables.yml@self - - template: mds-variables.yml@self + - template: /eng/pipelines/libraries/common-variables.yml@self + - template: /eng/pipelines/libraries/mds-variables.yml@self - name: TempFolderName # extract the nuget package here value: temp - name: extractedNugetRootPath value: $(Build.SourcesDirectory)\$(TempFolderName)\Microsoft.Data.SqlClient - name: extractedNugetPath - value: $(extractedNugetRootPath).$(NugetPackageVersion) + value: $(extractedNugetRootPath).$(mdsPackageVersion) - name: expectedFolderNames value: lib,ref,runtimes - name: expectedDotnetVersions diff --git a/eng/pipelines/libraries/variables.yml b/eng/pipelines/libraries/variables.yml index 57894459d3..03cf141318 100644 --- a/eng/pipelines/libraries/variables.yml +++ b/eng/pipelines/libraries/variables.yml @@ -5,7 +5,7 @@ ################################################################################# variables: - - template: build-variables.yml@self + - template: /eng/pipelines/libraries/build-variables.yml@self # onebranch template variables - name: ob_outputDirectory value: '$(artifactDirectory)' # this directory is uploaded to pipeline artifacts, reddog and cloudvault. More info at https://aka.ms/obpipelines/artifacts diff --git a/eng/pipelines/sqlclient-pr-package-ref-pipeline.yml b/eng/pipelines/sqlclient-pr-package-ref-pipeline.yml index 1d45844a26..e58a1e1e85 100644 --- a/eng/pipelines/sqlclient-pr-package-ref-pipeline.yml +++ b/eng/pipelines/sqlclient-pr-package-ref-pipeline.yml @@ -124,11 +124,11 @@ parameters: default: [false, true] extends: - template: dotnet-sqlclient-ci-core.yml@self + template: /eng/pipelines/dotnet-sqlclient-ci-core.yml@self parameters: buildConfiguration: ${{ parameters.buildConfiguration }} buildPlatforms: ${{ parameters.buildPlatforms }} - buildType: Package + referenceType: Package codeCovTargetFrameworks: ${{ parameters.codeCovTargetFrameworks }} debug: ${{ parameters.debug }} enableStressTests: ${{ parameters.enableStressTests }} diff --git a/eng/pipelines/sqlclient-pr-project-ref-pipeline.yml b/eng/pipelines/sqlclient-pr-project-ref-pipeline.yml index 96321781b8..083a372867 100644 --- a/eng/pipelines/sqlclient-pr-project-ref-pipeline.yml +++ b/eng/pipelines/sqlclient-pr-project-ref-pipeline.yml @@ -124,11 +124,11 @@ parameters: default: [false, true] extends: - template: dotnet-sqlclient-ci-core.yml@self + template: /eng/pipelines/dotnet-sqlclient-ci-core.yml@self parameters: buildConfiguration: ${{ parameters.buildConfiguration }} buildPlatforms: ${{ parameters.buildPlatforms }} - buildType: Project + referenceType: Project codeCovTargetFrameworks: ${{ parameters.codeCovTargetFrameworks }} debug: ${{ parameters.debug }} enableStressTests: ${{ parameters.enableStressTests }} diff --git a/eng/pipelines/stages/stress-tests-ci-stage.yml b/eng/pipelines/stages/stress-tests-ci-stage.yml index 1a2ace53c0..c356cf4d3b 100644 --- a/eng/pipelines/stages/stress-tests-ci-stage.yml +++ b/eng/pipelines/stages/stress-tests-ci-stage.yml @@ -20,6 +20,7 @@ # depended on by downstream stages. parameters: + # The type of build to produce (Debug or Release) - name: buildConfiguration displayName: Build Configuration @@ -36,12 +37,17 @@ parameters: type: object default: [] - # The name of the pipeline artifact to download that contains the MDS package - # to stress test. - - name: pipelineArtifactName - displayName: Pipeline Artifact Name + # The verbosity level for the dotnet CLI commands. + - name: dotnetVerbosity + displayName: dotnet CLI verbosity type: string - default: Artifacts + default: normal + values: + - quiet + - minimal + - normal + - detailed + - diagnostic # The MDS package version to stress test. This version must be available in # one of the configured NuGet sources. @@ -50,29 +56,24 @@ parameters: type: string default: '' + # The list of .NET Framework runtimes to test against. + - name: netFrameworkTestRuntimes + displayName: .NET Framework Test Runtimes + type: object + default: [net462, net47, net471, net472, net48, net481] + # The list of .NET runtimes to test against. - name: netTestRuntimes displayName: .NET Test Runtimes type: object default: [net8.0, net9.0] - # The list of .NET Framework runtimes to test against. - - name: netFrameworkTestRuntimes - displayName: .NET Framework Test Runtimes - type: object - default: [net462] - - # The verbosity level for the dotnet CLI commands. - - name: verbosity - displayName: Dotnet CLI verbosity + # The name of the pipeline artifact to download that contains the MDS package + # to stress test. + - name: pipelineArtifactName + displayName: Pipeline Artifact Name type: string - default: normal - values: - - quiet - - minimal - - normal - - detailed - - diagnostic + default: Artifacts stages: - stage: run_stress_tests_stage @@ -96,7 +97,7 @@ stages: # dotnet CLI arguments common to all commands. - name: commonArguments value: >- - --verbosity ${{parameters.verbosity}} + --verbosity ${{parameters.dotnetVerbosity}} --artifacts-path $(dotnetArtifactsDir) -p:MdsPackageVersion=${{parameters.mdsPackageVersion}} @@ -132,7 +133,7 @@ stages: # -------------------------------------------------------------------------- # Build and test on Linux. - - template: ../jobs/stress-tests-ci-job.yml@self + - template: /eng/pipelines/jobs/stress-tests-ci-job.yml@self parameters: jobNameSuffix: linux displayNamePrefix: Linux @@ -150,7 +151,7 @@ stages: # -------------------------------------------------------------------------- # Build and test on Windows - - template: ../jobs/stress-tests-ci-job.yml + - template: /eng/pipelines/jobs/stress-tests-ci-job.yml@self parameters: jobNameSuffix: windows displayNamePrefix: Win @@ -173,7 +174,7 @@ stages: # -------------------------------------------------------------------------- # Build and test on macOS. - - template: ../jobs/stress-tests-ci-job.yml + - template: /eng/pipelines/jobs/stress-tests-ci-job.yml@self parameters: jobNameSuffix: macos displayNamePrefix: macOS diff --git a/eng/pipelines/steps/compound-build-akv-step.yml b/eng/pipelines/steps/compound-build-akv-step.yml index ce8da41d52..7a09eb3f2c 100644 --- a/eng/pipelines/steps/compound-build-akv-step.yml +++ b/eng/pipelines/steps/compound-build-akv-step.yml @@ -7,10 +7,13 @@ # @TODO: This can probably be made generic and pass in the command lines for msbuild # BUT, they should be kept separate by now as we rebuild build.proj in parallel, we won't # affect >1 project at a time. -# @TODO: NugetPackageVersion should not be used for MDS package version +# @TODO: mdsPackageVersion should not be used for MDS package version parameters: - - name: assemblyFileVersion + - name: akvAssemblyFileVersion + type: string + + - name: akvPackageVersion type: string - name: buildConfiguration @@ -39,8 +42,9 @@ steps: configuration: '${{ parameters.buildConfiguration }}' msbuildArguments: >- -t:BuildAkv - -p:AssemblyFileVersion=${{ parameters.assemblyFileVersion }} - -p:NugetPackageVersion=${{ parameters.mdsPackageVersion }} + -p:AssemblyFileVersion=${{ parameters.akvAssemblyFileVersion }} + -p:AkvPackageVersion=${{ parameters.akvPackageVersion }} + -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} -p:ReferenceType=Package -p:SigningKeyPath=$(Agent.TempDirectory)/netfxKeypair.snk diff --git a/eng/pipelines/steps/compound-nuget-pack-step.yml b/eng/pipelines/steps/compound-nuget-pack-step.yml index b07252e29d..41905c8483 100644 --- a/eng/pipelines/steps/compound-nuget-pack-step.yml +++ b/eng/pipelines/steps/compound-nuget-pack-step.yml @@ -26,8 +26,14 @@ parameters: - name: referenceType type: string values: - - Package - - Project + - Package + - Project + + # Semi-colon separated properties to pass to nuget via the -properties + # argument. + - name: properties + type: string + default: '' steps: # This tool is failing on OneBranch pipelines, possibly due to new @@ -63,7 +69,7 @@ steps: -SymbolPackageFormat snupkg -Version ${{ parameters.packageVersion }} -OutputDirectory ${{ parameters.outputDirectory }} - -Properties "COMMITID=$(Build.SourceVersion);Configuration=${{ parameters.buildConfiguration }};ReferenceType=${{ parameters.referenceType }}" + -Properties "COMMITID=$(Build.SourceVersion);Configuration=${{ parameters.buildConfiguration }};ReferenceType=${{ parameters.referenceType }};${{ parameters.properties }}" - ${{ else }}: - task: NuGetCommand@2 displayName: 'Generate NuGet Package' @@ -74,4 +80,4 @@ steps: ${{ parameters.nuspecPath }} -Version ${{ parameters.packageVersion }} -OutputDirectory ${{ parameters.outputDirectory }} - -Properties "COMMITID=$(Build.SourceVersion);Configuration=${{ parameters.buildConfiguration }};ReferenceType=${{ parameters.referenceType }}" + -Properties "COMMITID=$(Build.SourceVersion);Configuration=${{ parameters.buildConfiguration }};ReferenceType=${{ parameters.referenceType }};${{ parameters.properties }}" diff --git a/eng/pipelines/steps/roslyn-analyzers-akv-step.yml b/eng/pipelines/steps/roslyn-analyzers-akv-step.yml index ebb6ff0801..8b2b4bd331 100644 --- a/eng/pipelines/steps/roslyn-analyzers-akv-step.yml +++ b/eng/pipelines/steps/roslyn-analyzers-akv-step.yml @@ -4,11 +4,23 @@ # See the LICENSE file in the project root for more information. # ################################################################################# +# This template defines a step to run Roslyn Analyzers on the AKV project build. +# It uses the RoslynAnalyzers@3 task from the Secure Development Team's SDL +# extension: +# +# https://eng.ms/docs/cloud-ai-platform/devdiv/one-engineering-system-1es/1es-mohanb/security-integration/guardian-wiki/sdl-azdo-extension/roslyn-analyzers-build-task +# +# GOTCHA: This step will clobber any existing build output. It should be run +# _before_ any build steps that perform versioning or signing. + # @TODO: This can probably be made generic and pass in the command lines for msbuild # BUT, they should be kept separate by now as we rebuild build.proj in parallel, we won't # affect >1 project at a time. parameters: + - name: akvPackageVersion + type: string + - name: buildConfiguration type: string values: @@ -28,7 +40,8 @@ steps: $(REPO_ROOT)/build.proj -t:BuildAkv -p:Configuration=${{ parameters.buildConfiguration }} - -p:NugetPackageVersion=${{ parameters.mdsPackageVersion }} + -p:AkvPackageVersion=${{ parameters.akvPackageVersion }} + -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} -p:ReferenceType=Package msBuildVersion: 17.0 setupCommandLinePicker: vs2022 diff --git a/eng/pipelines/variables/akv-official-variables.yml b/eng/pipelines/variables/akv-official-variables.yml index aaf8de7c5e..591a562686 100644 --- a/eng/pipelines/variables/akv-official-variables.yml +++ b/eng/pipelines/variables/akv-official-variables.yml @@ -35,9 +35,7 @@ variables: value: '-preview1' # Compound Variables --------------------------------------------------- - - name: assemblyFileVersion + - name: akvAssemblyFileVersion value: '${{ variables.versionMajor }}.${{ variables.versionMinor }}${{ variables.versionPatch }}.$(Build.BuildNumber)' - - name: nugetPackageVersion + - name: akvPackageVersion value: '${{ variables.versionMajor }}.${{ variables.versionMinor }}.${{ variables.versionPatch }}${{ variables.versionPreview }}' - - diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 16535cf9a7..7a3e277e2a 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -12,15 +12,12 @@ - Project - $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb + Project $([System.IO.Path]::Combine('$(IntermediateOutputPath)','$(TargetFrameworkMoniker).AssemblyAttributes$(DefaultLanguageSourceExtension)')) diff --git a/src/Microsoft.Data.SqlClient/add-ons/AzureKeyVaultProvider/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.csproj b/src/Microsoft.Data.SqlClient/add-ons/AzureKeyVaultProvider/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.csproj index 8bdb0e520a..967196ab83 100644 --- a/src/Microsoft.Data.SqlClient/add-ons/AzureKeyVaultProvider/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.csproj +++ b/src/Microsoft.Data.SqlClient/add-ons/AzureKeyVaultProvider/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.csproj @@ -29,11 +29,18 @@ - - - - + + + + + + + + + + + diff --git a/src/Microsoft.Data.SqlClient/add-ons/Directory.Build.props b/src/Microsoft.Data.SqlClient/add-ons/Directory.Build.props index 7776439adc..d5bd53f012 100644 --- a/src/Microsoft.Data.SqlClient/add-ons/Directory.Build.props +++ b/src/Microsoft.Data.SqlClient/add-ons/Directory.Build.props @@ -8,8 +8,6 @@ $(OS) true true - Project - $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb true $([System.IO.Path]::Combine('$(IntermediateOutputPath)','$(TargetFramework)','$(TargetFrameworkMoniker).AssemblyAttributes$(DefaultLanguageSourceExtension)')) diff --git a/src/Microsoft.Data.SqlClient/add-ons/Directory.Packages.props b/src/Microsoft.Data.SqlClient/add-ons/Directory.Packages.props deleted file mode 100644 index 197a396a0c..0000000000 --- a/src/Microsoft.Data.SqlClient/add-ons/Directory.Packages.props +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.csproj index e6ffc2526b..a2751a6e57 100644 --- a/src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.csproj +++ b/src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.csproj @@ -1,14 +1,15 @@  - false + Microsoft.Data.SqlClient net8.0;net9.0;netstandard2.0 + false $(ObjFolder)$(Configuration)\$(AssemblyName)\ref\ netcoreapp $(BinFolder)$(Configuration)\$(AssemblyName)\ref\ $(BinFolder)$(Configuration).$(Platform)\$(AssemblyName)\netstandard\ - $(OutputPath)\$(TargetFramework)\Microsoft.Data.SqlClient.xml + $(OutputPath)\$(TargetFramework)\$(AssemblyName).xml Core $(BaseProduct) Debug;Release; AnyCPU;x64;x86 @@ -49,7 +50,7 @@ - + diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj index 9263cb1063..bbbf05277b 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj @@ -2,8 +2,8 @@ Microsoft.Data.SqlClient net8.0;net9.0 - Microsoft.Data.SqlClient is not supported on this platform. $(OS) + Microsoft.Data.SqlClient is not supported on this platform. false netcoreapp diff --git a/src/Microsoft.Data.SqlClient/netfx/ref/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/netfx/ref/Microsoft.Data.SqlClient.csproj index 1d9c1985bd..2735cce404 100644 --- a/src/Microsoft.Data.SqlClient/netfx/ref/Microsoft.Data.SqlClient.csproj +++ b/src/Microsoft.Data.SqlClient/netfx/ref/Microsoft.Data.SqlClient.csproj @@ -1,10 +1,11 @@  + Microsoft.Data.SqlClient + net462 false - net462 $(ObjFolder)$(Configuration)\$(AssemblyName)\ref\ $(BinFolder)$(Configuration)\$(AssemblyName)\ref\ - $(OutputPath)\Microsoft.Data.SqlClient.xml + $(OutputPath)\$(AssemblyName).xml Framework $(BaseProduct) Debug;Release diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj index 5d64d4f0ed..51e301a835 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj +++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj @@ -1,16 +1,16 @@  Microsoft.Data.SqlClient - net462 - $(OS) + net462 {407890AC-9876-4FEF-A6F1-F36A876BAADE} + $(OS) true AnyCPU $(BinFolder)$(Configuration).$(OutputPlatform)\ $(ObjFolder)$(Configuration).$(OutputPlatform)\ $(BinPath)$(AssemblyName)\netfx\ - $(OutputPath)\Microsoft.Data.SqlClient.xml + $(OutputPath)\$(AssemblyName).xml $(ObjPath)$(AssemblyName)\netfx\ Framework $(BaseProduct) false diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj index 4adf180433..ac06a9deac 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj +++ b/src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj @@ -1,6 +1,7 @@  + Microsoft.Data.SqlClient Debug;Release; true @@ -15,6 +16,11 @@ $(SigningKeyPath) + + + net462;net8.0;net9.0 + + @@ -25,7 +31,18 @@ - + + Windows_NT $(OS) @@ -40,13 +57,6 @@ $(DefineConstants);_WINDOWS - - - - net8.0;net9.0 - $(TargetFrameworks);net462 - - @@ -129,6 +139,19 @@ + + + + + + diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/Common/AdapterUtil.netfx.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/Common/AdapterUtil.netfx.cs index c7427a6a8d..8b8d8b3c5b 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/Common/AdapterUtil.netfx.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/Common/AdapterUtil.netfx.cs @@ -13,7 +13,10 @@ using System.Security.Permissions; using System.Text; using System.Threading.Tasks; + +#if _WINDOWS using Interop.Windows.Kernel32; +#endif namespace Microsoft.Data.Common { diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Connection/SqlConnectionInternal.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Connection/SqlConnectionInternal.cs index 5567dac6d5..4d01cee3a5 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Connection/SqlConnectionInternal.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Connection/SqlConnectionInternal.cs @@ -619,7 +619,7 @@ internal bool Is2008OrNewer internal override bool IsAccessTokenExpired { get => _federatedAuthenticationInfoRequested && - DateTime.FromFileTimeUtc(_fedAuthToken.expirationFileTime) < DateTime.UtcNow.AddSeconds(accessTokenExpirationBufferTime); + DateTime.FromFileTimeUtc(_fedAuthToken.ExpirationFileTime) < DateTime.UtcNow.AddSeconds(accessTokenExpirationBufferTime); } /// @@ -1806,8 +1806,8 @@ internal void OnFedAuthInfo(SqlFedAuthInfo fedAuthInfo) // Construct the dbAuthenticationContextKey with information from FedAuthInfo and // store for later use, when inserting in to the token cache. _dbConnectionPoolAuthenticationContextKey = new DbConnectionPoolAuthenticationContextKey( - fedAuthInfo.stsurl, - fedAuthInfo.spn); + fedAuthInfo.StsUrl, + fedAuthInfo.Spn); // Try to retrieve the authentication context from the pool, if one does exist for // this key. @@ -1928,14 +1928,12 @@ internal void OnFedAuthInfo(SqlFedAuthInfo fedAuthInfo) // If the code flow is here, then we are re-using the context from the cache for // this connection attempt and not generating a new access token on this thread. - _fedAuthToken = new SqlFedAuthToken - { - accessToken = dbConnectionPoolAuthenticationContext.AccessToken, - expirationFileTime = dbConnectionPoolAuthenticationContext.ExpirationTime.ToFileTime() - }; + _fedAuthToken = new( + dbConnectionPoolAuthenticationContext.AccessToken, + dbConnectionPoolAuthenticationContext.ExpirationTime.ToFileTime()); } - Debug.Assert(_fedAuthToken?.accessToken != null, + Debug.Assert(_fedAuthToken?.AccessToken != null, "_fedAuthToken and _fedAuthToken.accessToken cannot be null."); _parser.SendFedAuthToken(_fedAuthToken); @@ -2717,9 +2715,6 @@ private SqlFedAuthToken GetFedAuthToken(SqlFedAuthInfo fedAuthInfo) // Number of attempts, for tracing purposes, if we underwent retries. int numberOfAttempts = 0; - // Object that will be returned to the caller, containing all required data about the token. - _fedAuthToken = new SqlFedAuthToken(); - // Username to use in error messages. string username = null; @@ -2748,8 +2743,8 @@ private SqlFedAuthToken GetFedAuthToken(SqlFedAuthInfo fedAuthInfo) { var authParamsBuilder = new SqlAuthenticationParameters.Builder( authenticationMethod: ConnectionOptions.Authentication, - resource: fedAuthInfo.spn, - authority: fedAuthInfo.stsurl, + resource: fedAuthInfo.Spn, + authority: fedAuthInfo.StsUrl, serverName: ConnectionOptions.DataSource, databaseName: ConnectionOptions.InitialCatalog) .WithConnectionId(_clientConnectionId) @@ -2892,7 +2887,7 @@ await _accessTokenCallback(parameters, cts.Token)) break; } - Debug.Assert(_fedAuthToken.accessToken != null, "AccessToken should not be null."); + Debug.Assert(_fedAuthToken.AccessToken != null, "AccessToken should not be null."); #if DEBUG if (_forceMsalRetry) @@ -2994,16 +2989,27 @@ await _accessTokenCallback(parameters, cts.Token)) } } - Debug.Assert(_fedAuthToken != null, "fedAuthToken should not be null."); - Debug.Assert(_fedAuthToken.accessToken?.Length > 0, - "fedAuthToken.accessToken should not be null or empty."); + // Nullable context has exposed that _fedAuthToken may be null here, + // which the existing code didn't handle. + if (_fedAuthToken is null) + { + // We failed to acquire a token, so use a default one. + // + // TODO: The old code actually allowed the AccessToken byte + // array to be null, and then had Debug.Assert()s to verify it + // wasn't null. We never test in debug, so those were never + // firing, and we were happily using a _fedAuthToken with a null + // AccessToken. Now that SqlFedAuthToken doesn't allow a null + // AccessToken, we just create an empty one instead. + _fedAuthToken = new SqlFedAuthToken([], 0); + } // Store the newly generated token in _newDbConnectionPoolAuthenticationContext, only if using pooling. if (_dbConnectionPool != null) { - DateTime expirationTime = DateTime.FromFileTimeUtc(_fedAuthToken.expirationFileTime); + DateTime expirationTime = DateTime.FromFileTimeUtc(_fedAuthToken.ExpirationFileTime); _newDbConnectionPoolAuthenticationContext = new DbConnectionPoolAuthenticationContext( - _fedAuthToken.accessToken, + _fedAuthToken.AccessToken, expirationTime); } diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/ConnectionPool/DbConnectionPoolIdentity.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/ConnectionPool/DbConnectionPoolIdentity.cs index 7eca7bd0f6..898ca5a248 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/ConnectionPool/DbConnectionPoolIdentity.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/ConnectionPool/DbConnectionPoolIdentity.cs @@ -6,9 +6,6 @@ #if NETFRAMEWORK using System.Runtime.Versioning; -#endif - -#if _WINDOWS using System.Security.Principal; #endif diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Diagnostics/SqlClientMetrics.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Diagnostics/SqlClientMetrics.cs index f6eb1c84c1..a813a03003 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Diagnostics/SqlClientMetrics.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Diagnostics/SqlClientMetrics.cs @@ -8,7 +8,9 @@ #if NET using System.Threading; #else +#if _WINDOWS using Interop.Windows.Kernel32; +#endif using Microsoft.Data.Common; using System.Diagnostics; diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlDependency.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlDependency.cs index e237e0e3e7..9ce5c20342 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlDependency.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlDependency.cs @@ -20,7 +20,9 @@ using System.Runtime.Serialization; using System.Runtime.Versioning; using System.Security.Permissions; +#if _WINDOWS using Interop.Windows.Sni; +#endif using Microsoft.Data.SqlClient.LocalDb; #endif diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlErrorCollection.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlErrorCollection.cs index 4684747627..fe20d0d2e5 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlErrorCollection.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlErrorCollection.cs @@ -45,6 +45,11 @@ internal SqlErrorCollection() { } /// public IEnumerator GetEnumerator() => _errors.GetEnumerator(); - internal void Add(SqlError error) => _errors.Add(error); + // Append the error to our list, and return ourselves for chaining. + internal SqlErrorCollection Add(SqlError error) + { + _errors.Add(error); + return this; + } } } diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlException.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlException.cs index 27d29d45e1..1a606242c2 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlException.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlException.cs @@ -255,8 +255,6 @@ internal static SqlException CreateException( Exception innerException = null, SqlBatchCommand batchCommand = null) { - Debug.Assert(errorCollection != null && errorCollection.Count > 0, "no errorCollection?"); - StringBuilder message = new(); for (int i = 0; i < errorCollection.Count; i++) { @@ -267,7 +265,11 @@ internal static SqlException CreateException( message.Append(errorCollection[i].Message); } - if (innerException == null && errorCollection[0].Win32ErrorCode != 0 && errorCollection[0].Win32ErrorCode != -1) + if (innerException is null && + errorCollection is not null && + errorCollection.Count > 0 && + errorCollection[0].Win32ErrorCode != 0 && + errorCollection[0].Win32ErrorCode != -1) { innerException = new Win32Exception(errorCollection[0].Win32ErrorCode); } @@ -280,7 +282,10 @@ internal static SqlException CreateException( exception.Data.Add("HelpLink.ProdVer", serverVersion); } exception.Data.Add("HelpLink.EvtSrc", "MSSQLServer"); - exception.Data.Add("HelpLink.EvtID", errorCollection[0].Number.ToString(CultureInfo.InvariantCulture)); + if (errorCollection is not null && errorCollection.Count > 0) + { + exception.Data.Add("HelpLink.EvtID", errorCollection[0].Number.ToString(CultureInfo.InvariantCulture)); + } exception.Data.Add("HelpLink.BaseHelpUrl", "https://go.microsoft.com/fwlink"); exception.Data.Add("HelpLink.LinkId", "20476"); diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlUtil.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlUtil.cs index 7c7d3e8c87..9054f88ab7 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlUtil.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlUtil.cs @@ -21,7 +21,9 @@ #if NETFRAMEWORK using System.Runtime.InteropServices; using System.Runtime.Versioning; +#if _WINDOWS using Interop.Windows.Kernel32; +#endif #else using System.Net.Sockets; #endif diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/TdsParser.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/TdsParser.cs index dfdf69022f..d99b40cdea 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/TdsParser.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/TdsParser.cs @@ -30,7 +30,9 @@ #if NETFRAMEWORK using System.Runtime.CompilerServices; +#if _WINDOWS using Interop.Windows.Sni; +#endif using Microsoft.Data.SqlTypes; #endif @@ -4317,7 +4319,8 @@ private TdsOperationStatus TryProcessLoginAck(TdsParserStateObject stateObj, out private TdsOperationStatus TryProcessFedAuthInfo(TdsParserStateObject stateObj, int tokenLen, out SqlFedAuthInfo sqlFedAuthInfo) { sqlFedAuthInfo = null; - SqlFedAuthInfo tempFedAuthInfo = new SqlFedAuthInfo(); + string spn = null; + string stsUrl = null; // Skip reading token length, since it has already been read in caller SqlClientEventSource.Log.TryAdvancedTraceEvent(" FEDAUTHINFO token stream length = {0}", tokenLen); @@ -4410,15 +4413,15 @@ private TdsOperationStatus TryProcessFedAuthInfo(TdsParserStateObject stateObj, } SqlClientEventSource.Log.TryAdvancedTraceEvent(" FedAuthInfoData: {0}", data); - // store data in tempFedAuthInfo + // Store data in temporaries. switch ((TdsEnums.FedAuthInfoId)id) { case TdsEnums.FedAuthInfoId.Spn: - tempFedAuthInfo.spn = data; + spn = data; break; case TdsEnums.FedAuthInfoId.Stsurl: - tempFedAuthInfo.stsurl = data; + stsUrl = data; break; default: @@ -4433,15 +4436,16 @@ private TdsOperationStatus TryProcessFedAuthInfo(TdsParserStateObject stateObj, throw SQL.ParsingErrorLength(ParsingErrorState.FedAuthInfoLengthTooShortForData, tokenLen); } - SqlClientEventSource.Log.TryTraceEvent(" Processed FEDAUTHINFO token stream: {0}", tempFedAuthInfo); - if (string.IsNullOrWhiteSpace(tempFedAuthInfo.stsurl) || string.IsNullOrWhiteSpace(tempFedAuthInfo.spn)) + if (string.IsNullOrWhiteSpace(spn) || string.IsNullOrWhiteSpace(stsUrl)) { // We should be receiving both stsurl and spn SqlClientEventSource.Log.TryTraceEvent(" FEDAUTHINFO token stream does not contain both STSURL and SPN."); throw SQL.ParsingError(ParsingErrorState.FedAuthInfoDoesNotContainStsurlAndSpn); } - sqlFedAuthInfo = tempFedAuthInfo; + sqlFedAuthInfo = new(spn, stsUrl); + SqlClientEventSource.Log.TryTraceEvent(" Processed FEDAUTHINFO token stream: {0}", sqlFedAuthInfo); + return TdsOperationStatus.Done; } @@ -9601,11 +9605,11 @@ private int ApplyFeatureExData(TdsEnums.FeatureExtension requestedFeatures, internal void SendFedAuthToken(SqlFedAuthToken fedAuthToken) { Debug.Assert(fedAuthToken != null, "fedAuthToken cannot be null"); - Debug.Assert(fedAuthToken.accessToken != null, "fedAuthToken.accessToken cannot be null"); + Debug.Assert(fedAuthToken.AccessToken != null, "fedAuthToken.AccessToken cannot be null"); SqlClientEventSource.Log.TryTraceEvent(" Sending federated authentication token"); _physicalStateObj._outputMessageType = TdsEnums.MT_FEDAUTH; - byte[] accessToken = fedAuthToken.accessToken; + byte[] accessToken = fedAuthToken.AccessToken; // Send total length (length of token plus 4 bytes for the token length field) // If we were sending a nonce, this would include that length as well diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/TdsParserHelperClasses.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/TdsParserHelperClasses.cs index 8f0bb915c0..16386e1d9d 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/TdsParserHelperClasses.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/TdsParserHelperClasses.cs @@ -13,6 +13,7 @@ using System.Security; using System.Security.Authentication; using System.Text; +using System.Text.Encodings; using Microsoft.Data.Common; using Microsoft.Data.Common.ConnectionString; @@ -128,23 +129,53 @@ internal sealed class SqlLoginAck internal uint tdsVersion; } + #nullable enable + internal sealed class SqlFedAuthInfo { - internal string spn; - internal string stsurl; + internal string Spn { get; } + internal string StsUrl { get; } + + internal SqlFedAuthInfo(string spn, string stsurl) + { + Spn = spn; + StsUrl = stsurl; + } + public override string ToString() { - return $"STSURL: {stsurl}, SPN: {spn}"; + return $"SPN: {Spn}, STSURL: {StsUrl}"; } } internal sealed class SqlFedAuthToken { - internal uint dataLen; - internal byte[] accessToken; - internal long expirationFileTime; + internal byte[] AccessToken { get; } + internal uint DataLen { get; } + internal long ExpirationFileTime { get; } + + internal SqlFedAuthToken( + byte[] accessToken, + long expirationFileTime) + { + AccessToken = accessToken; + DataLen = (uint)AccessToken.Length; + ExpirationFileTime = expirationFileTime; + } + + /// + /// Convert from a SqlAuthenticationToken. + /// + internal SqlFedAuthToken(SqlAuthenticationToken token) + { + AccessToken = Encoding.Unicode.GetBytes(token.AccessToken); + DataLen = (uint)AccessToken.Length; + ExpirationFileTime = token.ExpiresOn.ToFileTime(); + } } + #nullable disable + internal sealed class _SqlMetaData : SqlMetaDataPriv { [Flags] diff --git a/src/Microsoft.Data.SqlClient/tests/Common/Common.csproj b/src/Microsoft.Data.SqlClient/tests/Common/Common.csproj index ec728d6a98..1e827794ed 100644 --- a/src/Microsoft.Data.SqlClient/tests/Common/Common.csproj +++ b/src/Microsoft.Data.SqlClient/tests/Common/Common.csproj @@ -40,10 +40,10 @@ - + PreserveNewest xunit.runner.json - + @@ -51,12 +51,11 @@ - - PreserveNewest - %(Filename)%(Extension) - + + + diff --git a/src/Microsoft.Data.SqlClient/tests/CustomConfigurableRetryLogic/CustomRetryLogicProvider.csproj b/src/Microsoft.Data.SqlClient/tests/CustomConfigurableRetryLogic/CustomRetryLogicProvider.csproj index 1b35e8f80d..f420579f9e 100644 --- a/src/Microsoft.Data.SqlClient/tests/CustomConfigurableRetryLogic/CustomRetryLogicProvider.csproj +++ b/src/Microsoft.Data.SqlClient/tests/CustomConfigurableRetryLogic/CustomRetryLogicProvider.csproj @@ -10,9 +10,15 @@ - - - - + + + + + + + + + + diff --git a/src/Microsoft.Data.SqlClient/tests/Directory.Build.props b/src/Microsoft.Data.SqlClient/tests/Directory.Build.props index 71335f36ba..d790614874 100644 --- a/src/Microsoft.Data.SqlClient/tests/Directory.Build.props +++ b/src/Microsoft.Data.SqlClient/tests/Directory.Build.props @@ -11,7 +11,6 @@ true Debug;Release; AnyCPU;x86;x64 - Project diff --git a/src/Microsoft.Data.SqlClient/tests/Directory.Packages.props b/src/Microsoft.Data.SqlClient/tests/Directory.Packages.props index 4a031a49a6..e8d684f944 100644 --- a/src/Microsoft.Data.SqlClient/tests/Directory.Packages.props +++ b/src/Microsoft.Data.SqlClient/tests/Directory.Packages.props @@ -14,9 +14,4 @@ - - - - - diff --git a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/AssertExtensions.cs b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/AssertExtensions.cs index 1a37bc6f12..7a2acc1160 100644 --- a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/AssertExtensions.cs +++ b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/AssertExtensions.cs @@ -13,7 +13,7 @@ namespace System { public static class AssertExtensions { - private static bool IsFullFramework => TestUtility.IsFullFramework; + private static bool IsFullFramework => TestUtility.IsNetFramework; public static void Throws(Action action, string message) where T : Exception @@ -36,7 +36,7 @@ public static void Throws(string netCoreParamName, string netFxParamName, Act IsFullFramework ? netFxParamName : netCoreParamName; - if (!TestUtility.NetNative) + if (!TestUtility.IsNetNative) { Assert.Equal(expectedParamName, exception.ParamName); } @@ -57,7 +57,7 @@ public static void Throws(string netCoreParamName, string netFxParamName, Fun IsFullFramework ? netFxParamName : netCoreParamName; - if (!TestUtility.NetNative) + if (!TestUtility.IsNetNative) { Assert.Equal(expectedParamName, exception.ParamName); } @@ -68,7 +68,7 @@ public static T Throws(string paramName, Action action) { T exception = Assert.Throws(action); - if (!TestUtility.NetNative) + if (!TestUtility.IsNetNative) { Assert.Equal(paramName, exception.ParamName); } @@ -89,7 +89,7 @@ public static T Throws(string paramName, Func testCode) { T exception = Assert.Throws(testCode); - if (!TestUtility.NetNative) + if (!TestUtility.IsNetNative) { Assert.Equal(paramName, exception.ParamName); } @@ -102,7 +102,7 @@ public static async Task ThrowsAsync(string paramName, Func testCode { T exception = await Assert.ThrowsAsync(testCode); - if (!TestUtility.NetNative) + if (!TestUtility.IsNetNative) { Assert.Equal(paramName, exception.ParamName); } diff --git a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/DataCommon/DummySqlAuthenticationProvider.cs b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/DataCommon/DummySqlAuthenticationProvider.cs index bb5e2e2e52..c68baf63eb 100644 --- a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/DataCommon/DummySqlAuthenticationProvider.cs +++ b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/DataCommon/DummySqlAuthenticationProvider.cs @@ -20,8 +20,9 @@ public class DummySqlAuthenticationProvider : SqlAuthenticationProvider public override Task AcquireTokenAsync(SqlAuthenticationParameters parameters) => Task.FromResult(new SqlAuthenticationToken(DUMMY_TOKEN_STR, new DateTimeOffset(DateTime.Now.AddHours(2)))); - // Supported authentication modes don't matter for dummy test, but added to demonstrate config file usage. public override bool IsSupported(SqlAuthenticationMethod authenticationMethod) - => authenticationMethod == SqlAuthenticationMethod.ActiveDirectoryInteractive; + { + return authenticationMethod == SqlAuthenticationMethod.ActiveDirectoryInteractive; + } } } diff --git a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/DataCommon/TestUtility.cs b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/DataCommon/TestUtility.cs index c4c2ac4d0f..bcbc68a502 100644 --- a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/DataCommon/TestUtility.cs +++ b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/DataCommon/TestUtility.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System; using System.Runtime.InteropServices; namespace Microsoft.Data.SqlClient.Tests @@ -10,7 +9,18 @@ namespace Microsoft.Data.SqlClient.Tests public static class TestUtility { public static readonly bool IsNotArmProcess = RuntimeInformation.ProcessArchitecture != Architecture.Arm; - public static bool IsFullFramework => RuntimeInformation.FrameworkDescription.StartsWith(".NET Framework"); - public static bool NetNative => RuntimeInformation.FrameworkDescription.StartsWith(".NET Native"); + public static bool IsNet + { + get + { + return + !IsNetCore && !IsNetFramework && !IsNetNative && + RuntimeInformation.FrameworkDescription.StartsWith(".NET"); + } + } + + public static bool IsNetCore => RuntimeInformation.FrameworkDescription.StartsWith(".NET Core"); + public static bool IsNetFramework => RuntimeInformation.FrameworkDescription.StartsWith(".NET Framework"); + public static bool IsNetNative => RuntimeInformation.FrameworkDescription.StartsWith(".NET Native"); } } diff --git a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/app.config b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/app.config index fb7f63f65f..9fc08c65a7 100644 --- a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/app.config +++ b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/app.config @@ -7,6 +7,7 @@ + diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTesting.Tests.csproj b/src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTesting.Tests.csproj index 3155b87f81..5d6fe12907 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTesting.Tests.csproj +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTesting.Tests.csproj @@ -293,6 +293,8 @@ + + Common @@ -313,11 +315,30 @@ - - - + + + + + + + + + + + + + + + @@ -333,7 +354,6 @@ - @@ -348,11 +368,11 @@ runtime; build; native; contentfiles; analyzers; buildtransitive all - - PreserveNewest - %(Filename)%(Extension) - + + + + PreserveNewest @@ -366,9 +386,9 @@ Always - + PreserveNewest xunit.runner.json - + diff --git a/src/Microsoft.Data.SqlClient/tests/PerformanceTests/Microsoft.Data.SqlClient.PerformanceTests.csproj b/src/Microsoft.Data.SqlClient/tests/PerformanceTests/Microsoft.Data.SqlClient.PerformanceTests.csproj index 380e3c8a8e..239be4d3a2 100644 --- a/src/Microsoft.Data.SqlClient/tests/PerformanceTests/Microsoft.Data.SqlClient.PerformanceTests.csproj +++ b/src/Microsoft.Data.SqlClient/tests/PerformanceTests/Microsoft.Data.SqlClient.PerformanceTests.csproj @@ -15,12 +15,22 @@ - + + + + + + + + + + + diff --git a/src/Microsoft.Data.SqlClient/tests/StressTests/Directory.Build.props b/src/Microsoft.Data.SqlClient/tests/StressTests/Directory.Build.props index 6ff30d72c8..fb26623a2e 100644 --- a/src/Microsoft.Data.SqlClient/tests/StressTests/Directory.Build.props +++ b/src/Microsoft.Data.SqlClient/tests/StressTests/Directory.Build.props @@ -6,7 +6,7 @@ - net462;net47;net471;net472;net48;net481;net8.0;net9.0;net10.0 + net462;net8.0;net9.0;net10.0 + + + true true @@ -21,12 +27,9 @@ - - - - - - 6.1.0-preview2.25178.5 + + + 6.1.3 diff --git a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities/Config.cs b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities/Config.cs index 257903ce41..72ed2e63a0 100644 --- a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities/Config.cs +++ b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities/Config.cs @@ -45,6 +45,7 @@ public class Config public static Config Load(string configPath = @"config.json") { + // Allow an override of the config path via an environment variable. configPath = Environment.GetEnvironmentVariable("MDS_TEST_CONFIG") ?? configPath; try diff --git a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities/Microsoft.Data.SqlClient.TestUtilities.csproj b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities/Microsoft.Data.SqlClient.TestUtilities.csproj index 45ba5c2cf9..2f802adc75 100644 --- a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities/Microsoft.Data.SqlClient.TestUtilities.csproj +++ b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities/Microsoft.Data.SqlClient.TestUtilities.csproj @@ -1,9 +1,6 @@  - netfx - netcoreapp - win - win-$(Platform) + netstandard2.0 $(ObjFolder)$(Configuration).$(Platform)\$(AssemblyName) $(BinFolder)$(Configuration).$(Platform)\$(AssemblyName) @@ -14,10 +11,6 @@ PreserveNewest - - - - diff --git a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities/Utils.cs b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities/Utils.cs index 5d708e757d..bb1e2220a8 100644 --- a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities/Utils.cs +++ b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities/Utils.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System; -using System.Collections.Generic; namespace Microsoft.Data.SqlClient.TestUtilities { diff --git a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities/config.default.json b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities/config.default.json index 5ef2e9c99e..4362d07c75 100644 --- a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities/config.default.json +++ b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities/config.default.json @@ -35,5 +35,6 @@ "ManagedIdentitySupported": true, "UserManagedIdentityClientId": "", "PowerShellPath": "", - "AliasName": "" + "AliasName": "", + "WorkloadIdentityFederationServiceConnectionId": "" } diff --git a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities/xunit.runner.json b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities/xunit.runner.json index 42755c93ec..38ccf678dd 100644 --- a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities/xunit.runner.json +++ b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities/xunit.runner.json @@ -1,9 +1,18 @@ { - "$schema": "https://xunit.net/schema/current/xunit.runner.schema.json", - "diagnosticMessages": true, - "parallelizeAssembly": true, - "shadowCopy": false, - "printMaxEnumerableLength": 0, - "printMaxStringLength": 0, - "showLiveOutput": false + "_comment1": "xUnit v2 doesn't allow proper JSON comments, so we put our comments in keys that are ignored.", + "_comment2": "Options for v3+ are prefixed with '_v3_'", + + "$schema": "https://xunit.net/schema/v2.8/xunit.runner.schema.json", + "_v3_$schema": "https://xunit.net/schema/current/xunit.runner.schema.json", + + "diagnosticMessages": true, + "parallelizeAssembly": true, + "shadowCopy": false, + + "_v3_culture": "invariant", + "_v3_printMaxEnumerableLength": 0, + "_v3_printMaxObjectDepth": 0, + "_v3_printMaxObjectMemberCount": 0, + "_v3_printMaxStringLength": 0, + "_v3_showLiveOutput": true } diff --git a/src/Microsoft.SqlServer.Server/Microsoft.SqlServer.Server.csproj b/src/Microsoft.SqlServer.Server/Microsoft.SqlServer.Server.csproj index 48d163cab6..89d6d91b37 100644 --- a/src/Microsoft.SqlServer.Server/Microsoft.SqlServer.Server.csproj +++ b/src/Microsoft.SqlServer.Server/Microsoft.SqlServer.Server.csproj @@ -6,7 +6,7 @@ net46;netstandard2.0 $(ObjFolder)$(Configuration).$(Platform)\$(AssemblyName)\ $(BinFolder)$(Configuration).$(Platform)\$(AssemblyName)\ - $(OutputPath)$(TargetFramework)\Microsoft.SqlServer.Server.xml + $(OutputPath)$(TargetFramework)\$(AssemblyName).xml portable false true diff --git a/src/Microsoft.SqlServer.Server/StringsHelper.cs b/src/Microsoft.SqlServer.Server/StringsHelper.cs index 610839adbf..8f3915e18c 100644 --- a/src/Microsoft.SqlServer.Server/StringsHelper.cs +++ b/src/Microsoft.SqlServer.Server/StringsHelper.cs @@ -48,13 +48,17 @@ public static string GetResourceString(string res) { StringsHelper sys = GetLoader(); if (sys == null) + { return null; + } // If "res" is a resource id, temp will not be null, "res" will contain the retrieved resource string. // If "res" is not a resource id, temp will be null. string temp = sys._resources.GetString(res, Culture); if (temp != null) + { res = temp; + } return res; } diff --git a/tools/props/Versions.props b/tools/props/Versions.props index ad42c4964a..24046667b0 100644 --- a/tools/props/Versions.props +++ b/tools/props/Versions.props @@ -1,29 +1,12 @@ - + + + - 7.0.0 0 - - - $(MdsVersionDefault).$(BuildNumber) - - 7.0.0.0 - - $(AssemblyFileVersion) - $(MdsVersionDefault)-dev - $(NugetPackageVersion) + + @@ -33,17 +16,47 @@ 1.0.0-dev $(SqlServerPackageVersion) + + - $(NugetPackageVersion) + 7.0.0 + + $(MdsVersionDefault).$(BuildNumber)-dev + + + $(MdsVersionDefault).$(BuildNumber) + + + 7.0.0.0 - See the 'Modify TestMicrosoftDataSqlClientVersion' step. + $(AssemblyFileVersion) + + - $(NugetPackageVersion) + $(MdsPackageVersion) + + + + + 7.0.0 + $(AkvVersionDefault).$(BuildNumber)-dev diff --git a/tools/specs/Microsoft.Data.SqlClient.nuspec b/tools/specs/Microsoft.Data.SqlClient.nuspec index 9cb42a9ed6..bec49cb1ef 100644 --- a/tools/specs/Microsoft.Data.SqlClient.nuspec +++ b/tools/specs/Microsoft.Data.SqlClient.nuspec @@ -111,103 +111,108 @@ + + - - + + - - + + - - + + - - + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - + + - - - - + + + + - - - - + + + + diff --git a/tools/specs/Microsoft.SqlServer.Server.nuspec b/tools/specs/Microsoft.SqlServer.Server.nuspec index eec275b292..df75137b92 100644 --- a/tools/specs/Microsoft.SqlServer.Server.nuspec +++ b/tools/specs/Microsoft.SqlServer.Server.nuspec @@ -36,15 +36,20 @@ Microsoft.SqlServer.Server.Format + + - - - + + + - - - + + + diff --git a/tools/specs/add-ons/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.nuspec b/tools/specs/add-ons/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.nuspec index 0816fd3086..e55fb4e7cb 100644 --- a/tools/specs/add-ons/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.nuspec +++ b/tools/specs/add-ons/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.nuspec @@ -25,13 +25,13 @@ Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyStoreProvider.SqlColumnEncrypti sqlclient microsoft.data.sqlclient azurekeyvaultprovider akvprovider alwaysencrypted - + - + @@ -45,6 +45,11 @@ Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyStoreProvider.SqlColumnEncrypti + + diff --git a/tools/targets/CopySniDllsForNetFxProjectReferenceBuilds.targets b/tools/targets/CopySniDllsForNetFxProjectReferenceBuilds.targets new file mode 100644 index 0000000000..47c45c41cd --- /dev/null +++ b/tools/targets/CopySniDllsForNetFxProjectReferenceBuilds.targets @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + diff --git a/tools/targets/GenerateMdsPackage.targets b/tools/targets/GenerateMdsPackage.targets new file mode 100644 index 0000000000..50f9b8fddd --- /dev/null +++ b/tools/targets/GenerateMdsPackage.targets @@ -0,0 +1,14 @@ + + + + + + + + + + + + + diff --git a/tools/targets/GenerateNugetPackage.targets b/tools/targets/GenerateNugetPackage.targets deleted file mode 100644 index 4c8cea4159..0000000000 --- a/tools/targets/GenerateNugetPackage.targets +++ /dev/null @@ -1,31 +0,0 @@ - - - - - $(NugetPackageVersion)-debug - - - - - - - - - - - - - $(SqlServerPackageVersion)-debug - - - - - - - - - - - diff --git a/tools/targets/GenerateSqlServerPackage.targets b/tools/targets/GenerateSqlServerPackage.targets new file mode 100644 index 0000000000..909c0da6e0 --- /dev/null +++ b/tools/targets/GenerateSqlServerPackage.targets @@ -0,0 +1,13 @@ + + + + + + + + + + + + diff --git a/tools/targets/add-ons/GenerateAKVProviderNugetPackage.targets b/tools/targets/add-ons/GenerateAKVProviderNugetPackage.targets deleted file mode 100644 index 78da74bf32..0000000000 --- a/tools/targets/add-ons/GenerateAKVProviderNugetPackage.targets +++ /dev/null @@ -1,12 +0,0 @@ - - - - - $(NugetPackageVersion)-debug - - - - - - diff --git a/tools/targets/add-ons/GenerateAkvPackage.targets b/tools/targets/add-ons/GenerateAkvPackage.targets new file mode 100644 index 0000000000..2aefc55ca4 --- /dev/null +++ b/tools/targets/add-ons/GenerateAkvPackage.targets @@ -0,0 +1,13 @@ + + + + + + + + + + + + From dd05d62906ac165f329a384aab317b275c196ae1 Mon Sep 17 00:00:00 2001 From: Paul Medynski <31868385+paulmedynski@users.noreply.github.com> Date: Mon, 19 Jan 2026 11:37:15 -0400 Subject: [PATCH 02/15] Task 41424: Merge feat/azure-split to main: Step 1 - Common changes - Added a few more changes. --- eng/pipelines/steps/compound-build-akv-step.yml | 1 - .../ActiveDirectoryAuthenticationTimeoutRetryHelper.cs | 3 ++- .../tests/StressTests/Directory.Packages.props | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/eng/pipelines/steps/compound-build-akv-step.yml b/eng/pipelines/steps/compound-build-akv-step.yml index 7a09eb3f2c..53b3d32371 100644 --- a/eng/pipelines/steps/compound-build-akv-step.yml +++ b/eng/pipelines/steps/compound-build-akv-step.yml @@ -7,7 +7,6 @@ # @TODO: This can probably be made generic and pass in the command lines for msbuild # BUT, they should be kept separate by now as we rebuild build.proj in parallel, we won't # affect >1 project at a time. -# @TODO: mdsPackageVersion should not be used for MDS package version parameters: - name: akvAssemblyFileVersion diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/ActiveDirectoryAuthenticationTimeoutRetryHelper.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/ActiveDirectoryAuthenticationTimeoutRetryHelper.cs index e972102260..721e31ca6f 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/ActiveDirectoryAuthenticationTimeoutRetryHelper.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/ActiveDirectoryAuthenticationTimeoutRetryHelper.cs @@ -132,7 +132,8 @@ private static string GetTokenHash(SqlFedAuthToken token) } // Here we mimic how ADAL calculates hash for token. They use UTF8 instead of Unicode. - var originalTokenString = SqlAuthenticationToken.AccessTokenStringFromBytes(token.accessToken); + var originalTokenString = Encoding.Unicode.GetString(token.AccessToken); + var bytesInUtf8 = Encoding.UTF8.GetBytes(originalTokenString); using (var sha256 = SHA256.Create()) { diff --git a/src/Microsoft.Data.SqlClient/tests/StressTests/Directory.Packages.props b/src/Microsoft.Data.SqlClient/tests/StressTests/Directory.Packages.props index df2d150b8c..f547c6aa98 100644 --- a/src/Microsoft.Data.SqlClient/tests/StressTests/Directory.Packages.props +++ b/src/Microsoft.Data.SqlClient/tests/StressTests/Directory.Packages.props @@ -27,9 +27,9 @@ - - - 6.1.3 + + + 6.1.4 From 39c3ab1ab1428bf9b4839a3a2322b344e555e0a6 Mon Sep 17 00:00:00 2001 From: Paul Medynski <31868385+paulmedynski@users.noreply.github.com> Date: Mon, 19 Jan 2026 11:50:03 -0400 Subject: [PATCH 03/15] Task 41424: Merge feat/azure-split to main: Step 1 - Common changes - Fixed compilation issues. --- .../src/Microsoft.Data.SqlClient.csproj | 13 ------ .../Connection/SqlConnectionInternal.cs | 46 +++++++++++-------- .../Data/SqlClient/SqlAuthenticationToken.cs | 36 --------------- 3 files changed, 26 insertions(+), 69 deletions(-) diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj index ac06a9deac..2e38c79532 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj +++ b/src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj @@ -139,19 +139,6 @@ - - - - - - diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Connection/SqlConnectionInternal.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Connection/SqlConnectionInternal.cs index 4d01cee3a5..1922ae052f 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Connection/SqlConnectionInternal.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Connection/SqlConnectionInternal.cs @@ -2778,11 +2778,12 @@ private SqlFedAuthToken GetFedAuthToken(SqlFedAuthInfo fedAuthInfo) // in the same context. Fixes block-over-async deadlock possibilities // https://github.com/dotnet/SqlClient/issues/1209 // @TODO: Verify that the wrapping/unwrapping is necessary. - _fedAuthToken = Task.Run(async () => + _fedAuthToken = new( + Task.Run(async () => await authProvider.AcquireTokenAsync(authParamsBuilder)) - .GetAwaiter() - .GetResult() - .ToSqlFedAuthToken(); + .GetAwaiter() + .GetResult()); + _activeDirectoryAuthTimeoutRetryHelper.CachedToken = _fedAuthToken; } @@ -2801,7 +2802,11 @@ await authProvider.AcquireTokenAsync(authParamsBuilder)) else { authParamsBuilder.WithUserId(ConnectionOptions.UserID); - _fedAuthToken = Task.Run(async () => await authProvider.AcquireTokenAsync(authParamsBuilder)).GetAwaiter().GetResult().ToSqlFedAuthToken(); + _fedAuthToken = new( + Task.Run(async () => + await authProvider.AcquireTokenAsync(authParamsBuilder)) + .GetAwaiter() + .GetResult()); _activeDirectoryAuthTimeoutRetryHelper.CachedToken = _fedAuthToken; } @@ -2823,21 +2828,21 @@ await authProvider.AcquireTokenAsync(authParamsBuilder)) { username = _credential.UserId; authParamsBuilder.WithUserId(username).WithPassword(_credential.Password); - _fedAuthToken = Task.Run(async () => - await authProvider.AcquireTokenAsync(authParamsBuilder)) - .GetAwaiter() - .GetResult() - .ToSqlFedAuthToken(); + _fedAuthToken = new( + Task.Run(async () => + await authProvider.AcquireTokenAsync(authParamsBuilder)) + .GetAwaiter() + .GetResult()); } else { username = ConnectionOptions.UserID; authParamsBuilder.WithUserId(username).WithPassword(ConnectionOptions.Password); - _fedAuthToken = Task.Run(async () => - await authProvider.AcquireTokenAsync(authParamsBuilder)) - .GetAwaiter() - .GetResult() - .ToSqlFedAuthToken(); + _fedAuthToken = new( + Task.Run(async () => + await authProvider.AcquireTokenAsync(authParamsBuilder)) + .GetAwaiter() + .GetResult()); } _activeDirectoryAuthTimeoutRetryHelper.CachedToken = _fedAuthToken; } @@ -2877,11 +2882,12 @@ await authProvider.AcquireTokenAsync(authParamsBuilder)) cts.CancelAfter((int)_timeout.MillisecondsRemaining); } - _fedAuthToken = Task.Run(async () => - await _accessTokenCallback(parameters, cts.Token)) - .GetAwaiter() - .GetResult() - .ToSqlFedAuthToken(); + _fedAuthToken = new( + Task.Run(async () => + await _accessTokenCallback(parameters, cts.Token)) + .GetAwaiter() + .GetResult()); + _activeDirectoryAuthTimeoutRetryHelper.CachedToken = _fedAuthToken; } break; diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlAuthenticationToken.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlAuthenticationToken.cs index c405cac2cb..d61ab75008 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlAuthenticationToken.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlAuthenticationToken.cs @@ -27,41 +27,5 @@ public SqlAuthenticationToken(string accessToken, DateTimeOffset expiresOn) AccessToken = accessToken; ExpiresOn = expiresOn; } - - /// - /// Constructor. - /// - internal SqlAuthenticationToken(byte[] accessToken, DateTimeOffset expiresOn) - : this(AccessTokenStringFromBytes(accessToken), expiresOn) { } - - /// - /// Convert to driver's internal token class. - /// - internal SqlFedAuthToken ToSqlFedAuthToken() - { - var tokenBytes = AccessTokenBytesFromString(AccessToken); - return new SqlFedAuthToken - { - accessToken = tokenBytes, - dataLen = (uint)tokenBytes.Length, - expirationFileTime = ExpiresOn.ToFileTime() - }; - } - - /// - /// Convert token bytes to string. - /// - internal static string AccessTokenStringFromBytes(byte[] bytes) - { - return Encoding.Unicode.GetString(bytes); - } - - /// - /// Convert token string to bytes. - /// - internal static byte[] AccessTokenBytesFromString(string token) - { - return Encoding.Unicode.GetBytes(token); - } } } From 329e8b6cf2730ed61396fd21cac7f57a8a17e0ce Mon Sep 17 00:00:00 2001 From: Paul Medynski <31868385+paulmedynski@users.noreply.github.com> Date: Mon, 19 Jan 2026 13:03:34 -0400 Subject: [PATCH 04/15] Task 41424: Merge feat/azure-split to main: Step 1 - Common changes - Fixed missing referenceType parameter. --- eng/pipelines/common/templates/jobs/ci-build-nugets-job.yml | 1 + eng/pipelines/common/templates/jobs/ci-run-tests-job.yml | 2 +- eng/pipelines/steps/compound-publish-symbols-step.yml | 1 - 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/pipelines/common/templates/jobs/ci-build-nugets-job.yml b/eng/pipelines/common/templates/jobs/ci-build-nugets-job.yml index 1951c3ed37..7b2a89b3e2 100644 --- a/eng/pipelines/common/templates/jobs/ci-build-nugets-job.yml +++ b/eng/pipelines/common/templates/jobs/ci-build-nugets-job.yml @@ -83,6 +83,7 @@ jobs: parameters: platform: ${{ parameters.platform }} buildConfiguration: Release + referenceType: ${{ parameters.referenceType }} operatingSystem: Windows build: all diff --git a/eng/pipelines/common/templates/jobs/ci-run-tests-job.yml b/eng/pipelines/common/templates/jobs/ci-run-tests-job.yml index b5ed70fd3f..c9368e9ef5 100644 --- a/eng/pipelines/common/templates/jobs/ci-run-tests-job.yml +++ b/eng/pipelines/common/templates/jobs/ci-run-tests-job.yml @@ -150,7 +150,7 @@ jobs: } displayName: 'Verify Password' - - ${{ if eq(parameters.buildType, 'Project') }}: + - ${{ if eq(parameters.referenceType, 'Project') }}: - template: ../steps/ci-project-build-step.yml@self parameters: build: allNoDocs diff --git a/eng/pipelines/steps/compound-publish-symbols-step.yml b/eng/pipelines/steps/compound-publish-symbols-step.yml index 5afda0182a..c636b59915 100644 --- a/eng/pipelines/steps/compound-publish-symbols-step.yml +++ b/eng/pipelines/steps/compound-publish-symbols-step.yml @@ -40,7 +40,6 @@ parameters: type: string - # Type of build, used to determine path to search for symbols files - # @TODO: Can we remove this? name: referenceType type: string values: From 3b49dcb51603876d3398bbca412c81a0fd4139b0 Mon Sep 17 00:00:00 2001 From: Paul Medynski <31868385+paulmedynski@users.noreply.github.com> Date: Mon, 19 Jan 2026 13:12:23 -0400 Subject: [PATCH 05/15] Task 41424: Merge feat/azure-split to main: Step 1 - Common changes - Fixed another missing referenceType. --- .../common/templates/jobs/build-signed-package-job.yml | 2 ++ eng/pipelines/common/templates/jobs/ci-run-tests-job.yml | 1 + .../common/templates/steps/copy-dlls-for-test-step.yml | 5 ++--- .../common/templates/steps/publish-symbols-step.yml | 5 ++--- eng/pipelines/jobs/build-akv-official-job.yml | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/eng/pipelines/common/templates/jobs/build-signed-package-job.yml b/eng/pipelines/common/templates/jobs/build-signed-package-job.yml index af47081ed3..d23521ab65 100644 --- a/eng/pipelines/common/templates/jobs/build-signed-package-job.yml +++ b/eng/pipelines/common/templates/jobs/build-signed-package-job.yml @@ -85,11 +85,13 @@ jobs: - template: /eng/pipelines/common/templates/steps/copy-dlls-for-test-step.yml@self parameters: buildConfiguration: Release + referenceType: Package product: MDS # Publish symbols to servers - template: /eng/pipelines/common/templates/steps/publish-symbols-step.yml@self parameters: buildConfiguration: Release + referenceType: Package publishSymbols: ${{ parameters['PublishSymbols'] }} symbolsArtifactName: mds_symbols_$(System.TeamProject)_$(Build.Repository.Name)_$(Build.SourceBranchName)_$(mdsPackageVersion)_$(System.TimelineId) diff --git a/eng/pipelines/common/templates/jobs/ci-run-tests-job.yml b/eng/pipelines/common/templates/jobs/ci-run-tests-job.yml index c9368e9ef5..24e6dcb9af 100644 --- a/eng/pipelines/common/templates/jobs/ci-run-tests-job.yml +++ b/eng/pipelines/common/templates/jobs/ci-run-tests-job.yml @@ -155,6 +155,7 @@ jobs: parameters: build: allNoDocs buildConfiguration: ${{ parameters.buildConfiguration }} + referenceType: ${{ parameters.referenceType }} - ${{ if ne(parameters.configProperties, '{}') }}: - template: /eng/pipelines/common/templates/steps/update-config-file-step.yml@self # update config.json file diff --git a/eng/pipelines/common/templates/steps/copy-dlls-for-test-step.yml b/eng/pipelines/common/templates/steps/copy-dlls-for-test-step.yml index 711c3a9b8f..353583e7b9 100644 --- a/eng/pipelines/common/templates/steps/copy-dlls-for-test-step.yml +++ b/eng/pipelines/common/templates/steps/copy-dlls-for-test-step.yml @@ -19,10 +19,9 @@ parameters: default: software - name: referenceType - default: project values: - - project - - package + - Project + - Package - name: listOfTF type: object diff --git a/eng/pipelines/common/templates/steps/publish-symbols-step.yml b/eng/pipelines/common/templates/steps/publish-symbols-step.yml index 3f80ae8d2d..2c394055a0 100644 --- a/eng/pipelines/common/templates/steps/publish-symbols-step.yml +++ b/eng/pipelines/common/templates/steps/publish-symbols-step.yml @@ -35,10 +35,9 @@ parameters: public: true - name: referenceType - default: project values: - - project - - package + - Project + - Package - name: product default: MDS diff --git a/eng/pipelines/jobs/build-akv-official-job.yml b/eng/pipelines/jobs/build-akv-official-job.yml index 5b2f15d3f4..aa22af4025 100644 --- a/eng/pipelines/jobs/build-akv-official-job.yml +++ b/eng/pipelines/jobs/build-akv-official-job.yml @@ -154,7 +154,7 @@ jobs: publishToInternal: true publishToPublic: true publishTokenUri: '${{ parameters.symbolsPublishTokenUri }}' - referenceType: 'Package' + referenceType: Package searchPattern: | Windows_NT/${{ parameters.buildConfiguration }}.AnyCPU/AzureKeyVaultProvider/**/$(PACKAGE_NAME).pdb AnyOS/${{ parameters.buildConfiguration }}.AnyCPU/AzureKeyVaultProvider/**/$(PACKAGE_NAME).pdb From 22709701468e7a95f6d335c0dd9f6d52a3bbdd49 Mon Sep 17 00:00:00 2001 From: Paul Medynski <31868385+paulmedynski@users.noreply.github.com> Date: Mon, 19 Jan 2026 13:14:33 -0400 Subject: [PATCH 06/15] Task 41424: Merge feat/azure-split to main: Step 1 - Common changes - Fixed buildConfiguration parameter name. --- eng/pipelines/common/templates/steps/ci-project-build-step.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/common/templates/steps/ci-project-build-step.yml b/eng/pipelines/common/templates/steps/ci-project-build-step.yml index 204ae98a14..948c609129 100644 --- a/eng/pipelines/common/templates/steps/ci-project-build-step.yml +++ b/eng/pipelines/common/templates/steps/ci-project-build-step.yml @@ -136,7 +136,7 @@ steps: -p:ReferenceType=${{ parameters.ReferenceType }} -p:TestEnabled=true -p:GenerateDocumentationFile=false - -p:configuration=${{ parameters.configuration }} + -p:Configuration=${{ parameters.buildConfiguration }} verbosityRestore: Detailed verbosityPack: Detailed retryCountOnTaskFailure: 1 From 595a5bd14dc609774914d161b64e34f16df2e531 Mon Sep 17 00:00:00 2001 From: Paul Medynski <31868385+paulmedynski@users.noreply.github.com> Date: Mon, 19 Jan 2026 13:16:21 -0400 Subject: [PATCH 07/15] Task 41424: Merge feat/azure-split to main: Step 1 - Common changes - Removed non-existent projects from CodeQL Workflow. --- .github/workflows/codeql.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index f19ee63bfc..22f6a08a20 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -90,15 +90,11 @@ jobs: # projects instead of the main solution file. run: | dotnet build src/Microsoft.SqlServer.Server - dotnet build src/Microsoft.Data.SqlClient.Extensions/Abstractions/src - dotnet build src/Microsoft.Data.SqlClient.Extensions/Abstractions/test dotnet build src/Microsoft.Data.SqlClient/netcore/ref dotnet build src/Microsoft.Data.SqlClient/netcore/src dotnet build src/Microsoft.Data.SqlClient/netfx/ref dotnet build src/Microsoft.Data.SqlClient/netfx/src dotnet build src/Microsoft.Data.SqlClient/src - dotnet build src/Microsoft.Data.SqlClient.Extensions/Azure/src - dotnet build src/Microsoft.Data.SqlClient.Extensions/Azure/test dotnet build src/Microsoft.Data.SqlClient/add-ons/AzureKeyVaultProvider dotnet build src/Microsoft.Data.SqlClient/tests/UnitTests dotnet build src/Microsoft.Data.SqlClient/tests/FunctionalTests From 9d8f74d0dd3d2ef6f1c9543abc1484a169b439b4 Mon Sep 17 00:00:00 2001 From: Paul Medynski <31868385+paulmedynski@users.noreply.github.com> Date: Mon, 19 Jan 2026 14:59:09 -0400 Subject: [PATCH 08/15] Task 41424: Merge feat/azure-split to main: Step 1 - Common changes - Tweaks after reviewing the PR. --- NuGet.config.local | 9 +-- .../jobs/build-signed-package-job.yml | 5 -- .../templates/jobs/ci-build-nugets-job.yml | 26 +++++--- .../templates/jobs/ci-run-tests-job.yml | 6 +- .../jobs/run-tests-package-reference-job.yml | 9 +-- .../templates/stages/ci-run-tests-stage.yml | 8 +-- .../templates/steps/ci-prebuild-step.yml | 26 -------- .../steps/publish-test-results-step.yml | 2 +- .../update-nuget-config-local-feed-step.yml | 63 ------------------- eng/pipelines/dotnet-sqlclient-ci-core.yml | 52 ++++++++------- .../dotnet-sqlclient-signing-pipeline.yml | 5 +- .../stages/stress-tests-ci-stage.yml | 4 +- tools/props/Versions.props | 2 +- 13 files changed, 59 insertions(+), 158 deletions(-) delete mode 100644 eng/pipelines/common/templates/steps/ci-prebuild-step.yml delete mode 100644 eng/pipelines/common/templates/steps/update-nuget-config-local-feed-step.yml diff --git a/NuGet.config.local b/NuGet.config.local index 3e23ac372c..859f696e67 100644 --- a/NuGet.config.local +++ b/NuGet.config.local @@ -1,7 +1,8 @@  @@ -12,8 +13,4 @@ - - - - diff --git a/eng/pipelines/common/templates/jobs/build-signed-package-job.yml b/eng/pipelines/common/templates/jobs/build-signed-package-job.yml index d23521ab65..0061a2874f 100644 --- a/eng/pipelines/common/templates/jobs/build-signed-package-job.yml +++ b/eng/pipelines/common/templates/jobs/build-signed-package-job.yml @@ -50,11 +50,6 @@ jobs: # Perform analysis before building, since this step will clobber build output. - template: /eng/pipelines/common/templates/steps/code-analyze-step.yml@self - # Update the root NuGet.config to use the packages/ directory as a source. - - template: /eng/pipelines/common/templates/steps/update-nuget-config-local-feed-step.yml@self - parameters: - packagePath: $(REPOROOT)/packages - # Build MDS in Package mode, producing signed DLLs. - template: /eng/pipelines/common/templates/steps/build-all-configurations-signed-dlls-step.yml@self parameters: diff --git a/eng/pipelines/common/templates/jobs/ci-build-nugets-job.yml b/eng/pipelines/common/templates/jobs/ci-build-nugets-job.yml index 7b2a89b3e2..6f73558270 100644 --- a/eng/pipelines/common/templates/jobs/ci-build-nugets-job.yml +++ b/eng/pipelines/common/templates/jobs/ci-build-nugets-job.yml @@ -5,7 +5,7 @@ ################################################################################# parameters: - - name: 'debug' + - name: debug type: boolean default: false @@ -23,9 +23,9 @@ parameters: type: string default: ADO-MMS22-SQL19 - - name: mdsArtifactName + - name: mdsArtifactsName type: string - default: MDS.Artifact + default: MDS.Artifacts - name: platform type: string @@ -58,18 +58,24 @@ jobs: - template: /eng/pipelines/libraries/ci-build-variables.yml@self steps: + - ${{ if eq(parameters.debug, true)}}: + - powershell: | + Get-ChildItem env: | Sort-Object Name + displayName: '[Debug] List Environment Variables' + - ${{ if ne(parameters.prebuildSteps, '') }}: - - ${{ parameters.prebuildSteps }} # extra steps to run before the build like downloading sni and the required configuration + # Extra steps to run before the build like downloading sni and the required + # configuration + - ${{ parameters.prebuildSteps }} # If we're testing in Package mode, create the packages/ directory and then # setup the top-level NuGet.config to look in packages/ for local NuGet # dependencies. - ${{ if eq(parameters.referenceType, 'Package') }}: - pwsh: New-Item -Path "$(RepoRoot)/packages" -ItemType Directory -Force - - template: /eng/pipelines/common/templates/steps/ci-prebuild-step.yml@self - parameters: - debug: ${{ parameters.debug }} - referenceType: ${{ parameters.referenceType }} + displayName: Create packages/ directory + - pwsh: Copy-Item -Path "$(Build.SourcesDirectory)/NuGet.config.local" -Destination "$(Build.SourcesDirectory)/NuGet.config" -Force + displayName: Use local NuGet packages # Install the .NET SDK. - template: /eng/pipelines/steps/install-dotnet.yml@self @@ -127,7 +133,7 @@ jobs: referenceType: ${{ parameters.referenceType }} - task: PublishPipelineArtifact@1 - displayName: 'Publish Pipeline Artifact' + displayName: 'Publish Pipeline Artifacts' inputs: targetPath: $(packagePath) - artifactName: ${{ parameters.mdsArtifactName }} + artifactName: ${{ parameters.mdsArtifactsName }} diff --git a/eng/pipelines/common/templates/jobs/ci-run-tests-job.yml b/eng/pipelines/common/templates/jobs/ci-run-tests-job.yml index 24e6dcb9af..f6d625bd38 100644 --- a/eng/pipelines/common/templates/jobs/ci-run-tests-job.yml +++ b/eng/pipelines/common/templates/jobs/ci-run-tests-job.yml @@ -34,7 +34,7 @@ parameters: - name: jobDisplayName type: string - - name: mdsArtifactName + - name: mdsArtifactsName type: string - name: mdsPackageVersion @@ -114,9 +114,9 @@ jobs: # artifacts and put them in the packages/ directory in the repo root. - ${{ if eq(parameters.referenceType, 'Package') }}: - task: DownloadPipelineArtifact@2 - displayName: Download MDS Package Artifact + displayName: Download MDS Package Artifacts inputs: - artifactName: ${{ parameters.mdsArtifactName }} + artifactName: ${{ parameters.mdsArtifactsName }} targetPath: $(Build.SourcesDirectory)/packages # Install the .NET SDK and Runtimes. diff --git a/eng/pipelines/common/templates/jobs/run-tests-package-reference-job.yml b/eng/pipelines/common/templates/jobs/run-tests-package-reference-job.yml index 3817fcb483..e52bba27a2 100644 --- a/eng/pipelines/common/templates/jobs/run-tests-package-reference-job.yml +++ b/eng/pipelines/common/templates/jobs/run-tests-package-reference-job.yml @@ -9,10 +9,6 @@ parameters: default: script: echo - - name: packageFolderName - type: string - default: drop_build_build_signed_package - - name: dependsOn type: string default: empty @@ -48,9 +44,8 @@ jobs: - ${{parameters.downloadPackageStep }} - - template: /eng/pipelines/common/templates/steps/update-nuget-config-local-feed-step.yml - parameters: - packagePath: $(Pipeline.Workspace)\${{parameters.packageFolderName }} + - pwsh: Copy-Item -Path "$(Build.SourcesDirectory)/NuGet.config.local" -Destination "$(Build.SourcesDirectory)/NuGet.config" -Force + displayName: Use local NuGet packages - template: /eng/pipelines/common/templates/steps/update-config-file-step.yml parameters: diff --git a/eng/pipelines/common/templates/stages/ci-run-tests-stage.yml b/eng/pipelines/common/templates/stages/ci-run-tests-stage.yml index ca09328738..54c7b2c61f 100644 --- a/eng/pipelines/common/templates/stages/ci-run-tests-stage.yml +++ b/eng/pipelines/common/templates/stages/ci-run-tests-stage.yml @@ -18,9 +18,9 @@ parameters: type: object default: [] - - name: mdsArtifactName + - name: mdsArtifactsName type: string - default: MDS.Artifact + default: MDS.Artifacts - name: mdsPackageVersion type: string @@ -67,7 +67,7 @@ stages: image: ${{ image.value }} jobDisplayName: ${{ format('{0}_{1}_{2}', replace(targetFramework, '.', '_'), platform, testSet) }} configProperties: ${{ config.value.configProperties }} - mdsArtifactName: ${{ parameters.mdsArtifactName }} + mdsArtifactsName: ${{ parameters.mdsArtifactsName }} mdsPackageVersion: ${{ parameters.mdsPackageVersion }} prebuildSteps: ${{ parameters.prebuildSteps }} targetFramework: ${{ targetFramework }} @@ -101,7 +101,7 @@ stages: jobDisplayName: ${{ format('{0}_{1}_{2}_{3}', replace(targetFramework, '.', '_'), platform, 'NativeSNI', testSet) }} configProperties: ${{ config.value.configProperties }} useManagedSNI: ${{ useManagedSNI }} - mdsArtifactName: ${{ parameters.mdsArtifactName }} + mdsArtifactsName: ${{ parameters.mdsArtifactsName }} mdsPackageVersion: ${{ parameters.mdsPackageVersion }} prebuildSteps: ${{ parameters.prebuildSteps }} targetFramework: ${{ targetFramework }} diff --git a/eng/pipelines/common/templates/steps/ci-prebuild-step.yml b/eng/pipelines/common/templates/steps/ci-prebuild-step.yml deleted file mode 100644 index e356dc1984..0000000000 --- a/eng/pipelines/common/templates/steps/ci-prebuild-step.yml +++ /dev/null @@ -1,26 +0,0 @@ -################################################################################# -# 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: debug - type: boolean - default: false - - - name: referenceType - type: string - values: - - Project - - Package - -steps: - - ${{if eq(parameters.debug, true)}}: - - powershell: | - Get-ChildItem env: | Sort-Object Name - displayName: '[Debug] List Environment Variables' - - - ${{if eq(parameters.referenceType, 'Package')}}: - - template: /eng/pipelines/common/templates/steps/update-nuget-config-local-feed-step.yml@self - parameters: - debug: ${{ parameters.debug }} diff --git a/eng/pipelines/common/templates/steps/publish-test-results-step.yml b/eng/pipelines/common/templates/steps/publish-test-results-step.yml index 06f4f98a7c..6eefa8ecbe 100644 --- a/eng/pipelines/common/templates/steps/publish-test-results-step.yml +++ b/eng/pipelines/common/templates/steps/publish-test-results-step.yml @@ -55,7 +55,7 @@ steps: displayName: '[Debug] List test result coverage files' - task: PublishPipelineArtifact@1 - displayName: 'Publish Pipeline Artifact' + displayName: 'Publish Pipeline Artifacts' inputs: targetPath: TestResults artifact: '${{parameters.targetFramework }}WinAz$(System.JobId)' diff --git a/eng/pipelines/common/templates/steps/update-nuget-config-local-feed-step.yml b/eng/pipelines/common/templates/steps/update-nuget-config-local-feed-step.yml deleted file mode 100644 index f85ff87bc0..0000000000 --- a/eng/pipelines/common/templates/steps/update-nuget-config-local-feed-step.yml +++ /dev/null @@ -1,63 +0,0 @@ -################################################################################# -# 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: debug - type: boolean - default: false - - # The path to add as a NuGet source. - - name: packagePath - type: string - -steps: -- pwsh: | - # Resolve the path to an absolute path. - # - # Resolve-Path throws an error if the path doesn't exist yet, which is an - # expected scenario here, so we must dance around it. - $PackagePath = Resolve-Path "${{ parameters.packagePath }}" -ErrorAction SilentlyContinue -ErrorVariable resolveError - if (-Not ($PackagePath)) - { - $PackagePath = $resolveError[0].TargetObject - } - - # Ensure the package path exists, for example if we are going to generate - # packages in a later step. - if (-Not (Test-Path -Path "$PackagePath")) - { - New-Item -ItemType Directory -Path "$PackagePath" -Force - Write-Host "Created package path: $PackagePath" - } - - Write-Host "Adding package path: $PackagePath" - - # Get a list of package sources available - Get-PackageSource - - # Current location - Get-Location - - # Register the local nuget folder to be used by nuget.config - Register-PackageSource -Name "Pipeline Source" -Location "$PackagePath" -Force -ProviderName NuGet -Trusted - - # Get a list of package sources available after the change - Get-PackageSource - - # Set the NuGet.config file in the project to use extracted package - $rootFolder = Get-location - [Xml] $nugetConfig = Get-Content -Path "NuGet.config" - $newAdd = $nugetConfig.CreateElement("add") - $newAdd.SetAttribute("key","pipeline_source") - $newAdd.SetAttribute("value", "$PackagePath" ) - $nugetConfig.configuration.packageSources.AppendChild($newAdd) - $nugetConfig.Save("$rootFolder/NuGet.config") - displayName: 'Add source to NuGet.config' - -- ${{ if parameters.debug }}: - - pwsh: | - # Display the content of the NuGet.config file - Get-Content -Path "NuGet.config" - displayName: '[Debug] Emit NuGet.config' diff --git a/eng/pipelines/dotnet-sqlclient-ci-core.yml b/eng/pipelines/dotnet-sqlclient-ci-core.yml index 5bfcf9214b..436f2e64c8 100644 --- a/eng/pipelines/dotnet-sqlclient-ci-core.yml +++ b/eng/pipelines/dotnet-sqlclient-ci-core.yml @@ -4,8 +4,7 @@ # See the LICENSE file in the project root for more information. # ################################################################################# parameters: -- name: 'debug' - displayName: 'Enable debug output' +- name: debug type: boolean default: false @@ -14,7 +13,6 @@ parameters: # These are _not_ the target frameworks to build the driver packages for. # - name: targetFrameworks - displayName: 'Target Frameworks on Windows' type: object default: [net462, net8.0, net9.0, net10.0] @@ -23,48 +21,46 @@ parameters: # These are _not_ the target frameworks to build the driver packages for. # - name: targetFrameworksUnix - displayName: 'Target Frameworks on Unix' type: object default: [net8.0, net9.0, net10.0] +# Netcore Version for Test Utilities - name: netcoreVersionTestUtils - displayName: 'Netcore Version for Test Utilities' type: object default: net10.0 +# Build Platforms on Windows - name: buildPlatforms - displayName: 'Build Platforms on Windows' type: object default: [AnyCPU] +# Test sets to run - name: testSets - displayName: 'Test Sets' type: object default: [1, 2, 3] +# Use Managed/Native SNI on Windows; valid values are: +# [true, false] +# [false, true] +# [false] +# [true] - name: useManagedSNI - displayName: | - Use Managed/Native SNI on Windows, - values [false, true], [false] or [true] are allowed type: object default: [false, true] +# SNI Version Override - name: SNIVersion - displayName: | - SNI Version Override type: string default: '' +# SNI Version Override Nuget Feed - name: SNIValidationFeed - displayName: | - SNI Version Override Nuget Feed type: string default: https://sqlclientdrivers.pkgs.visualstudio.com/ADO.Net/_packaging/SNIValidation/nuget/v3/index.json # Frameworks to expect code coverage information for, and to compile into # reports. - name: codeCovTargetFrameworks - displayName: 'Code Coverage Target Frameworks' type: object default: [net462, net8.0, net9.0, net10.0] @@ -73,7 +69,6 @@ parameters: # Package - use references to NuGet packages in the # packages/ directory. - name: referenceType - displayName: 'Reference Type' values: - Project - Package @@ -88,8 +83,8 @@ parameters: type: string default: $(ci_var_defaultPoolName) +# True to add a Stress Test stage to the pipeline. - name: enableStressTests - displayName: Enable Stress Tests type: boolean default: false @@ -104,7 +99,6 @@ parameters: default: true - name: dotnetVerbosity - displayName: dotnet CLI Verbosity type: string default: normal values: @@ -117,8 +111,8 @@ parameters: variables: - template: /eng/pipelines/libraries/ci-build-variables.yml@self - - name: mdsArtifactName - value: MDS.Artifact + - name: mdsArtifactsName + value: MDS.Artifacts stages: @@ -132,7 +126,7 @@ stages: buildConfiguration: ${{ parameters.buildConfiguration }} referenceType: ${{ parameters.referenceType }} mdsPackageVersion: $(mdsPackageVersion) - mdsArtifactName: $(mdsArtifactName) + mdsArtifactsName: $(mdsArtifactsName) ${{if ne(parameters.SNIVersion, '')}}: prebuildSteps: - template: /eng/pipelines/common/templates/steps/override-sni-version.yml@self @@ -157,7 +151,7 @@ stages: debug: ${{ parameters.debug }} buildConfiguration: ${{ parameters.buildConfiguration }} referenceType: ${{ parameters.referenceType }} - mdsArtifactName: $(mdsArtifactName) + mdsArtifactsName: $(mdsArtifactsName) mdsPackageVersion: $(mdsPackageVersion) testJobTimeout: ${{ parameters.testJobTimeout }} @@ -166,17 +160,21 @@ stages: dependsOn: - build_mds_akv_packages_stage - prebuildSteps: # steps to run prior to building and running tests on each job + # Steps to run prior to building and running tests on each job. + prebuildSteps: - ${{if ne(parameters.SNIVersion, '')}}: - template: /eng/pipelines/common/templates/steps/override-sni-version.yml@self parameters: SNIVersion: ${{parameters.SNIVersion}} SNIValidationFeed: ${{parameters.SNIValidationFeed}} - - template: /eng/pipelines/common/templates/steps/ci-prebuild-step.yml@self - parameters: - debug: ${{ parameters.debug }} - referenceType: ${{ parameters.referenceType }} + - ${{if eq(parameters.debug, true)}}: + - pwsh: 'Get-ChildItem env: | Sort-Object Name' + displayName: '[Debug] List Environment Variables' + + - ${{if eq(parameters.referenceType, 'Package')}}: + - pwsh: Copy-Item -Path "$(Build.SourcesDirectory)/NuGet.config.local" -Destination "$(Build.SourcesDirectory)/NuGet.config" -Force + displayName: Use local NuGet packages # Include the code coverage job if the build type is Project. ${{ if eq(parameters.referenceType, 'Project') }}: diff --git a/eng/pipelines/dotnet-sqlclient-signing-pipeline.yml b/eng/pipelines/dotnet-sqlclient-signing-pipeline.yml index 66b46aadd2..6fe5aa099c 100644 --- a/eng/pipelines/dotnet-sqlclient-signing-pipeline.yml +++ b/eng/pipelines/dotnet-sqlclient-signing-pipeline.yml @@ -9,7 +9,7 @@ trigger: branches: include: - # This pipeline is intended to only run against the ADO dotnet-sqlclient + # This pipeline is intended to only run against the ADO.Net dotnet-sqlclient # repo. - internal/main paths: @@ -75,7 +75,7 @@ parameters: # parameters are shown up in ADO UI in a build queue time variables: - template: /eng/pipelines/libraries/variables.yml@self - name: packageFolderName - value: drop_buildMDS_build_signed_package + value: packages - name: PublishSymbols value: ${{ parameters['publishSymbols'] }} - name: CurrentNetFxVersion @@ -170,7 +170,6 @@ extends: # Disabling as of 10/15/2025 due to OneBranch apparently disallowing MSBuild tasks in validation stages. # - template: /eng/pipelines/common/templates/jobs/run-tests-package-reference-job.yml@self # parameters: -# packageFolderName: $(packageFolderName) # isPreview: ${{ parameters['isPreview'] }} # timeout: ${{ parameters.testJobTimeout }} # downloadPackageStep: diff --git a/eng/pipelines/stages/stress-tests-ci-stage.yml b/eng/pipelines/stages/stress-tests-ci-stage.yml index c356cf4d3b..ef9af236a5 100644 --- a/eng/pipelines/stages/stress-tests-ci-stage.yml +++ b/eng/pipelines/stages/stress-tests-ci-stage.yml @@ -60,13 +60,13 @@ parameters: - name: netFrameworkTestRuntimes displayName: .NET Framework Test Runtimes type: object - default: [net462, net47, net471, net472, net48, net481] + default: [net462] # The list of .NET runtimes to test against. - name: netTestRuntimes displayName: .NET Test Runtimes type: object - default: [net8.0, net9.0] + default: [net8.0, net9.0, net10.0] # The name of the pipeline artifact to download that contains the MDS package # to stress test. diff --git a/tools/props/Versions.props b/tools/props/Versions.props index 24046667b0..ee789db4c3 100644 --- a/tools/props/Versions.props +++ b/tools/props/Versions.props @@ -13,7 +13,7 @@ 1.0.0.0 1.0.0.0 - 1.0.0-dev + 1.0.0.$(BuildNumber)-dev $(SqlServerPackageVersion) From ae5d635951e6bd6dbb19a57d6188309529a86f82 Mon Sep 17 00:00:00 2001 From: Paul Medynski <31868385+paulmedynski@users.noreply.github.com> Date: Mon, 19 Jan 2026 15:31:03 -0400 Subject: [PATCH 09/15] Task 41424: Merge feat/azure-split to main: Step 1 - Common changes - Fixed Windows .NET compilation issue. --- .../Data/SqlClient/ConnectionPool/DbConnectionPoolIdentity.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/ConnectionPool/DbConnectionPoolIdentity.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/ConnectionPool/DbConnectionPoolIdentity.cs index 898ca5a248..8eab33645e 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/ConnectionPool/DbConnectionPoolIdentity.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/ConnectionPool/DbConnectionPoolIdentity.cs @@ -6,8 +6,8 @@ #if NETFRAMEWORK using System.Runtime.Versioning; -using System.Security.Principal; #endif +using System.Security.Principal; namespace Microsoft.Data.SqlClient.ConnectionPool { From e4a230a3958ac29dde84fc3a972adbe5d0557c84 Mon Sep 17 00:00:00 2001 From: Paul Medynski <31868385+paulmedynski@users.noreply.github.com> Date: Tue, 20 Jan 2026 07:33:16 -0400 Subject: [PATCH 10/15] Task 41424: Merge feat/azure-split to main: Step 1 - Common changes - Fixed packages/ dir creation. --- .../templates/jobs/ci-build-nugets-job.yml | 2 +- eng/pipelines/dotnet-sqlclient-ci-core.yml | 2 +- eng/pipelines/jobs/stress-tests-ci-job.yml | 9 ++++--- .../stages/stress-tests-ci-stage.yml | 24 +++++++------------ 4 files changed, 14 insertions(+), 23 deletions(-) diff --git a/eng/pipelines/common/templates/jobs/ci-build-nugets-job.yml b/eng/pipelines/common/templates/jobs/ci-build-nugets-job.yml index 6f73558270..213ba07f33 100644 --- a/eng/pipelines/common/templates/jobs/ci-build-nugets-job.yml +++ b/eng/pipelines/common/templates/jobs/ci-build-nugets-job.yml @@ -72,7 +72,7 @@ jobs: # setup the top-level NuGet.config to look in packages/ for local NuGet # dependencies. - ${{ if eq(parameters.referenceType, 'Package') }}: - - pwsh: New-Item -Path "$(RepoRoot)/packages" -ItemType Directory -Force + - pwsh: New-Item -Path "$(Build.SourcesDirectory)/packages" -ItemType Directory -Force displayName: Create packages/ directory - pwsh: Copy-Item -Path "$(Build.SourcesDirectory)/NuGet.config.local" -Destination "$(Build.SourcesDirectory)/NuGet.config" -Force displayName: Use local NuGet packages diff --git a/eng/pipelines/dotnet-sqlclient-ci-core.yml b/eng/pipelines/dotnet-sqlclient-ci-core.yml index 436f2e64c8..6026847c03 100644 --- a/eng/pipelines/dotnet-sqlclient-ci-core.yml +++ b/eng/pipelines/dotnet-sqlclient-ci-core.yml @@ -141,7 +141,7 @@ stages: buildConfiguration: ${{ parameters.buildConfiguration }} dependsOn: - build_mds_akv_packages_stage - pipelineArtifactName: $(artifactName) + mdsArtifactsName: $(mdsArtifactsName) mdsPackageVersion: $(mdsPackageVersion) dotnetVerbosity: ${{ parameters.dotnetVerbosity }} diff --git a/eng/pipelines/jobs/stress-tests-ci-job.yml b/eng/pipelines/jobs/stress-tests-ci-job.yml index ccdf3378c4..868684eff4 100644 --- a/eng/pipelines/jobs/stress-tests-ci-job.yml +++ b/eng/pipelines/jobs/stress-tests-ci-job.yml @@ -47,9 +47,8 @@ parameters: type: string default: '' - # The name of the pipeline artifact to download that contains the MDS package - # to stress test. - - name: pipelineArtifactName + # The name of the MDS pipeline artifacts to download. + - name: mdsArtifactsName type: string default: '' @@ -138,9 +137,9 @@ jobs: # Download the pipeline artifact that contains the MDS package to test. - task: DownloadPipelineArtifact@2 - displayName: Download Pipeline Artifact + displayName: Download MDS Artifacts inputs: - artifactName: ${{ parameters.pipelineArtifactName }} + artifactName: ${{ parameters.mdsArtifactsName }} # The stress tests solution has a NuGet.config file that configures # sources to look in this packages/ directory. targetPath: $(Build.SourcesDirectory)/packages diff --git a/eng/pipelines/stages/stress-tests-ci-stage.yml b/eng/pipelines/stages/stress-tests-ci-stage.yml index ef9af236a5..092d34ec4c 100644 --- a/eng/pipelines/stages/stress-tests-ci-stage.yml +++ b/eng/pipelines/stages/stress-tests-ci-stage.yml @@ -23,7 +23,6 @@ parameters: # The type of build to produce (Debug or Release) - name: buildConfiguration - displayName: Build Configuration type: string default: Debug values: @@ -33,13 +32,11 @@ parameters: # The names of any stages this stage depends on, for example the stages # that publish the MDS package artifacts we will test. - name: dependsOn - displayName: Depends On Stages type: object default: [] # The verbosity level for the dotnet CLI commands. - name: dotnetVerbosity - displayName: dotnet CLI verbosity type: string default: normal values: @@ -49,32 +46,27 @@ parameters: - detailed - diagnostic + # The name of the MDS pipeline artifacts to download. + - name: mdsArtifactsName + type: string + default: MDS.Artifacts + # The MDS package version to stress test. This version must be available in # one of the configured NuGet sources. - name: mdsPackageVersion - displayName: MDS Package Version type: string default: '' # The list of .NET Framework runtimes to test against. - name: netFrameworkTestRuntimes - displayName: .NET Framework Test Runtimes type: object default: [net462] # The list of .NET runtimes to test against. - name: netTestRuntimes - displayName: .NET Test Runtimes type: object default: [net8.0, net9.0, net10.0] - # The name of the pipeline artifact to download that contains the MDS package - # to stress test. - - name: pipelineArtifactName - displayName: Pipeline Artifact Name - type: string - default: Artifacts - stages: - stage: run_stress_tests_stage displayName: Run Stress Tests @@ -140,7 +132,7 @@ stages: poolName: $(ci_var_defaultPoolName) vmImage: ADO-UB20-SQL22 sqlSetupStep: /eng/pipelines/common/templates/steps/configure-sql-server-linux-step.yml - pipelineArtifactName: ${{ parameters.pipelineArtifactName }} + mdsArtifactsName: ${{ parameters.mdsArtifactsName }} solution: $(solution) testProject: $(testProject) restoreArguments: $(commonArguments) @@ -160,7 +152,7 @@ stages: # don't have to install one explicitly. vmImage: ADO-MMS22-SQL22 sqlSetupStep: /eng/pipelines/common/templates/steps/configure-sql-server-win-step.yml - pipelineArtifactName: ${{ parameters.pipelineArtifactName }} + mdsArtifactsName: ${{ parameters.mdsArtifactsName }} solution: $(solution) testProject: $(testProject) restoreArguments: $(commonArguments) @@ -183,7 +175,7 @@ stages: poolName: Azure Pipelines vmImage: macos-latest sqlSetupStep: /eng/pipelines/common/templates/steps/configure-sql-server-macos-step.yml - pipelineArtifactName: ${{ parameters.pipelineArtifactName }} + mdsArtifactsName: ${{ parameters.mdsArtifactsName }} solution: $(solution) testProject: $(testProject) restoreArguments: $(commonArguments) From be6bba06a8aea8c2ee7ee80f33042b4647d4fc9c Mon Sep 17 00:00:00 2001 From: Paul Medynski <31868385+paulmedynski@users.noreply.github.com> Date: Tue, 20 Jan 2026 10:11:28 -0400 Subject: [PATCH 11/15] Task 41424: Merge feat/azure-split to main: Step 1 - Common changes - Fixed missing MDS package version during Package builds. --- .../common/templates/jobs/ci-build-nugets-job.yml | 4 +++- .../common/templates/jobs/ci-run-tests-job.yml | 1 + .../common/templates/steps/ci-project-build-step.yml | 10 ++++++---- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/eng/pipelines/common/templates/jobs/ci-build-nugets-job.yml b/eng/pipelines/common/templates/jobs/ci-build-nugets-job.yml index 213ba07f33..260b88d3ff 100644 --- a/eng/pipelines/common/templates/jobs/ci-build-nugets-job.yml +++ b/eng/pipelines/common/templates/jobs/ci-build-nugets-job.yml @@ -92,6 +92,7 @@ jobs: referenceType: ${{ parameters.referenceType }} operatingSystem: Windows build: all + mdsPackageVersion: ${{ parameters.mdsPackageVersion }} - template: /eng/pipelines/common/templates/steps/ci-project-build-step.yml@self parameters: @@ -100,6 +101,7 @@ jobs: referenceType: ${{ parameters.referenceType }} operatingSystem: Windows build: MDS + mdsPackageVersion: ${{ parameters.mdsPackageVersion }} - template: /eng/pipelines/common/templates/steps/generate-nuget-package-step.yml@self parameters: @@ -118,7 +120,7 @@ jobs: referenceType: ${{ parameters.referenceType }} operatingSystem: Windows build: AKV - mdsPackageVersion: ${{parameters.mdsPackageVersion}} + mdsPackageVersion: ${{ parameters.mdsPackageVersion }} - template: /eng/pipelines/common/templates/steps/generate-nuget-package-step.yml@self parameters: diff --git a/eng/pipelines/common/templates/jobs/ci-run-tests-job.yml b/eng/pipelines/common/templates/jobs/ci-run-tests-job.yml index f6d625bd38..42c59ccc52 100644 --- a/eng/pipelines/common/templates/jobs/ci-run-tests-job.yml +++ b/eng/pipelines/common/templates/jobs/ci-run-tests-job.yml @@ -156,6 +156,7 @@ jobs: build: allNoDocs buildConfiguration: ${{ parameters.buildConfiguration }} referenceType: ${{ parameters.referenceType }} + mdsPackageVersion: ${{ parameters.mdsPackageVersion }} - ${{ if ne(parameters.configProperties, '{}') }}: - template: /eng/pipelines/common/templates/steps/update-config-file-step.yml@self # update config.json file diff --git a/eng/pipelines/common/templates/steps/ci-project-build-step.yml b/eng/pipelines/common/templates/steps/ci-project-build-step.yml index 948c609129..57bd51cf8e 100644 --- a/eng/pipelines/common/templates/steps/ci-project-build-step.yml +++ b/eng/pipelines/common/templates/steps/ci-project-build-step.yml @@ -42,10 +42,8 @@ parameters: - all - allNoDocs - # Used when AKV is built with ReferenceType = Package. - name: mdsPackageVersion type: string - default: '' steps: - ${{ if or(eq(parameters.operatingSystem, 'Windows'), eq(parameters.operatingSystem, 'deferedToRuntime')) }}: @@ -59,6 +57,7 @@ steps: msbuildArguments: >- -t:restore -p:ReferenceType=${{ parameters.ReferenceType }} + -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} retryCountOnTaskFailure: 1 - ${{ if eq(parameters.build, 'allNoDocs') }}: @@ -76,6 +75,7 @@ steps: -p:GenerateDocumentationFile=false -p:GenerateNuGet=false -p:BuildNumber=${{ parameters.buildNumber }} + -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} clean: true - ${{ if or(eq(parameters.build, 'MDS'), eq(parameters.build, 'all')) }}: @@ -92,6 +92,7 @@ steps: -p:ReferenceType=${{ parameters.ReferenceType }} -p:GenerateNuGet=false -p:BuildNumber=${{ parameters.buildNumber }} + -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} clean: true - ${{ if or(eq(parameters.build, 'AKV'), eq(parameters.build, 'all'), eq(parameters.build, 'allNoDocs')) }}: @@ -107,7 +108,7 @@ steps: -t:BuildAKVNetFx -p:ReferenceType=${{ parameters.ReferenceType }} -p:BuildNumber=${{ parameters.buildNumber }} - -p:MdsPackageVersion=${{parameters.mdsPackageVersion}} + -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} - task: MSBuild@1 displayName: 'Build AKV Provider NetCore All OS [Win]' @@ -121,7 +122,7 @@ steps: -t:BuildAKVNetCoreAllOS -p:ReferenceType=${{ parameters.ReferenceType }} -p:BuildNumber=${{ parameters.buildNumber }} - -p:MdsPackageVersion=${{parameters.mdsPackageVersion}} + -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} - ${{ if or(eq(parameters.operatingSystem, 'Linux'), eq(parameters.operatingSystem, 'MacOS'), eq(parameters.operatingSystem, 'deferedToRuntime')) }}: - task: DotNetCoreCLI@2 @@ -137,6 +138,7 @@ steps: -p:TestEnabled=true -p:GenerateDocumentationFile=false -p:Configuration=${{ parameters.buildConfiguration }} + -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} verbosityRestore: Detailed verbosityPack: Detailed retryCountOnTaskFailure: 1 From 97336f6857e95df84d197201819a31f319cd9234 Mon Sep 17 00:00:00 2001 From: Paul Medynski <31868385+paulmedynski@users.noreply.github.com> Date: Tue, 20 Jan 2026 10:57:07 -0400 Subject: [PATCH 12/15] Task 41424: Merge feat/azure-split to main: Step 1 - Common changes - Generating MDS NuGet package for subsequent AKV build in Package mode. --- .../templates/steps/ci-project-build-step.yml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/eng/pipelines/common/templates/steps/ci-project-build-step.yml b/eng/pipelines/common/templates/steps/ci-project-build-step.yml index 57bd51cf8e..940267e1f6 100644 --- a/eng/pipelines/common/templates/steps/ci-project-build-step.yml +++ b/eng/pipelines/common/templates/steps/ci-project-build-step.yml @@ -56,7 +56,7 @@ steps: msbuildArchitecture: x64 msbuildArguments: >- -t:restore - -p:ReferenceType=${{ parameters.ReferenceType }} + -p:ReferenceType=${{ parameters.referenceType }} -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} retryCountOnTaskFailure: 1 @@ -71,9 +71,8 @@ steps: configuration: '${{ parameters.buildConfiguration }}' msbuildArguments: >- -t:BuildAllConfigurations - -p:ReferenceType=${{ parameters.ReferenceType }} + -p:ReferenceType=${{ parameters.referenceType }} -p:GenerateDocumentationFile=false - -p:GenerateNuGet=false -p:BuildNumber=${{ parameters.buildNumber }} -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} clean: true @@ -89,8 +88,7 @@ steps: configuration: '${{ parameters.buildConfiguration }}' msbuildArguments: -t:BuildAllConfigurations - -p:ReferenceType=${{ parameters.ReferenceType }} - -p:GenerateNuGet=false + -p:ReferenceType=${{ parameters.referenceType }} -p:BuildNumber=${{ parameters.buildNumber }} -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} clean: true @@ -106,7 +104,7 @@ steps: configuration: '${{ parameters.buildConfiguration }}' msbuildArguments: >- -t:BuildAKVNetFx - -p:ReferenceType=${{ parameters.ReferenceType }} + -p:ReferenceType=${{ parameters.referenceType }} -p:BuildNumber=${{ parameters.buildNumber }} -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} @@ -120,7 +118,7 @@ steps: configuration: '${{ parameters.buildConfiguration }}' msbuildArguments: >- -t:BuildAKVNetCoreAllOS - -p:ReferenceType=${{ parameters.ReferenceType }} + -p:ReferenceType=${{ parameters.referenceType }} -p:BuildNumber=${{ parameters.buildNumber }} -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} @@ -134,7 +132,7 @@ steps: custom: msbuild arguments: >- -t:BuildAll - -p:ReferenceType=${{ parameters.ReferenceType }} + -p:ReferenceType=${{ parameters.referenceType }} -p:TestEnabled=true -p:GenerateDocumentationFile=false -p:Configuration=${{ parameters.buildConfiguration }} From 91b54f9edd72b5ea91c887662ca99480b7442231 Mon Sep 17 00:00:00 2001 From: Paul Medynski <31868385+paulmedynski@users.noreply.github.com> Date: Tue, 20 Jan 2026 11:22:24 -0400 Subject: [PATCH 13/15] Task 41424: Merge feat/azure-split to main: Step 1 - Common changes - Running Release build for Debug pipelines in Project mode to avoid NuGet packaging issues. --- eng/pipelines/common/templates/jobs/ci-build-nugets-job.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/eng/pipelines/common/templates/jobs/ci-build-nugets-job.yml b/eng/pipelines/common/templates/jobs/ci-build-nugets-job.yml index 260b88d3ff..689b99a09b 100644 --- a/eng/pipelines/common/templates/jobs/ci-build-nugets-job.yml +++ b/eng/pipelines/common/templates/jobs/ci-build-nugets-job.yml @@ -89,10 +89,8 @@ jobs: parameters: platform: ${{ parameters.platform }} buildConfiguration: Release - referenceType: ${{ parameters.referenceType }} - operatingSystem: Windows + referenceType: Project build: all - mdsPackageVersion: ${{ parameters.mdsPackageVersion }} - template: /eng/pipelines/common/templates/steps/ci-project-build-step.yml@self parameters: From d355c24c10d95119763c833c5ed07f707afb382b Mon Sep 17 00:00:00 2001 From: Paul Medynski <31868385+paulmedynski@users.noreply.github.com> Date: Tue, 20 Jan 2026 11:45:27 -0400 Subject: [PATCH 14/15] Task 41424: Merge feat/azure-split to main: Step 1 - Common changes - Restoring default mdsPackageVersion for Project based runs. --- eng/pipelines/common/templates/steps/ci-project-build-step.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/eng/pipelines/common/templates/steps/ci-project-build-step.yml b/eng/pipelines/common/templates/steps/ci-project-build-step.yml index 940267e1f6..b8a0e254e8 100644 --- a/eng/pipelines/common/templates/steps/ci-project-build-step.yml +++ b/eng/pipelines/common/templates/steps/ci-project-build-step.yml @@ -42,8 +42,10 @@ parameters: - all - allNoDocs + # Necessary when referenceType is Package. - name: mdsPackageVersion type: string + default: '' steps: - ${{ if or(eq(parameters.operatingSystem, 'Windows'), eq(parameters.operatingSystem, 'deferedToRuntime')) }}: From b5fafcb32f913cfd562668d4dd9939cdd95d6812 Mon Sep 17 00:00:00 2001 From: Paul Medynski <31868385+paulmedynski@users.noreply.github.com> Date: Tue, 20 Jan 2026 12:40:46 -0400 Subject: [PATCH 15/15] Task 41424: Merge feat/azure-split to main: Step 1 - Common changes - Restoring inhibition of NuGet package generation. --- .../common/templates/steps/ci-project-build-step.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/eng/pipelines/common/templates/steps/ci-project-build-step.yml b/eng/pipelines/common/templates/steps/ci-project-build-step.yml index b8a0e254e8..fe417f2e11 100644 --- a/eng/pipelines/common/templates/steps/ci-project-build-step.yml +++ b/eng/pipelines/common/templates/steps/ci-project-build-step.yml @@ -74,6 +74,7 @@ steps: msbuildArguments: >- -t:BuildAllConfigurations -p:ReferenceType=${{ parameters.referenceType }} + -p:GenerateNuget=false -p:GenerateDocumentationFile=false -p:BuildNumber=${{ parameters.buildNumber }} -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} @@ -91,6 +92,7 @@ steps: msbuildArguments: -t:BuildAllConfigurations -p:ReferenceType=${{ parameters.referenceType }} + -p:GenerateNuget=false -p:BuildNumber=${{ parameters.buildNumber }} -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} clean: true @@ -107,6 +109,7 @@ steps: msbuildArguments: >- -t:BuildAKVNetFx -p:ReferenceType=${{ parameters.referenceType }} + -p:GenerateNuget=false -p:BuildNumber=${{ parameters.buildNumber }} -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} @@ -121,6 +124,7 @@ steps: msbuildArguments: >- -t:BuildAKVNetCoreAllOS -p:ReferenceType=${{ parameters.referenceType }} + -p:GenerateNuget=false -p:BuildNumber=${{ parameters.buildNumber }} -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} @@ -136,6 +140,7 @@ steps: -t:BuildAll -p:ReferenceType=${{ parameters.referenceType }} -p:TestEnabled=true + -p:GenerateNuget=false -p:GenerateDocumentationFile=false -p:Configuration=${{ parameters.buildConfiguration }} -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }}