Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 37 additions & 8 deletions build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,12 @@

<DotnetCommand>
"$(DotnetPath)dotnet" test "$(SqlClientFunctionalTestProjectPath)"

<!-- Build arguments -->
-p:Configuration=$(Configuration)
$(SigningKeyPathArgument)

<!-- Test arguments -->
$(TestBlameArgument)
$(TestCodeCoverageArgument)
$(TestFiltersArgument)
Expand Down Expand Up @@ -763,7 +768,12 @@

<DotnetCommand>
"$(DotnetPath)dotnet" test "$(SqlClientManualTestProjectPath)"

<!-- Build arguments -->
-p:Configuration=$(Configuration)
$(SigningKeyPathArgument)

<!-- Test arguments -->
$(TestBlameArgument)
$(TestCodeCoverageArgument)
$(ManualTestFiltersArgument)
Expand Down Expand Up @@ -792,17 +802,24 @@

<DotnetCommand>
"$(DotnetPath)dotnet" test "$(SqlClientUnitTestProjectPath)"

<!-- Build arguments -->
-p:Configuration=$(Configuration)
$(SigningKeyPathArgument)
$(TestSigningKeyPathArgument)

<!-- Test arguments -->
$(TestBlameArgument)
$(TestCodeCoverageArgument)
$(TestFiltersArgument)
$(TestFrameworkArgument)
--results-directory "$(TestResultsFolderPath)"
--logger:"trx;LogFilePrefix=$(LogFilePrefix)"

<!-- Reference Type Arguments -->
$(ReferenceTypeArgument)
$(TestSigningKeyPathArgument)
$(PackageVersionSqlClientArgument)
$(PackageVersionSqlServerArgument)
--results-directory "$(TestResultsFolderPath)"
--logger:"trx;LogFilePrefix=$(LogFilePrefix)"
</DotnetCommand>

<!-- Convert more than one whitespace character into one space -->
Expand Down Expand Up @@ -999,22 +1016,28 @@
<!-- TestAbstractions: Runs Microsoft.Data.SqlClient.Extensions.Abstractions.Tests -->
<Target Name="TestAbstractions">
<PropertyGroup>
<!--
Note: This test exclusively uses project references, so neither ReferenceType nor any
package version arguments are specified in this command.
-->
<LogFilePrefix>AbstractionsTests-$(OS)</LogFilePrefix>
<LogFilePrefix Condition="'$(TestFramework)' != ''">$(LogFilePrefix)-$(TestFramework)</LogFilePrefix>

<DotnetCommand>
"$(DotnetPath)dotnet" test "$(AbstractionsTestProjectPath)"

<!-- Build arguments -->
-p:Configuration=$(Configuration)
$(SigningKeyPathArgument)
$(TestSigningKeyPathArgument)

<!-- Test arguments -->
$(TestBlameArgument)
$(TestCodeCoverageArgument)
$(TestFiltersArgument)
$(TestFrameworkArgument)
--results-directory "$(TestResultsFolderPath)"
--logger:"trx;LogFilePrefix=$(LogFilePrefix)"

<!-- Reference Type Arguments -->
$(ReferenceTypeArgument)
$(PackageVersionSqlClientArgument)
</DotnetCommand>
<!-- Convert more than one whitespace character into one space -->
<DotnetCommand>$([System.Text.RegularExpressions.Regex]::Replace($(DotnetCommand), "\s+", " "))</DotnetCommand>
Expand Down Expand Up @@ -1109,15 +1132,21 @@

<DotnetCommand>
"$(DotnetPath)dotnet" test "$(AzureTestProjectPath)"

<!-- Build arguments -->
-p:Configuration=$(Configuration)
$(SigningKeyPathArgument)
$(TestSigningKeyPathArgument)

<!-- Test arguments -->
$(TestBlameArgument)
$(TestCodeCoverageArgument)
$(TestFiltersArgument)
$(TestFrameworkArgument)
--results-directory "$(TestResultsFolderPath)"
--logger:"trx;LogFilePrefix=$(LogFilePrefix)"

<!-- Reference type arguments -->
<!-- Reference Type Arguments -->
$(ReferenceTypeArgument)
$(PackageVersionSqlClientArgument)
$(PackageVersionSqlServerArgument)
Expand Down
10 changes: 3 additions & 7 deletions eng/pipelines/ci/package/sqlclient-ci-package-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ variables:
value: ${{ eq(variables['System.TeamProject'], 'ADO.Net') }}

