Install MicroBuild code signing plugin and set SignType = real (#1376)

This commit is contained in:
Nate McMaster 2018-09-05 12:50:34 -07:00 committed by GitHub
parent b04bed2bcb
commit e23e8fff95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 39 additions and 30 deletions

View File

@ -18,11 +18,26 @@ phases:
variables: variables:
CI: true CI: true
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
# This variable is required by MicroBuildSigningPlugin to determine permissions for codesigning.
TeamName: AspNetCore
# SignType = { test, real }
# This is prefixed underscore because variables automatically become environment variables (and therefore MSBuild properties),
# and this one was causing issues in MSBuild projects which use the $(SignType) MSbuild prop.
_SignType: real
steps: steps:
- task: NodeTool@0 - task: NodeTool@0
displayName: Install Node 10.x displayName: Install Node 10.x
inputs: inputs:
versionSpec: 10.x versionSpec: 10.x
- task: MicroBuildSigningPlugin@1
displayName: Install MicroBuild plugin
condition: and(succeeded(), in(variables['_SignType'], 'test', 'real'))
inputs:
signType: $(_SignType)
zipSources: false
# TODO: configure build.cmd to build both x64 and x86 in one invocation # TODO: configure build.cmd to build both x64 and x86 in one invocation
# TODO build.cmd -ci # TODO build.cmd -ci
- script: build.cmd /p:SkipTests=true /p:Configuration=$(BuildConfiguration) /p:BuildNumber=$(Build.BuildNumber) /t:Build /t:BuildSharedFx /p:SharedFxRID=win-x64 /t:BuildFallbackArchive - script: build.cmd /p:SkipTests=true /p:Configuration=$(BuildConfiguration) /p:BuildNumber=$(Build.BuildNumber) /t:Build /t:BuildSharedFx /p:SharedFxRID=win-x64 /t:BuildFallbackArchive
@ -34,6 +49,7 @@ phases:
-GitCredential '$(dn-bot-devdiv-build-rw-code-rw)' -GitCredential '$(dn-bot-devdiv-build-rw-code-rw)'
-Config $(BuildConfiguration) -Config $(BuildConfiguration)
-BuildNumber $(Build.BuildNumber) -BuildNumber $(Build.BuildNumber)
-SignType $(_SignType)
displayName: Build ANCM installers displayName: Build ANCM installers
# TODO: configure harvesting to run as a part of build.cmd # TODO: configure harvesting to run as a part of build.cmd
- powershell: > - powershell: >
@ -42,6 +58,7 @@ phases:
-x86 artifacts/runtime/aspnetcore-runtime-internal-2.2.0-preview2-$(Build.BuildNumber)-win-x86.zip -x86 artifacts/runtime/aspnetcore-runtime-internal-2.2.0-preview2-$(Build.BuildNumber)-win-x86.zip
-Config $(BuildConfiguration) -Config $(BuildConfiguration)
-BuildNumber $(Build.BuildNumber) -BuildNumber $(Build.BuildNumber)
-SignType $(_SignType)
displayName: Build Windows installers displayName: Build Windows installers
- task: PublishTestResults@2 - task: PublishTestResults@2
displayName: Publish test results displayName: Publish test results
@ -56,6 +73,9 @@ phases:
pathtoPublish: ./artifacts/ pathtoPublish: ./artifacts/
artifactName: artifacts-Windows-Release artifactName: artifacts-Windows-Release
artifactType: Container artifactType: Container
- task: MicroBuildCleanup@1
displayName: Cleanup MicroBuild tasks
condition: always()
- phase: macOS - phase: macOS
dependsOn: Windows dependsOn: Windows

View File

@ -1,29 +1,12 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<!-- MicroBuild plugins can be installed in any parent directory up the tree from the project that is building. <!-- Allow for the ability to override the plugin directory, for example in automated builds -->
The use of a sentinel file (which will be installed automatically due to package dependencies from any plugin) <MicroBuildPluginDirectory Condition="'$(MicroBuildPluginDirectory)' == ''">$(MicroBuildOverridePluginDirectory)</MicroBuildPluginDirectory>
will help us locate the plugin packages directory while being constrained to using MSBuild's intrinsic functions,
since we want the imports to occur at evaluation time instead of when a specific target is executing.
Note: All MicroBuild plugins must be installed to the same directory (under the same packages folder). If plugins <!-- Some people might want to put the plugin packages directly in their Nuget v3 global cache. This doesn't happen by default, but we will allow for it here. -->
are installed to different directories, the plugins which are in the directories closest to the executing project <MicroBuildPluginDirectory Condition="'$(MicroBuildPluginDirectory)' == '' and '$(NuGetPackageRoot)' != '' ">$(NuGetPackageRoot)</MicroBuildPluginDirectory>
up the hierarchy will be discovered, and the ones higher up the tree will be ignored. <MicroBuildPluginDirectory Condition="'$(MicroBuildPluginDirectory)' == '' and '$(NUGET_PACKAGES)' != '' ">$(NUGET_PACKAGES)</MicroBuildPluginDirectory>
--> <MicroBuildPluginDirectory Condition="'$(MicroBuildPluginDirectory)' == '' and '$(USERPROFILE)' != '' ">$(USERPROFILE)\.nuget\packages</MicroBuildPluginDirectory>
<MicroBuildSentinelFile>packages\MicroBuild.Core.Sentinel.1.0.0\sentinel.txt</MicroBuildSentinelFile> </PropertyGroup>
<MicroBuildSentinelFileV3>MicroBuild.Core.Sentinel\1.0.0\sentinel.txt</MicroBuildSentinelFileV3> </Project>
<MicroBuildPluginDirectory>$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), $(MicroBuildSentinelFile)))</MicroBuildPluginDirectory>
<MicroBuildPluginDirectory Condition="'$(MicroBuildPluginDirectory)' != ''">$(MicroBuildPluginDirectory)\packages</MicroBuildPluginDirectory>
<!-- Some people might want to put the plugin packages directly in their Nuget v3 global cache. This doesn't happen by default,
but we will allow for it here. We don't support nuget.config's globalPackagesFolder setting here because we don't have a good
way to load/parse that file with MSBuild intrinsics. We can check the other two mechanisms though, which are the %NUGET_PACKAGES%
environment variable and %USERPROFILE%\.nuget\packages -->
<MicroBuildPluginDirectory Condition="'$(MicroBuildPluginDirectory)' == '' and '$(NUGET_PACKAGES)' != '' and Exists('$(NUGET_PACKAGES)\$(MicroBuildSentinelFileV3)')">$(NUGET_PACKAGES)</MicroBuildPluginDirectory>
<MicroBuildPluginDirectory Condition="'$(MicroBuildPluginDirectory)' == '' and '$(USERPROFILE)' != '' and Exists('$(USERPROFILE)\.nuget\packages\$(MicroBuildSentinelFileV3)')">$(USERPROFILE)\.nuget\packages</MicroBuildPluginDirectory>
<!-- Allow for the ability to override the plugin directory, for example in automated builds -->
<MicroBuildPluginDirectory Condition="'$(MicroBuildOverridePluginDirectory)' != ''">$(MicroBuildOverridePluginDirectory)</MicroBuildPluginDirectory>
</PropertyGroup>
</Project>

