-
Notifications
You must be signed in to change notification settings - Fork 334
Add assembly signing for Microsoft.SqlServer.Server #4566
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| ################################################################################ | ||
| # 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. | ||
| ################################################################################ | ||
|
|
||
| # Downloads a signing key from ADO secure files. | ||
| # | ||
| # When isTest is false, downloads the driver signing key and exports it as 'driverKeyFile'. When | ||
| # isTest is true, downloads the test signing key and exports it as 'testKeyFile'. | ||
| # | ||
| # Downstream steps reference the path via: | ||
| # | ||
| # $(driverKeyFile.secureFilePath) or | ||
| # $(testKeyFile.secureFilePath) | ||
|
|
||
| parameters: | ||
|
|
||
| # When false, download the driver signing key. | ||
| # When true, download the test signing key. | ||
| - name: isTest | ||
| type: boolean | ||
| default: false | ||
|
|
||
| steps: | ||
|
|
||
| - ${{ if eq(parameters.isTest, false) }}: | ||
| - task: DownloadSecureFile@1 | ||
| displayName: Download Driver Signing Key | ||
| inputs: | ||
| secureFile: netfxKeypair.snk | ||
| name: driverKeyFile | ||
|
|
||
| - ${{ else }}: | ||
| - task: DownloadSecureFile@1 | ||
| displayName: Download Test Signing Key | ||
| inputs: | ||
| secureFile: sqlclient-test-key.snk | ||
| name: testKeyFile |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -49,6 +49,21 @@ parameters: | |
| - detailed | ||
| - diagnostic | ||
|
|
||
| # The C# project reference type to use when building and packing the packages. | ||
| - name: referenceType | ||
| type: string | ||
| default: Project | ||
| values: | ||
| # Reference sibling packages as NuGet packages. | ||
| - Package | ||
| # Reference sibling packages as C# projects. | ||
| - Project | ||
|
|
||
| # True when building on the internal ADO.Net project. | ||
| - name: isInternalBuild | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You will see this concept throughout the PR stack, used to determine when assembly signing is required. The PR pipelines (legacy and modern) always use Project mode, and never sign any assemblies. They will not have this concept. The modern CI pipeline always uses Package mode, and when running on ADO.Net, it will sign all assemblies (driver and test). The legacy CI pipelines use both Project and Package mode. In Project mode, no signing occurs, so internal vs public doesn't matter. In Package mode and internal, we will be signing everything to satisfy InternalsVisibleTo safely. |
||
| type: boolean | ||
| default: false | ||
|
|
||
| jobs: | ||
|
|
||
| - job: pack_sqlserver_package_job | ||
|
|
@@ -94,19 +109,38 @@ jobs: | |
| parameters: | ||
| debug: ${{ parameters.debug }} | ||
|
|
||
| # Download the assembly signing key for internal Package-mode builds. | ||
| - ${{ if and(eq(parameters.isInternalBuild, true), ne(parameters.referenceType, 'Project')) }}: | ||
| - template: /eng/pipelines/common/steps/download-assembly-signing-key.yml@self | ||
|
|
||
|
paulmedynski marked this conversation as resolved.
|
||
| # Create the NuGet packages. | ||
| - task: DotNetCoreCLI@2 | ||
| displayName: Create NuGet Package | ||
| inputs: | ||
| command: pack | ||
| packagesToPack: $(project) | ||
| configurationToPack: ${{ parameters.buildConfiguration }} | ||
| packDirectory: $(dotnetPackagesDir) | ||
| verbosityToPack: ${{ parameters.dotnetVerbosity }} | ||
| # BuildNumber supplies the revision component of FileVersion | ||
| # (Major.Minor.Patch.Revision). Without it, FileVersionBuildNumber | ||
| # defaults to 0 and the assembly is stamped Major.Minor.Patch.0. | ||
| buildProperties: SqlServerPackageVersion=${{ parameters.sqlServerPackageVersion }};BuildNumber=$(Build.BuildNumber) | ||
| - ${{ if and(eq(parameters.isInternalBuild, true), ne(parameters.referenceType, 'Project')) }}: | ||
| - task: DotNetCoreCLI@2 | ||
| displayName: Create NuGet Package | ||
| inputs: | ||
| command: pack | ||
| packagesToPack: $(project) | ||
| configurationToPack: ${{ parameters.buildConfiguration }} | ||
| packDirectory: $(dotnetPackagesDir) | ||
| verbosityToPack: ${{ parameters.dotnetVerbosity }} | ||
| # BuildNumber supplies the revision component of FileVersion | ||
| # (Major.Minor.Patch.Revision). Without it, FileVersionBuildNumber | ||
| # defaults to 0 and the assembly is stamped Major.Minor.Patch.0. | ||
| buildProperties: SqlServerPackageVersion=${{ parameters.sqlServerPackageVersion }};BuildNumber=$(Build.BuildNumber);SigningKeyPath="$(driverKeyFile.secureFilePath)" | ||
|
|
||
| - ${{ else }}: | ||
| - task: DotNetCoreCLI@2 | ||
| displayName: Create NuGet Package | ||
| inputs: | ||
| command: pack | ||
| packagesToPack: $(project) | ||
| configurationToPack: ${{ parameters.buildConfiguration }} | ||
| packDirectory: $(dotnetPackagesDir) | ||
| verbosityToPack: ${{ parameters.dotnetVerbosity }} | ||
| # BuildNumber supplies the revision component of FileVersion | ||
| # (Major.Minor.Patch.Revision). Without it, FileVersionBuildNumber | ||
| # defaults to 0 and the assembly is stamped Major.Minor.Patch.0. | ||
| buildProperties: SqlServerPackageVersion=${{ parameters.sqlServerPackageVersion }};BuildNumber=$(Build.BuildNumber) | ||
|
|
||
| - task: PublishPipelineArtifact@1 | ||
| displayName: Publish Pipeline Artifact | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR adds a shared helper template to download signing keys, so you will see changes to several pipeline like this.