# Signing key argument passed to build.proj. On internal builds this references the secure file
# downloaded by DownloadSecureFile@1; on public builds it expands to empty.
# downloaded by download-driver-signing-key-step.yml; on public builds it expands to empty.
- name: signingKeyArg
${{ if eq(variables.isInternalBuild, true) }}:
value: -p:SigningKeyPath="$(driverKeyFile.secureFilePath)"
Expand Down Expand Up @@ -125,13 +125,9 @@ jobs:
Write-Host 'Done.'
displayName: Clean Packages Directory

# On internal builds, download the strong-name signing key.
# On internal builds, download the driver strong-name signing key.
- ${{ if eq(variables.isInternalBuild, true) }}:
- task: DownloadSecureFile@1
displayName: Download Driver Signing Key
inputs:
secureFile: netfxKeypair.snk
name: driverKeyFile
- template: /eng/pipelines/common/steps/download-driver-signing-key-step.yml@self

# Run the Pack target via build.proj.
- task: DotNetCoreCLI@2
Expand Down
22 changes: 22 additions & 0 deletions eng/pipelines/common/steps/download-driver-signing-key-step.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
####################################################################################################
# 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.
####################################################################################################

# This template downloads the driver strong-name signing key from ADO secure files. This key is
# used to sign the shipping driver assemblies.
#
# The secure file is only available to the internal ADO.Net project, so this template must only be
# used by internal builds.
#
# Downstream steps reference the key's path via:
#
# $(driverKeyFile.secureFilePath)

steps:

- task: DownloadSecureFile@1
displayName: Download Driver Signing Key
inputs:
secureFile: netfxKeypair.snk
name: driverKeyFile
22 changes: 22 additions & 0 deletions eng/pipelines/common/steps/download-test-signing-key-step.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
####################################################################################################
# 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.
####################################################################################################

# This template downloads the test strong-name signing key from ADO secure files. This key is used
# to sign the test assemblies so that they satisfy the driver's InternalsVisibleTo declarations.
#
# The secure file is only available to the internal ADO.Net project, so this template must only be
# used by internal builds.
#
# Downstream steps reference the key's path via:
#
# $(testKeyFile.secureFilePath)

steps:

- task: DownloadSecureFile@1
displayName: Download Test Signing Key
inputs:
secureFile: sqlclient-test-key.snk
name: testKeyFile
12 changes: 12 additions & 0 deletions eng/pipelines/common/templates/jobs/ci-build-nugets-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ parameters:
type: string
default: SqlServer.Artifacts

# True when building on the internal ADO.Net project.
- name: isInternalBuild
type: boolean

jobs:
- job: build_mds_akv_packages_job
displayName: Build MDS & AKV Packages
Expand Down Expand Up @@ -126,6 +130,10 @@ jobs:
# Restore dotnet CLI tools (e.g. pwsh, apicompat) before building.
- template: /eng/pipelines/common/steps/restore-dotnet-tools.yml@self

# Download the driver strong-name signing key for internal Package-mode builds.
- ${{ if and(eq(parameters.isInternalBuild, true), eq(parameters.referenceType, 'Package')) }}:
- template: /eng/pipelines/common/steps/download-driver-signing-key-step.yml@self

# When we're performing a Debug build, we still want to try _compiling_ the
# code in Release mode to ensure downstream pipelines don't encounter
# compilation errors. We won't use the Release artifacts for anything else
Expand All @@ -147,6 +155,8 @@ jobs:
build: MDS
packageVersion: ${{ parameters.packageVersion }}
sqlServerPackageVersion: ${{ parameters.sqlServerPackageVersion }}
${{ if and(eq(parameters.isInternalBuild, true), eq(parameters.referenceType, 'Package')) }}:
signingKeyPath: $(driverKeyFile.secureFilePath)

- task: DotNetCoreCLI@2
displayName: 'Create MDS NuGet Package'
Expand Down Expand Up @@ -189,6 +199,8 @@ jobs:
build: AkvProvider
packageVersion: ${{ parameters.packageVersion }}
sqlServerPackageVersion: ${{ parameters.sqlServerPackageVersion }}
${{ if and(eq(parameters.isInternalBuild, true), eq(parameters.referenceType, 'Package')) }}:
signingKeyPath: $(driverKeyFile.secureFilePath)

- task: DotNetCoreCLI@2
displayName: 'Create AKV Provider NuGet Package'
Expand Down
15 changes: 15 additions & 0 deletions eng/pipelines/common/templates/jobs/ci-run-tests-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,10 @@ parameters:
- name: saPassword
type: string

# True when building on the internal ADO.Net project.
- name: isInternalBuild
type: boolean

jobs:
- job: ${{ format('{0}', coalesce(parameters.jobDisplayName, parameters.image, 'unknown_image')) }}

Expand Down Expand Up @@ -205,6 +209,11 @@ jobs:
# Restore dotnet CLI tools (e.g. pwsh, apicompat) before building.
- template: /eng/pipelines/common/steps/restore-dotnet-tools.yml@self

