Skip to content

Commit b5209ae

Browse files
committed
updating yaml
1 parent a7904cb commit b5209ae

File tree

6 files changed

+111
-75
lines changed

6 files changed

+111
-75
lines changed

azure-pipelines.yml

Lines changed: 42 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,47 @@
1+
# This is a simple wrapper for eng/ci.yml to get around the limitation of
2+
# user-defined variables not being available in yaml template expressions.
3+
4+
# Parameters ARE available in template expressions, and parameters can have default values,
5+
# so they can be used to control yaml flow.
6+
17
variables:
2-
_HelixType: build/product
3-
${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}:
4-
_HelixSource: pr/dotnet/arcade/$(Build.SourceBranch)
5-
${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
6-
_TeamName: DotNetCore
7-
_HelixSource: official/dotnet/arcade/$(Build.SourceBranch)
88

9-
resources:
10-
containers:
11-
- container: LinuxContainer
12-
image: microsoft/dotnet-buildtools-prereqs:ubuntu-14.04-cross-0cd4667-20170319080304
9+
# clean the local repo on the build agents
10+
Build.Repository.Clean: true
11+
12+
# Set some variables based on build conditions
13+
# TODO: Remove the Build.DefinitionName check once the github repo goes public
14+
${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest'), contains(variables['Build.DefinitionName'], 'github')) }}:
15+
_HelixType: build/product
16+
_HelixSource: pr/dotnet/winforms/$(Build.SourceBranch)
17+
_PublishType: none
18+
_SignType: test
19+
_DotNetPublishToBlobFeed: false
20+
# else
21+
# TODO: Remove the Build.DefinitionName check once the github repo goes public
22+
${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), not(contains(variables['Build.DefinitionName'], 'github'))) }}:
23+
_TeamName: DotNetCore
24+
_HelixSource: official/dotnet/winforms/$(Build.SourceBranch)
25+
_PublishType: blob
26+
_SignType: real
27+
_DotNetPublishToBlobFeed: true
1328

14-
phases:
15-
- template: /eng/build.yml
16-
parameters:
17-
name: Windows_NT
18-
queue:
19-
# For public or PR jobs, use the hosted pool. For internal jobs use the internal pool.
20-
# Will eventually change this to two BYOC pools.
21-
${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}:
22-
name: dotnet-external-temp
23-
${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
24-
name: dotnet-internal-temp
25-
parallel: 2
26-
matrix:
27-
Build_Debug:
28-
_BuildConfig: Debug
29-
_PublishType: none
30-
_SignType: test
31-
_DotNetPublishToBlobFeed : false
32-
Build_Release:
33-
_BuildConfig: Release
34-
# PRs or external builds are not signed.
35-
${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}:
36-
_PublishType: none
37-
_SignType: test
38-
_DotNetPublishToBlobFeed : false
39-
${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
40-
_PublishType: blob
41-
_SignType: real
42-
_DotNetPublishToBlobFeed : true
29+
# only trigger ci builds for the master branch
30+
trigger:
31+
- master
4332

44-
- template: /eng/build.yml
45-
parameters:
46-
name: Linux
47-
queue:
48-
container: LinuxContainer
49-
${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}:
50-
name: dnceng-linux-external-temp
51-
${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
52-
name: dnceng-linux-internal-temp
53-
parallel: 2
54-
matrix:
55-
Build_Debug:
56-
_BuildConfig: Debug
57-
_PublishType: none
58-
_SignType: none
59-
_DotNetPublishToBlobFeed : false
60-
Build_Release:
61-
_BuildConfig: Release
62-
_PublishType: none
63-
_SignType: none
64-
_DotNetPublishToBlobFeed : false
33+
# To be added in the future when VSTS supports this feature
34+
# only trigger pull request builds for the master branch
35+
# pr:
36+
# - master
6537

66-
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
67-
- template: /eng/common/templates/phases/publish-build-assets.yml
68-
parameters:
69-
dependsOn:
70-
- Windows_NT
71-
- Linux
72-
queue:
73-
name: Hosted VS2017
38+
# Call the pipeline.yml template, which does the real work
39+
phases:
40+
- template: /eng/pipeline.yml
41+
parameters:
42+
# TODO: Remove the Build.DefinitionName check once the github repo goes public
43+
${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), not(contains(variables['Build.DefinitionName'], 'github'))) }}:
44+
# agent pool can't be read from a user-defined variable (Azure DevOps limitation)
45+
agentPool: dotnet-internal-temp
46+
# runAsPublic is used in expressions, which can't read from user-defined variables
47+
runAsPublic: false

eng/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ parameters:
99
# variables YAML object - https://github.com/Microsoft/vsts-agent/blob/master/docs/preview/yamlgettingstarted-schema.md#phase
1010
variables: {}
1111
# run this build as a public build, even in the internal project
12-
runAsPublic: true
12+
runAsPublic: false
1313

1414
# Common conditionals: There are a number of common conditionals that are useful. Generally these are used to decide what resources can be accessed,
1515
# or what logic should be applied based on the context the build is being run in.

eng/common/templates/phases/base.yml

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ parameters:
77

88
# Optional: name of the phase (not specifying phase name may cause name collisions)
99
name: ''
10+
# Optional: display name of the phase
11+
displayName: ''
12+
13+
# Optional: condition for the job to run
14+
condition: ''
15+
16+
# Optional: dependencies of the phase
17+
dependsOn: ''
1018

