Skip to content

Commit

Permalink
Source-build template default pool fix; clean up parameters (dotnet#6790
Browse files Browse the repository at this point in the history
)

* Rename runSourceBuild -> enableSourceBuild

The 'enable*' properties are more common.

* Set up default container host pool

* Use default platform iff 0 platforms passed
  • Loading branch information
dagood authored and akoeplinger committed Apr 12, 2021
1 parent 8494241 commit 2136755
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 17 deletions.
8 changes: 8 additions & 0 deletions eng/common/templates/job/source-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ parameters:
# container and pool.
platform: {}

# The default VM host AzDO pool. This should be capable of running Docker containers: almost all
# source-build builds run in Docker, including the default managed platform.
defaultContainerHostPool:
vmImage: ubuntu-20.04

jobs:
- job: ${{ parameters.jobNamePrefix }}_${{ parameters.platform.name }}
displayName: Source-Build (${{ parameters.platform.name }})
Expand All @@ -37,6 +42,9 @@ jobs:

${{ if ne(parameters.platform.container, '') }}:
container: ${{ parameters.platform.container }}

${{ if eq(parameters.platform.pool, '') }}:
pool: ${{ parameters.defaultContainerHostPool }}
${{ if ne(parameters.platform.pool, '') }}:
pool: ${{ parameters.platform.pool }}

Expand Down
20 changes: 10 additions & 10 deletions eng/common/templates/jobs/jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@ parameters:

# Optional: Enable publishing using release pipelines
enablePublishUsingPipelines: false


# Optional: Enable running the source-build jobs to build repo from source
enableSourceBuild: false

# Optional: Parameters for source-build template.
# See /eng/common/templates/jobs/source-build.yml for options
sourceBuildParameters: []

graphFileGeneration:
# Optional: Enable generating the graph files at the end of the build
enabled: false
Expand All @@ -24,13 +31,6 @@ parameters:
# if 'true', the build won't run any of the internal only steps, even if it is running in non-public projects.
runAsPublic: false

# Optional: Enable running the source-build jobs to build repo from source
runSourceBuild: false

# Optional: Parameters for source-build template.
# See /eng/common/templates/jobs/source-build.yml for options
sourceBuildParameters: []

enableSourceIndex: false
sourceIndexParams: {}

Expand All @@ -53,7 +53,7 @@ jobs:

name: ${{ job.job }}

- ${{ if eq(parameters.runSourceBuild, true) }}:
- ${{ if eq(parameters.enableSourceBuild, true) }}:
- template: /eng/common/templates/jobs/source-build.yml
parameters:
allCompletedJobId: Source_Build_Complete
Expand All @@ -80,7 +80,7 @@ jobs:
- ${{ if eq(parameters.publishBuildAssetsDependsOn, '') }}:
- ${{ each job in parameters.jobs }}:
- ${{ job.job }}
- ${{ if eq(parameters.runSourceBuild, true) }}:
- ${{ if eq(parameters.enableSourceBuild, true) }}:
- Source_Build_Complete
pool:
vmImage: vs2017-win2016
Expand Down
12 changes: 5 additions & 7 deletions eng/common/templates/jobs/source-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,14 @@ parameters:
# See /eng/common/templates/job/source-build.yml
jobNamePrefix: 'Source_Build'

# If changed to true, causes this template to include the default platform for a managed-only
# repo. The exact Docker image used for this build will be provided by Arcade. This has some risk,
# but since the repo is supposed to be managed-only, the risk should be very low.
includeDefaultManagedPlatform: false
# This is the default platform provided by Arcade, intended for use by a managed-only repo.
defaultManagedPlatform:
name: 'Managed'
container: 'mcr.microsoft.com/dotnet-buildtools/prereqs:centos-7-3e800f1-20190501005343'

# Defines the platforms on which to run build jobs. One job is created for each platform, and the
# object in this array is sent to the job template as 'platform'.
# object in this array is sent to the job template as 'platform'. If no platforms are specified,
# one job runs on 'defaultManagedPlatform'.
platforms: []

jobs:
Expand All @@ -32,7 +30,7 @@ jobs:
dependsOn:
- ${{ each platform in parameters.platforms }}:
- ${{ parameters.jobNamePrefix }}_${{ platform.name }}
- ${{ if eq(parameters.includeDefaultManagedPlatform, true) }}:
- ${{ if eq(length(parameters.platforms), 0) }}:
- ${{ parameters.jobNamePrefix }}_${{ parameters.defaultManagedPlatform.name }}

- ${{ each platform in parameters.platforms }}:
Expand All @@ -41,7 +39,7 @@ jobs:
jobNamePrefix: ${{ parameters.jobNamePrefix }}
platform: ${{ platform }}

- ${{ if eq(parameters.includeDefaultManagedPlatform, true) }}:
- ${{ if eq(length(parameters.platforms), 0) }}:
- template: /eng/common/templates/job/source-build.yml
parameters:
jobNamePrefix: ${{ parameters.jobNamePrefix }}
Expand Down

0 comments on commit 2136755

Please sign in to comment.