# Download the driver and test strong-name signing keys for internal Package-mode builds.
- ${{ if and(eq(parameters.isInternalBuild, true), eq(parameters.referenceType, 'Package')) }}:
- template: /eng/pipelines/common/steps/download-driver-signing-key-step.yml@self
- template: /eng/pipelines/common/steps/download-test-signing-key-step.yml@self

- ${{ if ne(parameters.prebuildSteps, '') }}:
- ${{ parameters.prebuildSteps }} # extra steps to run before the build like downloading sni and the required configuration

Expand Down Expand Up @@ -358,6 +367,9 @@ jobs:
operatingSystem: ${{ parameters.operatingSystem }}
packageVersion: ${{ parameters.packageVersion }}
sqlServerPackageVersion: ${{ parameters.sqlServerPackageVersion }}
${{ if and(eq(parameters.isInternalBuild, true), eq(parameters.referenceType, 'Package')) }}:
signingKeyPath: $(driverKeyFile.secureFilePath)
testSigningKeyPath: $(testKeyFile.secureFilePath)

- ${{ if and(eq(parameters.enableX86Test, true), eq(parameters.operatingSystem, 'Windows')) }}:
- template: /eng/pipelines/common/templates/steps/run-all-tests-step.yml@self
Expand All @@ -372,6 +384,9 @@ jobs:
operatingSystem: ${{ parameters.operatingSystem }}
packageVersion: ${{ parameters.packageVersion }}
sqlServerPackageVersion: ${{ parameters.sqlServerPackageVersion }}
${{ if and(eq(parameters.isInternalBuild, true), eq(parameters.referenceType, 'Package')) }}:
signingKeyPath: $(driverKeyFile.secureFilePath)
testSigningKeyPath: $(testKeyFile.secureFilePath)

- template: /eng/pipelines/common/templates/steps/publish-test-results-step.yml@self
parameters:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ parameters:
- name: testJobTimeout
type: number

# True when building on the internal ADO.Net project.
- name: isInternalBuild
type: boolean

stages:
- ${{ each config in parameters.testConfigurations }}:
- ${{ each image in config.value.images }}:
Expand Down Expand Up @@ -114,6 +118,7 @@ stages:
packageVersion: $(packageVersion)
loggingArtifactsName: ${{ parameters.loggingArtifactsName }}
mdsArtifactsName: ${{ parameters.mdsArtifactsName }}
isInternalBuild: ${{ parameters.isInternalBuild }}
sqlServerArtifactsName: ${{ parameters.sqlServerArtifactsName }}
sqlServerPackageVersion: $(sqlServerPackageVersion)
prebuildSteps: ${{ parameters.prebuildSteps }}
Expand Down Expand Up @@ -149,6 +154,7 @@ stages:
packageVersion: $(packageVersion)
loggingArtifactsName: ${{ parameters.loggingArtifactsName }}
mdsArtifactsName: ${{ parameters.mdsArtifactsName }}
isInternalBuild: ${{ parameters.isInternalBuild }}
sqlServerArtifactsName: ${{ parameters.sqlServerArtifactsName }}
sqlServerPackageVersion: $(sqlServerPackageVersion)
prebuildSteps: ${{ parameters.prebuildSteps }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ parameters:
type: string
default: $(sqlServerPackageVersion)

# Path to the driver strong-name signing key file. When non-empty, passed as SigningKeyPath to
# the build. The calling job is responsible for downloading the key.
- name: signingKeyPath
type: string
default: ''

steps:
# Build MDS
- ${{ if or(eq(parameters.build, 'MDS'), eq(parameters.build, 'all'), eq(parameters.build, 'allNoDocs')) }}:
Expand All @@ -74,6 +80,7 @@ steps:
-p:BuildNumber=${{ parameters.buildNumber }}
-p:PackageVersionSqlClient=${{ parameters.packageVersion }}
-p:PackageVersionSqlServer=${{ parameters.sqlServerPackageVersion }}
-p:SigningKeyPath="${{ parameters.signingKeyPath }}"

# Build AKV Provider
- ${{ if or(eq(parameters.build, 'AkvProvider'), eq(parameters.build, 'all'), eq(parameters.build, 'allNoDocs')) }}:
Expand All @@ -90,3 +97,4 @@ steps:
-p:BuildNumber=${{ parameters.buildNumber }}
-p:PackageVersionSqlClient=${{ parameters.packageVersion }}
-p:PackageVersionSqlServer=${{ parameters.sqlServerPackageVersion }}
-p:SigningKeyPath="${{ parameters.signingKeyPath }}"
Loading