1119
# Required: A defined YAML queue
1220
queue: {}
@@ -17,6 +25,10 @@ parameters:
1725
# Optional: variables
1826
variables: {}
1927

28+
# Optional: should run as a public build even in the internal project
29+
# if 'true', the build won't run any of the internal only steps, even if it is running in non-public projects.
30+
runAsPublic: false
31+
2032
## Telemetry variables
2133

2234
# Optional: enable sending telemetry
@@ -38,10 +50,19 @@ parameters:
3850
phases:
3951
- phase: ${{ parameters.name }}
4052

53+
${{ if ne(parameters.displayName, '') }}:
54+
displayName: ${{ parameters.displayName }}
55+
56+
${{ if ne(parameters.condition, '') }}:
57+
condition: ${{ parameters.condition }}
58+
59+
${{ if ne(parameters.dependsOn, '') }}:
60+
dependsOn: ${{ parameters.dependsOn }}
61+
4162
queue: ${{ parameters.queue }}
4263

4364
${{ if ne(parameters.variables, '') }}:
44-
variables:
65+
variables:
4566
${{ insert }}: ${{ parameters.variables }}
4667

4768
steps:
@@ -56,10 +77,11 @@ phases:
5677
buildConfig: $(_HelixBuildConfig)
5778
helixSource: $(_HelixSource)
5879
helixType: $(_HelixType)
80+
runAsPublic: ${{ parameters.runAsPublic }}
5981

6082
- ${{ if eq(parameters.enableMicrobuild, 'true') }}:
6183
# Internal only resource, and Microbuild signing shouldn't be applied to PRs.
62-
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
84+
- ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
6385
- task: MicroBuildSigningPlugin@2
6486
displayName: Install MicroBuild plugin
6587
inputs:
@@ -77,7 +99,7 @@ phases:
7799

78100
- ${{ if eq(parameters.enableMicrobuild, 'true') }}:
79101
# Internal only resources
80-
- ${{ if ne(variables['System.TeamProject'], 'public') }}:
102+
- ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
81103
- task: MicroBuildCleanup@1
82104
displayName: Execute Microbuild cleanup tasks
83105
condition: and(always(), in(variables['_SignType'], 'real', 'test'), eq(variables['Agent.Os'], 'Windows_NT'))
@@ -90,7 +112,7 @@ phases:
90112
helixSource: $(_HelixSource)
91113
helixType: $(_HelixType)
92114

93-
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
115+
- ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
94116
- task: CopyFiles@2
95117
displayName: Gather Asset Manifests
96118
inputs:

eng/common/templates/phases/publish-build-assets.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ parameters:
44
configuration: 'Debug'
55
condition: succeeded()
66
continueOnError: false
7+
runAsPublic: false
78
phases:
89
- phase: Asset_Registry_Publish
910
displayName: Publish to Build Asset Registry
@@ -12,7 +13,7 @@ phases:
1213
variables:
1314
config: ${{ parameters.configuration }}
1415
steps:
15-
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
16+
- ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
1617
- task: DownloadBuildArtifacts@0
1718
displayName: Download artifact
1819
inputs:

eng/common/templates/steps/telemetry-start.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ parameters:
22
helixSource: 'undefined_defaulted_in_telemetry.yml'
33
helixType: 'undefined_defaulted_in_telemetry.yml'
44
buildConfig: ''
5+
runAsPublic: false
56

67
steps:
7-
- ${{ if not(eq(variables['System.TeamProject'], 'public')) }}:
8+
- ${{ if and(eq(parameters.runAsPublic, 'false'), not(eq(variables['System.TeamProject'], 'public'))) }}:
89
- task: AzureKeyVault@1
910
inputs:
1011
azureSubscription: 'HelixProd_KeyVault'

eng/pipeline.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
parameters:
2+
3+
# Needed because agent pool can't be read from a user-defined variable (Azure DevOps limitation)
4+
# Defaults to dotnet-external-temp
5+
# TODO: CHANGE THIS TO dotnet-external-temp ONCE THE GITHUB REPO GOES PUBLIC
6+
agentPool: dotnet-internal-temp
7+
8+
# Needed because runAsPublic is used in template expressions, which can't read from user-defined variables
9+
# Defaults to true
10+
runAsPublic: true
11+
12+
# Call build.yml, which runs common build tasks
13+
phases:
14+
- template: /eng/build.yml
15+
parameters:
16+
name: Windows_NT
17+
runAsPublic: ${{ parameters.runAsPublic }}
18+
queue:
19+
name: ${{ parameters.agentPool }}
20+
parallel: 99
21+
matrix:
22+
Build_Debug:
23+
_BuildConfig: netcoreapp-Windows_NT-Debug
24+
# overwrite some values when building debug
25+
_PublishType: none
26+
_SignType: test
27+
_DotNetPublishToBlobFeed : false
28+
Build_Release:
29+
_BuildConfig: netcoreapp-Windows_NT-Release
30+
31+
# only publish build assets if we're running internally
32+
- ${{ if eq(parameters.runAsPublic, 'false') }}:
33+
- template: /eng/common/templates/phases/publish-build-assets.yml
34+
parameters:
35+
dependsOn: Windows_NT
36+
queue:
37+
name: Hosted VS2017
38+
configuration: netcoreapp-Windows_NT-Debug

0 commit comments

Comments
 (0)