This commit is contained in:
Steven Kirbach 2018-11-08 14:44:07 -08:00
Родитель a7904cb558
Коммит b5209ae51b
6 изменённых файлов: 111 добавлений и 75 удалений

Просмотреть файл

@ -1,73 +1,47 @@
# This is a simple wrapper for eng/ci.yml to get around the limitation of
# user-defined variables not being available in yaml template expressions.
# Parameters ARE available in template expressions, and parameters can have default values,
# so they can be used to control yaml flow.
variables:
_HelixType: build/product
${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}:
_HelixSource: pr/dotnet/arcade/$(Build.SourceBranch)
${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
# clean the local repo on the build agents
Build.Repository.Clean: true
# Set some variables based on build conditions
# TODO: Remove the Build.DefinitionName check once the github repo goes public
${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest'), contains(variables['Build.DefinitionName'], 'github')) }}:
_HelixType: build/product
_HelixSource: pr/dotnet/winforms/$(Build.SourceBranch)
_PublishType: none
_SignType: test
_DotNetPublishToBlobFeed: false
# else
# TODO: Remove the Build.DefinitionName check once the github repo goes public
${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), not(contains(variables['Build.DefinitionName'], 'github'))) }}:
_TeamName: DotNetCore
_HelixSource: official/dotnet/arcade/$(Build.SourceBranch)
_HelixSource: official/dotnet/winforms/$(Build.SourceBranch)
_PublishType: blob
_SignType: real
_DotNetPublishToBlobFeed: true
resources:
containers:
- container: LinuxContainer
image: microsoft/dotnet-buildtools-prereqs:ubuntu-14.04-cross-0cd4667-20170319080304
# only trigger ci builds for the master branch
trigger:
- master
# To be added in the future when VSTS supports this feature
# only trigger pull request builds for the master branch
# pr:
# - master
# Call the pipeline.yml template, which does the real work
phases:
- template: /eng/build.yml
parameters:
name: Windows_NT
queue:
# For public or PR jobs, use the hosted pool. For internal jobs use the internal pool.
# Will eventually change this to two BYOC pools.
${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}:
name: dotnet-external-temp
${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
name: dotnet-internal-temp
parallel: 2
matrix:
Build_Debug:
_BuildConfig: Debug
_PublishType: none
_SignType: test
_DotNetPublishToBlobFeed : false
Build_Release:
_BuildConfig: Release
# PRs or external builds are not signed.
${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}:
_PublishType: none
_SignType: test
_DotNetPublishToBlobFeed : false
${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
_PublishType: blob
_SignType: real
_DotNetPublishToBlobFeed : true
- template: /eng/build.yml
parameters:
name: Linux
queue:
container: LinuxContainer
${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}:
name: dnceng-linux-external-temp
${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
name: dnceng-linux-internal-temp
parallel: 2
matrix:
Build_Debug:
_BuildConfig: Debug
_PublishType: none
_SignType: none
_DotNetPublishToBlobFeed : false
Build_Release:
_BuildConfig: Release
_PublishType: none
_SignType: none
_DotNetPublishToBlobFeed : false
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
- template: /eng/common/templates/phases/publish-build-assets.yml
parameters:
dependsOn:
- Windows_NT
- Linux
queue:
name: Hosted VS2017
- template: /eng/pipeline.yml
parameters:
# TODO: Remove the Build.DefinitionName check once the github repo goes public
${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), not(contains(variables['Build.DefinitionName'], 'github'))) }}:
# agent pool can't be read from a user-defined variable (Azure DevOps limitation)
agentPool: dotnet-internal-temp
# runAsPublic is used in expressions, which can't read from user-defined variables
runAsPublic: false

Просмотреть файл

@ -9,7 +9,7 @@ parameters:
# variables YAML object - https://github.com/Microsoft/vsts-agent/blob/master/docs/preview/yamlgettingstarted-schema.md#phase
variables: {}
# run this build as a public build, even in the internal project
runAsPublic: true
runAsPublic: false
# Common conditionals: There are a number of common conditionals that are useful. Generally these are used to decide what resources can be accessed,
# or what logic should be applied based on the context the build is being run in.

Просмотреть файл