View File

@ -22,6 +22,7 @@
</ItemGroup> </ItemGroup>
<PropertyGroup> <PropertyGroup>
<SignOutput Condition=" '$(SignType)' != '' ">true</SignOutput>
<DarkToolPath>$(WixExtDir)dark.exe</DarkToolPath> <DarkToolPath>$(WixExtDir)dark.exe</DarkToolPath>
</PropertyGroup> </PropertyGroup>

View File

@ -13,6 +13,7 @@ param(
[Alias("x64")] [Alias("x64")]
[string]$Runtime64Zip, [string]$Runtime64Zip,
[string]$BuildNumber = 't000', [string]$BuildNumber = 't000',
[string]$SignType = '',
[string]$AccessTokenSuffix = $null, [string]$AccessTokenSuffix = $null,
[string]$AssetRootUrl = $null, [string]$AssetRootUrl = $null,
@ -80,7 +81,8 @@ try {
"-p:SharedFrameworkHarvestRootPath=$repoRoot/obj/sfx/" ` "-p:SharedFrameworkHarvestRootPath=$repoRoot/obj/sfx/" `
"-p:Configuration=$Configuration" ` "-p:Configuration=$Configuration" `
"-p:BuildNumber=$BuildNumber" ` "-p:BuildNumber=$BuildNumber" `
-bl ` "-p:SignType=$SignType" `
"-bl:$repoRoot/artifacts/logs/installers.msbuild.binlog" `
@msbuildArgs @msbuildArgs
} }
} }

View File

@ -9,7 +9,8 @@ param(
[string]$Configuration = 'Release', [string]$Configuration = 'Release',
[string]$DepsZip, [string]$DepsZip,
[string]$BuildNumber = 't000', [string]$BuildNumber = 't000',
[string]$AncmSourceBranch = 'release/2.2' [string]$AncmSourceBranch = 'release/2.2',
[string]$SignType = ''
) )
$ErrorActionPreference = 'Stop' $ErrorActionPreference = 'Stop'
@ -102,7 +103,9 @@ try {
"-p:WixTasksPath=$wixToolSetRoot\wixtasks.dll" ` "-p:WixTasksPath=$wixToolSetRoot\wixtasks.dll" `
"-p:WixNativeCATargetsPath=$wixToolSetRoot\sdk\wix.nativeca.targets" ` "-p:WixNativeCATargetsPath=$wixToolSetRoot\sdk\wix.nativeca.targets" `
"-p:Configuration=$Configuration" ` "-p:Configuration=$Configuration" `
"-p:BuildNumber=$BuildNumber" "-p:BuildNumber=$BuildNumber" `
"-p:SignType=$SignType" `
"-bl:$repoRoot/artifacts/logs/ancn.msbuild.binlog"
} }
$outputPath = "$repoRoot/artifacts/bin/$Configuration/installers/en-US/" $outputPath = "$repoRoot/artifacts/bin/$Configuration/installers/en-US/"