Skip to content

Commit db78424

Browse files
wtgodbepranavkm
andauthored
Get pipeline working (#132)
* Add pipeline job * Add pipeline job * Remove buildtools reference * Fix path * Remove extra ctrl-c * Fixup * Try enabling signing * Fix 2 things * Only packageRef when signing * Fix syntax * Add prints * Add binlog * Pass through args from run.ps1 * dotnet msbuild -> dotnet build * Rename, fix SDK * Set TFM * Use netcoreapp3.1 * Add nuget.config * Remove PackageReference to Localization * Remame to build.csproj * Don't use default build target * Rename to build.proj * More necessary props * Fix import order * Use newer microbuild task * Use internal pool * Remove TFM * 2.1 * VS2019 * Install node * install nuget * Skip signing telemetry * Remove appveyor Co-authored-by: Pranav K <[email protected]>
1 parent 2f17f37 commit db78424

13 files changed

+1762
-691
lines changed

.appveyor.yml

Lines changed: 0 additions & 13 deletions
This file was deleted.

.vsts-pipelines/builds/ci-public.yml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
trigger:
2-
- master
3-
- release/*
4-
5-
resources:
6-
repositories:
7-
- repository: buildtools
8-
type: github
9-
endpoint: DotNet-Bot GitHub Connection
10-
name: aspnet/BuildTools
11-
ref: refs/heads/release/2.2
2+
branches:
3+
include:
4+
- 'master'
5+
- 'release/*'
6+
- 'internal/release/*'
7+
# Run PR validation on all branches
8+
pr:
9+
branches:
10+
include:
11+
- '*'
1212

1313
phases:
14-
- template: .vsts-pipelines/templates/phases/default-build.yml@buildtools
14+
- template: ../templates/default-build.yml
1515
parameters:
1616
agentOs: Windows
17+
codeSign: true
18+
${{ if eq(variables['System.TeamProject'], 'internal') }}:
19+
buildArgs: '/p:OfficialBuild=true /p:Sign=true'
Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
# default-build.yml
2+
# Description: Defines a build phase for invoking build.sh/cmd
3+
# Parameters:
4+
# jobName: string
5+
# The name of the job. Defaults to the name of the OS. No spaces allowed
6+
# jobDisplayName: string
7+
# The friendly job name to display in the UI. Defaults to the name of the OS.
8+
# poolName: string
9+
# The name of the Azure DevOps agent pool to use.
10+
# agentOs: string
11+
# Used in templates to define variables which are OS specific. Typically from the set { Windows, Linux, macOS }
12+
# buildArgs: string
13+
# Additional arguments to pass to the build.sh/cmd script.
14+
# Note: -ci is always passed
15+
# beforeBuild: [steps]
16+
# Additional steps to run before build.sh/cmd
17+
# afterBuild: [steps]
18+
# Additional steps to run after build.sh/cmd
19+
# artifacts:
20+
# publish: boolean
21+
# Should artifacts be published
22+
# path: string
23+
# The file path to artifacts output
24+
# name: string
25+
# The name of the artifact container
26+
# variables: { string: string }
27+
# A map of custom variables
28+
# matrix: { string: { string: string } }
29+
# A map of matrix configurations and variables. https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=schema#job
30+
# demands: string | [ string ]
31+
# A list of agent demands. https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=schema#demands
32+
# dependsOn: string | [ string ]
33+
# For fan-out/fan-in. https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=schema#job
34+
# codeSign: boolean
35+
# This build definition is enabled for code signing. (Only applies to Windows)
36+
37+
#
38+
# See https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema for details
39+
#
40+
41+
parameters:
42+
agentOs: 'Windows'
43+
poolName: ''
44+
buildArgs: ''
45+
configuration: 'Release'
46+
demands: []
47+
beforeBuild: []
48+
afterBuild: []
49+
codeSign: false
50+
variables: {}
51+
dependsOn: ''
52+
# buildSteps: [] - don't define an empty object default because there is no way in template expression yet to check "if isEmpty(parameters.buildSteps)"
53+
# jobName: '' - use agentOs by default.
54+
# jobDisplayName: '' - use agentOs by default.
55+
# matrix: {} - don't define an empty object default because there is no way in template expression yet to check "if isEmpty(parameters.matrix)"
56+
artifacts:
57+
publish: true
58+
path: 'artifacts/'
59+
60+
jobs:
61+
- job: ${{ coalesce(parameters.jobName, parameters.agentOs) }}
62+
displayName: ${{ coalesce(parameters.jobDisplayName, parameters.agentOs) }}
63+
dependsOn: ${{ parameters.dependsOn }}
64+
workspace:
65+
clean: all
66+
strategy:
67+
${{ if ne(parameters.matrix, '') }}:
68+
maxParallel: 8
69+
matrix: ${{ parameters.matrix }}
70+
# Map friendly OS names to the right queue
71+
# See https://github.com/dotnet/arcade/blob/master/Documentation/ChoosingAMachinePool.md and
72+
# https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops&tabs=yaml#use-a-microsoft-hosted-agent
73+
pool:
74+
${{ if ne(parameters.poolName, '') }}:
75+
name: ${{ parameters.poolName }}
76+
${{ if and(eq(parameters.poolName, ''), eq(parameters.agentOs, 'macOS')) }}:
77+
vmImage: macOS-10.13
78+
${{ if and(eq(parameters.poolName, ''), eq(parameters.agentOs, 'Linux')) }}:
79+
vmImage: ubuntu-16.04
80+
${{ if and(eq(parameters.poolName, ''), eq(parameters.agentOs, 'Windows')) }}:
81+
vmImage: vs2017-win2016
82+
${{ if ne(variables['System.TeamProject'], 'public') }}:
83+
# This override makes the specified vmImage irrelevant.
84+
name: NetCoreInternal-Pool
85+
queue: BuildPool.Server.Amd64.VS2019
86+
variables:
87+
AgentOsName: ${{ parameters.agentOs }}
88+
ASPNETCORE_TEST_LOG_MAXPATH: "200" # Keep test log file name length low enough for artifact zipping
89+
DOTNET_HOME: $(Agent.BuildDirectory)/.dotnet
90+
BuildScriptArgs: ${{ parameters.buildArgs }}
91+
BuildConfiguration: ${{ parameters.configuration }}
92+
DOTNET_CLI_TELEMETRY_OPTOUT: 1 # Skip signing telemetry to work around an error
93+
TeamName: AspNetCore
94+
${{ if and(eq(parameters.codeSign, 'true'), eq(variables['System.TeamProject'], 'internal'), ne(variables['Build.Reason'], 'PullRequest')) }}:
95+
_SignType: real
96+
${{ if or(ne(parameters.codeSign, 'true'), ne(variables['System.TeamProject'], 'internal'), eq(variables['Build.Reason'], 'PullRequest')) }}:
97+
_SignType: ''
98+
${{ insert }}: ${{ parameters.variables }}
99+
steps:
100+
- checkout: self
101+
clean: true
102+
- ${{ if eq(parameters.agentOs, 'Windows') }}:
103+
- task: NuGetCommand@2
104+
displayName: 'Clear NuGet caches'
105+
condition: succeeded()
106+
inputs:
107+
command: custom
108+
arguments: 'locals all -clear'
109+
- ${{ if and(eq(variables['System.TeamProject'], 'internal'), eq(parameters.agentOs, 'Windows'), eq(parameters.codeSign, 'true')) }}:
110+
- task: MicroBuildSigningPlugin@2
111+
displayName: Install MicroBuild Signing plugin
112+
condition: and(succeeded(), in(variables['_SignType'], 'test', 'real'))
113+
inputs:
114+
signType: $(_SignType)
115+
zipSources: false
116+
feedSource: https://dnceng.pkgs.visualstudio.com/_packaging/MicroBuildToolset/nuget/v3/index.json
117+
- ${{ parameters.beforeBuild }}
118+
- ${{ if eq(parameters.buildSteps, '') }}:
119+
- ${{ if eq(parameters.agentOs, 'Windows') }}:
120+
- task: NuGetToolInstaller@1
121+
displayName: 'Install NuGet.exe'
122+
- task: NodeTool@0
123+
displayName: Install Node 10.x
124+
inputs:
125+
versionSpec: 10.x
126+
- script: .\build.cmd /p:SignType=$(_SignType) /p:Configuration=$(BuildConfiguration) $(BuildScriptArgs) /bl:artifacts/logs/build.binlog
127+
displayName: Run build.cmd
128+
- ${{ if ne(parameters.agentOs, 'Windows') }}:
129+
- script: ./build.sh -ci -p:Configuration=$(BuildConfiguration) $(BuildScriptArgs)
130+
displayName: Run build.sh
131+
- ${{ if ne(parameters.buildSteps, '') }}:
132+
- ${{ parameters.buildSteps }}
133+
- task: PublishTestResults@2
134+
displayName: Publish test results
135+
condition: always()
136+
continueOnError: true
137+
inputs:
138+
testRunTitle: $(AgentOsName)-$(BuildConfiguration)
139+
testRunner: vstest
140+
testResultsFiles: 'artifacts/logs/**/*.trx'
141+
mergeTestResults: true
142+
- ${{ if eq(parameters.artifacts.publish, 'true') }}:
143+
- task: PublishBuildArtifacts@1
144+
displayName: Upload artifacts
145+
condition: eq(variables['system.pullrequest.isfork'], false)
146+
continueOnError: true
147+
inputs:
148+
pathtoPublish: ${{ parameters.artifacts.path }}
149+
${{ if eq(parameters.artifacts.name, '') }}:
150+
artifactName: artifacts-$(AgentOsName)-$(BuildConfiguration)
151+
${{ if ne(parameters.artifacts.name, '') }}:
152+
artifactName: ${{ parameters.artifacts.name }}
153+
artifactType: Container
154+
parallel: true
155+
- ${{ parameters.afterBuild }}
156+
- ${{ if and(eq(variables['System.TeamProject'], 'internal'), eq(parameters.agentOs, 'Windows'), eq(parameters.codeSign, 'true')) }}:
157+
- task: MicroBuildCleanup@1
158+
displayName: Cleanup MicroBuild tasks
159+
condition: always()

Sign.proj

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. -->
2+
<Project DefaultTargets="Sign">
3+
<PropertyGroup>
4+
<!-- Respect environment variable for the NuGet Packages Root if set; otherwise, use the current default location -->
5+
<NuGetPackageRoot Condition="'$(NuGetPackageRoot)' != ''">$([MSBuild]::NormalizeDirectory('$(NuGetPackageRoot)'))</NuGetPackageRoot>
6+
<NuGetPackageRoot Condition="'$(NuGetPackageRoot)' == '' and '$(NUGET_PACKAGES)' != ''">$([MSBuild]::NormalizeDirectory('$(NUGET_PACKAGES)'))</NuGetPackageRoot>
7+
<NuGetPackageRoot Condition="'$(NuGetPackageRoot)' == '' and '$(OS)' == 'Windows_NT'">$([MSBuild]::NormalizeDirectory('$(UserProfile)', '.nuget', 'packages'))</NuGetPackageRoot>
8+
<NuGetPackageRoot Condition="'$(NuGetPackageRoot)' == '' and '$(OS)' != 'Windows_NT'">$([MSBuild]::NormalizeDirectory('$(HOME)', '.nuget', 'packages'))</NuGetPackageRoot>
9+
10+
<ArtifactsTmpDir>$(ArtifactsDir)..\tmp\</ArtifactsTmpDir>
11+
<ArtifactsLogDir>$(ArtifactsDir)..\logs\</ArtifactsLogDir>
12+
</PropertyGroup>
13+
14+
<Import Project="dependencies.props" />
15+
16+
<Import Project="$(NuGetPackageRoot)microsoft.dotnet.signtool\$(MicrosoftDotNetSignToolVersion)\build\Microsoft.DotNet.SignTool.props" />
17+
18+
<Import Project="Sign.props" />
19+
20+
<Target Name="Sign">
21+
<Error Text="The value of DotNetSignType is invalid: '$(DotNetSignType)'"
22+
Condition="'$(DotNetSignType)' != 'real' and '$(DotNetSignType)' != 'test' and '$(DotNetSignType)' != ''" />
23+
24+
<PropertyGroup>
25+
<_DryRun>true</_DryRun>
26+
<_DryRun Condition="'$(OfficialBuild)' == 'true'">false</_DryRun>
27+
28+
<_TestSign>false</_TestSign>
29+
<_TestSign Condition="'$(DotNetSignType)' == 'test'">true</_TestSign>
30+
31+
<_DesktopMSBuildRequired>false</_DesktopMSBuildRequired>
32+
<_DesktopMSBuildRequired Condition="'$(_DryRun)' != 'true' and '$(MSBuildRuntimeType)' == 'Core'">true</_DesktopMSBuildRequired>
33+
</PropertyGroup>
34+
35+
<Error Condition="'$(AllowEmptySignList)' != 'true' AND '@(ItemsToSign)' == ''"
36+
Text="List of files to sign is empty. Make sure that ItemsToSign is configured correctly." />
37+
38+
<!-- We only need this if we are going to use the executable version. -->
39+
<Exec Command='"$(NuGetPackageRoot)vswhere\$(VSWhereVersion)\tools\vswhere.exe" -latest -prerelease -property installationPath -requires Microsoft.Component.MSBuild'
40+
ConsoleToMsBuild="true"
41+
StandardErrorImportance="high"
42+
Condition="$(_DesktopMSBuildRequired)">
43+
<Output TaskParameter="ConsoleOutput" PropertyName="_VSInstallDir" />
44+
</Exec>
45+
46+
<Message Text="Signing files: %(ItemsToSign.Identity)" Importance="High"/>
47+
48+
<PropertyGroup Condition="$(_DesktopMSBuildRequired)">
49+
<_DesktopMSBuildPath>$(_VSInstallDir)\MSBuild\Current\Bin\msbuild.exe</_DesktopMSBuildPath>
50+
<_DesktopMSBuildPath Condition="!Exists('$(_DesktopMSBuildPath)')">$(_VSInstallDir)\MSBuild\15.0\Bin\msbuild.exe</_DesktopMSBuildPath>
51+
</PropertyGroup>
52+
53+
<Microsoft.DotNet.SignTool.SignToolTask
54+
DryRun="$(_DryRun)"
55+
TestSign="$(_TestSign)"
56+
DoStrongNameCheck="$(DoStrongNameCheck)"
57+
AllowEmptySignList="$(AllowEmptySignList)"
58+
CertificatesSignInfo="@(CertificatesSignInfo)"
59+
ItemsToSign="@(ItemsToSign)"
60+
StrongNameSignInfo="@(StrongNameSignInfo)"
61+
FileSignInfo="@(FileSignInfo)"
62+
FileExtensionSignInfo="@(FileExtensionSignInfo)"
63+
TempDir="$(ArtifactsTmpDir)"
64+
LogDir="$(ArtifactsLogDir)"
65+
MSBuildPath="$(_DesktopMSBuildPath)"
66+
SNBinaryPath="$(NuGetPackageRoot)sn\$(SNVersion)\sn.exe"
67+
MicroBuildCorePath="$(NuGetPackageRoot)microbuild.core\$(MicroBuildCoreVersion)"/>
68+
</Target>
69+
</Project>

Sign.props

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
3+
<ItemGroup>
4+
<!--
5+
This is intended to hold information about the certificates used for signing.
6+
For now the only information required is whether or not the certificate can be
7+
used for signing already signed files - DualSigningAllowed==true.
8+
-->
9+
<CertificatesSignInfo Include="3PartyDual" DualSigningAllowed="true" />
10+
<CertificatesSignInfo Include="3PartySHA2" DualSigningAllowed="true" />
11+
12+
<!-- List of container files that will be opened and checked for files that need to be signed. -->
13+
<ItemsToSign Include="$(ArtifactsDir)**\*.nupkg" />
14+
<ItemsToSign Include="$(ArtifactsDir)**\*.tgz" />
15+
16+
<!-- Default certificate/strong-name to be used for all files with PKT=="31bf3856ad364e35". -->
17+
<StrongNameSignInfo Include="MsSharedLib72" PublicKeyToken="31bf3856ad364e35" CertificateName="Microsoft400" />
18+
<StrongNameSignInfo Include="SilverlightCert121" PublicKeyToken="7cec85d7bea7798e" CertificateName="Microsoft400" />
19+
<StrongNameSignInfo Include="StrongName" PublicKeyToken="b77a5c561934e089" CertificateName="Microsoft400" />
20+
<StrongNameSignInfo Include="StrongName" PublicKeyToken="b03f5f7f11d50a3a" CertificateName="Microsoft400" />
21+
<StrongNameSignInfo Include="$(MSBuildThisFileDirectory)snk\Open.snk" PublicKeyToken="cc7b13ffcd2ddd51" CertificateName="Microsoft400" />
22+
23+
<!--
24+
Map of file extensions to default certificate name. Files with these extensions are
25+
signed with the specified certificate. Particularly useful for files that don't have
26+
a public key token.
27+
The certificate can be overriden using the StrongNameSignInfo or the FileSignInfo item group.
28+
-->
29+
<FileExtensionSignInfo Include=".jar" CertificateName="MicrosoftJARSHA2" />
30+
<FileExtensionSignInfo Include=".js;.ps1;.psd1;.psm1;.psc1;.py" CertificateName="Microsoft400" />
31+
<FileExtensionSignInfo Include=".dll;.exe" CertificateName="Microsoft400" />
32+
<FileExtensionSignInfo Include=".nupkg" CertificateName="NuGet" />
33+
<FileExtensionSignInfo Include=".vsix" CertificateName="VsixSHA2" />
34+
<FileExtensionSignInfo Include=".zip" CertificateName="None" />
35+
<FileExtensionSignInfo Include=".tgz" CertificateName="None" />
36+
</ItemGroup>
37+
38+
<PropertyGroup>
39+
<!-- Flags for controlling whether empty signing lists are detected for in build and post-build signing.
40+
These flags are split (rather than just a single check based on PostBuildSign == true/false because
41+
some repos may do both in-build and post-build signing. -->
42+
<!-- Control whether an empty ItemsToSign item group is allowed when calling SignToolTask. -->
43+
<AllowEmptySignList Condition="'$(PostBuildSign)' != 'true'">false</AllowEmptySignList>
44+
<AllowEmptySignList Condition="'$(PostBuildSign)' == 'true'">true</AllowEmptySignList>
45+
<!-- Control whether an empty ItemsToSignPostBuild item group is allowed during publishing -->
46+
<AllowEmptySignPostBuildList Condition="'$(PostBuildSign)' != 'true'">true</AllowEmptySignPostBuildList>
47+
<AllowEmptySignPostBuildList Condition="'$(PostBuildSign)' == 'true'">false</AllowEmptySignPostBuildList>
48+
49+
<NETCORE_ENGINEERING_TELEMETRY>Signing</NETCORE_ENGINEERING_TELEMETRY>
50+
</PropertyGroup>
51+
52+
</Project>

build.msbuild renamed to build.proj

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
1+
<Project Sdk="Microsoft.NET.Sdk" DefaultTargets="BuildProjects">
2+
<Import Project="dependencies.props" />
3+
24
<ItemGroup>
35
<VersionFile Include="version.props"/>
46
</ItemGroup>
@@ -7,13 +9,21 @@
79
<DistDir>$(MSBuildThisFileDirectory)dist\</DistDir>
810
<ArtifactsDir>$(MSBuildThisFileDirectory)artifacts\build\</ArtifactsDir>
911
<WebPackTestDir>$(MSBuildThisFileDirectory)test\webpacktest\</WebPackTestDir>
12+
<TargetFramework>netcoreapp3.1</TargetFramework>
1013
</PropertyGroup>
1114

1215
<ItemGroup>
1316
<DistDirFiles Include="$(DistDir)*.*;"/>
1417
</ItemGroup>
1518

16-
<Target Name="Build">
19+
<ItemGroup Condition="'$(Sign)' == 'true'">
20+
<PackageReference Include="Microsoft.DotNet.SignTool" Version="$(MicrosoftDotNetSignToolVersion)"/>
21+
<PackageReference Include="vswhere" Version="$(VSWhereVersion)"/>
22+
<PackageReference Include="sn" Version="$(SNVersion)"/>
23+
<PackageReference Include="MicroBuild.Core" Version="$(MicroBuildCoreVersion)"/>
24+
</ItemGroup>
25+
26+
<Target Name="BuildProjects">
1727
<ReadLinesFromFile File="@(VersionFile)">
1828
<Output TaskParameter="Lines" PropertyName="PackageVersion"/>
1929
</ReadLinesFromFile>
@@ -30,6 +40,12 @@
3040
<MSBuild Projects ="$(MSBuildProjectFullPath)"
3141
Properties="PackageVersion=$(PackageVersion)"
3242
Targets="Test" />
43+
44+
<Message Text="Signing files..." Importance="High" Condition="'$(Sign)' == 'true'"/>
45+
<MSBuild Projects="Sign.proj"
46+
Targets="Sign"
47+
Properties="ArtifactsDir=$(ArtifactsDir);DotNetSignType=$(SignType)"
48+
Condition="'$(Sign)' == 'true'"/>
3349
</Target>
3450

3551
<Target Name="Test">

dependencies.props

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
3+
<PropertyGroup>
4+
<MicroBuildCoreVersion Condition="'$(MicroBuildCoreVersion)' == ''">0.2.0</MicroBuildCoreVersion>
5+
<MicrosoftDotNetSignToolVersion>6.0.0-beta.20630.2</MicrosoftDotNetSignToolVersion>
6+
<SNVersion Condition="'$(SNVersion)' == ''">1.0.0</SNVersion>
7+
<VSWhereVersion Condition="'$(VSWhereVersion)' == ''">2.6.7</VSWhereVersion>
8+
</PropertyGroup>
9+
10+
</Project>

0 commit comments

Comments
 (0)