@ -7,6 +7,14 @@ parameters:
# Optional: name of the phase (not specifying phase name may cause name collisions)
name: ''
# Optional: display name of the phase
displayName: ''
# Optional: condition for the job to run
condition: ''
# Optional: dependencies of the phase
dependsOn: ''
# Required: A defined YAML queue
queue: {}
@ -17,6 +25,10 @@ parameters:
# Optional: variables
variables: {}
# Optional: should run as a public build even in the internal project
# if 'true', the build won't run any of the internal only steps, even if it is running in non-public projects.
runAsPublic: false
## Telemetry variables
# Optional: enable sending telemetry
@ -38,10 +50,19 @@ parameters:
phases:
- phase: ${{ parameters.name }}
${{ if ne(parameters.displayName, '') }}:
displayName: ${{ parameters.displayName }}
${{ if ne(parameters.condition, '') }}:
condition: ${{ parameters.condition }}
${{ if ne(parameters.dependsOn, '') }}:
dependsOn: ${{ parameters.dependsOn }}
queue: ${{ parameters.queue }}
${{ if ne(parameters.variables, '') }}:
variables:
variables:
${{ insert }}: ${{ parameters.variables }}
steps:
@ -56,10 +77,11 @@ phases:
buildConfig: $(_HelixBuildConfig)
helixSource: $(_HelixSource)
helixType: $(_HelixType)
runAsPublic: ${{ parameters.runAsPublic }}
- ${{ if eq(parameters.enableMicrobuild, 'true') }}:
# Internal only resource, and Microbuild signing shouldn't be applied to PRs.
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
- ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
- task: MicroBuildSigningPlugin@2
displayName: Install MicroBuild plugin
inputs:
@ -77,7 +99,7 @@ phases:
- ${{ if eq(parameters.enableMicrobuild, 'true') }}:
# Internal only resources
- ${{ if ne(variables['System.TeamProject'], 'public') }}:
- ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
- task: MicroBuildCleanup@1
displayName: Execute Microbuild cleanup tasks
condition: and(always(), in(variables['_SignType'], 'real', 'test'), eq(variables['Agent.Os'], 'Windows_NT'))
@ -90,7 +112,7 @@ phases:
helixSource: $(_HelixSource)
helixType: $(_HelixType)
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
- ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
- task: CopyFiles@2
displayName: Gather Asset Manifests
inputs:

Просмотреть файл

@ -4,6 +4,7 @@ parameters:
configuration: 'Debug'
condition: succeeded()
continueOnError: false
runAsPublic: false
phases:
- phase: Asset_Registry_Publish
displayName: Publish to Build Asset Registry
@ -12,7 +13,7 @@ phases:
variables:
config: ${{ parameters.configuration }}
steps:
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
- ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
- task: DownloadBuildArtifacts@0
displayName: Download artifact
inputs:

Просмотреть файл

@ -2,9 +2,10 @@ parameters:
helixSource: 'undefined_defaulted_in_telemetry.yml'
helixType: 'undefined_defaulted_in_telemetry.yml'
buildConfig: ''
runAsPublic: false
steps:
- ${{ if not(eq(variables['System.TeamProject'], 'public')) }}:
- ${{ if and(eq(parameters.runAsPublic, 'false'), not(eq(variables['System.TeamProject'], 'public'))) }}:
- task: AzureKeyVault@1
inputs:
azureSubscription: 'HelixProd_KeyVault'

38
eng/pipeline.yml Normal file
Просмотреть файл

@ -0,0 +1,38 @@
parameters:
# Needed because agent pool can't be read from a user-defined variable (Azure DevOps limitation)
# Defaults to dotnet-external-temp
# TODO: CHANGE THIS TO dotnet-external-temp ONCE THE GITHUB REPO GOES PUBLIC
agentPool: dotnet-internal-temp
# Needed because runAsPublic is used in template expressions, which can't read from user-defined variables
# Defaults to true
runAsPublic: true
# Call build.yml, which runs common build tasks
phases:
- template: /eng/build.yml
parameters:
name: Windows_NT
runAsPublic: ${{ parameters.runAsPublic }}
queue:
name: ${{ parameters.agentPool }}
parallel: 99
matrix:
Build_Debug:
_BuildConfig: netcoreapp-Windows_NT-Debug
# overwrite some values when building debug
_PublishType: none
_SignType: test
_DotNetPublishToBlobFeed : false
Build_Release:
_BuildConfig: netcoreapp-Windows_NT-Release
# only publish build assets if we're running internally
- ${{ if eq(parameters.runAsPublic, 'false') }}:
- template: /eng/common/templates/phases/publish-build-assets.yml
parameters:
dependsOn: Windows_NT
queue:
name: Hosted VS2017
configuration: netcoreapp-Windows_NT-Debug