1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
|
# default-build.yml
# Description: Defines a build phase for invoking build.sh/cmd
# Parameters:
# jobName: string
# The name of the job. Defaults to the name of the OS. No spaces allowed
# jobDisplayName: string
# The friendly job name to display in the UI. Defaults to the name of the OS.
# poolName: string
# The name of the Azure DevOps agent pool to use.
# agentOs: string
# Used in templates to define variables which are OS specific. Typically from the set { Windows, Linux, MacOS }
# buildArgs: string
# Additional arguments to pass to the build.sh/cmd script.
# Note: -ci is always passed
# beforeBuild: [steps]
# Additional steps to run before build.sh/cmd
# afterBuild: [steps]
# Additional steps to run after build.sh/cmd
# artifacts:
# publish: boolean
# Should artifacts be published
# path: string
# The file path to artifacts output
# name: string
# The name of the artifact container
# variables: { string: string }
# A map of custom variables
# matrix: { string: { string: string } }
# A map of matrix configurations and variables. https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=schema#job
# dependsOn: string | [ string ]
# For fan-out/fan-in. https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=schema#job
# codeSign: boolean
# This build definition is enabled for code signing. (Only applies to Windows)
# buildDirectory: string
# Specifies what directory to run build.sh/cmd
#
# See https://docs.microsoft.com/en-us/vsts/pipelines/yaml-schema for details
#
parameters:
agentOs: 'Windows'
poolName: ''
configuration: 'Release'
beforeBuild: []
afterBuild: []
codeSign: false
variables: {}
dependsOn: ''
# jobName: '' - use agentOs by default.
# jobDisplayName: '' - use agentOs by default.
# matrix: {} - don't define an empty object default because there is no way in template expression yet to check "if isEmpty(parameters.matrix)"
artifacts:
publish: true
path: 'artifacts/'
buildDirectory: ''
jobs:
- job: ${{ coalesce(parameters.jobName, parameters.agentOs) }}
displayName: ${{ coalesce(parameters.jobDisplayName, parameters.agentOs) }}
dependsOn: ${{ parameters.dependsOn }}
timeoutInMinutes: 90
workspace:
clean: all
strategy:
${{ if ne(parameters.matrix, '') }}:
maxParallel: 8
matrix: ${{ parameters.matrix }}
# Map friendly OS names to the right queue
# See https://github.com/dotnet/arcade/blob/master/Documentation/ChoosingAMachinePool.md
pool:
${{ if ne(parameters.poolName, '') }}:
name: ${{ parameters.poolName }}
${{ if and(eq(parameters.poolName, ''), eq(parameters.agentOs, 'MacOS')) }}:
vmImage: macOS-10.14
${{ if and(eq(parameters.poolName, ''), eq(parameters.agentOs, 'Linux')) }}:
vmImage: ubuntu-16.04
${{ if and(eq(parameters.poolName, ''), eq(parameters.agentOs, 'Windows')) }}:
${{ if eq(variables['System.TeamProject'], 'public') }}:
name: NetCorePublic-Pool
queue: BuildPool.Server.Amd64.VS2017.Open
${{ if ne(variables['System.TeamProject'], 'public') }}:
name: NetCoreInternal-Pool
queue: BuildPool.Server.Amd64.VS2017
variables:
AgentOsName: ${{ parameters.agentOs }}
BuildScript: ${{ parameters.buildScript }}
BuildConfiguration: ${{ parameters.configuration }}
BuildDirectory: ${{ parameters.buildDirectory }}
BinlogArg: /bl:artifacts/logs/${{ parameters.agentOs }}.binlog
${{ if eq(parameters.agentOs, 'Windows') }}:
JAVA_HOME: $(Agent.BuildDirectory)\.tools\jdk
${{ if or(ne(parameters.codeSign, 'true'), ne(variables['System.TeamProject'], 'internal'), in(variables['Build.Reason'], 'PullRequest')) }}:
_SignType:
${{ if and(eq(parameters.codeSign, 'true'), eq(variables['System.TeamProject'], 'internal'), notin(variables['Build.Reason'], 'PullRequest')) }}:
_SignType: real
${{ insert }}: ${{ parameters.variables }}
${{ if eq(variables['System.TeamProject'], 'public') }}:
PB_PackageVersionPropsUrl: ''
PB_AssetRootUrl: ''
PB_RestoreSource: ''
PB_PublishBlobFeedKey: ''
steps:
- checkout: self
clean: true
- task: NodeTool@0
displayName: Install Node 10.x
inputs:
versionSpec: 10.x
- ${{ if eq(parameters.agentOs, 'Windows') }}:
- powershell: ./eng/scripts/InstallJdk.ps1 '11.0.1'
displayName: Install JDK 11
- task: NuGetCommand@2
displayName: 'Clear NuGet caches'
condition: succeeded()
inputs:
command: custom
arguments: 'locals all -clear'
- ${{ if and(eq(variables['System.TeamProject'], 'internal'), eq(parameters.agentOs, 'Windows'), eq(parameters.codeSign, 'true')) }}:
- task: MicroBuildSigningPlugin@2
displayName: Install MicroBuild Signing plugin
condition: and(succeeded(), in(variables['_SignType'], 'test', 'real'))
inputs:
signType: $(_SignType)
zipSources: false
feedSource: https://dnceng.pkgs.visualstudio.com/_packaging/MicroBuildToolset/nuget/v3/index.json
- ${{ parameters.beforeBuild }}
- ${{ if eq(parameters.agentOs, 'Windows') }}:
- script: .\$(BuildDirectory)\build.cmd
-ci
/p:SignType=$(_SignType)
/p:Configuration=$(BuildConfiguration)
/p:DisableSignCheck=true
$(BuildScriptArgs)
$(BinlogArg)
env:
PB_PackageVersionPropsUrl: $(PB_PackageVersionPropsUrl)
PB_AssetRootUrl: $(PB_AssetRootUrl)
PB_RestoreSource: $(PB_RestoreSource)
PB_PublishBlobFeedKey: $(PB_PublishBlobFeedKey)
displayName: Run build.cmd
- powershell: eng\scripts\KillProcesses.ps1
displayName: Kill processes
condition: always()
- ${{ if ne(parameters.agentOs, 'Windows') }}:
- script: ./$(BuildDirectory)/build.sh
-ci
-p:Configuration=$(BuildConfiguration)
$(BuildScriptArgs)
$(BinlogArg)
env:
PB_PackageVersionPropsUrl: $(PB_PackageVersionPropsUrl)
PB_AssetRootUrl: $(PB_AssetRootUrl)
PB_RestoreSource: $(PB_RestoreSource)
PB_PublishBlobFeedKey: $(PB_PublishBlobFeedKey)
displayName: Run build.sh
- script: eng/scripts/KillProcesses.sh
displayName: Kill processes
condition: always()
- task: PublishTestResults@2
displayName: Publish test results
condition: always()
continueOnError: true
inputs:
testRunTitle: $(AgentOsName)-$(BuildConfiguration)
testRunner: vstest
testResultsFiles: 'artifacts/logs/**/*.trx'
mergeTestResults: true
- ${{ if eq(parameters.artifacts.publish, 'true') }}:
- task: PublishBuildArtifacts@1
displayName: Upload artifacts
condition: eq(variables['system.pullrequest.isfork'], false)
continueOnError: true
inputs:
${{ if eq(parameters.buildDirectory, '') }}:
pathtoPublish: ${{ parameters.artifacts.path }}
${{ if ne(parameters.artifacts.name, '') }}:
pathtoPublish: ${{ parameters.buildDirectory }}\${{ parameters.artifacts.path }}
${{ if eq(parameters.artifacts.name, '') }}:
artifactName: artifacts-$(AgentOsName)-$(BuildConfiguration)
${{ if ne(parameters.artifacts.name, '') }}:
artifactName: ${{ parameters.artifacts.name }}
artifactType: Container
parallel: true
- ${{ parameters.afterBuild }}
- ${{ if and(eq(variables['System.TeamProject'], 'internal'), eq(parameters.agentOs, 'Windows')) }}:
- task: MicroBuildCleanup@1
displayName: Cleanup MicroBuild tasks
condition: always()
|