From 4264b4f304fab4127ad6a0eeb75923e031dc1ad7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 2 Apr 2026 16:44:05 +0000 Subject: [PATCH 1/2] Use pipelineymlgen to share container definitions Create pr.gen.yml to generate both pr-pipeline.yml and pr-outerloop-pipeline.yml from a single source, using inlineif for the outerloop vs innerloop differences. Create rolling.gen.yml to generate both rolling-innerloop-pipeline.yml and rolling-pipeline.yml from a single source, using inlineif for the innerloop- specific parameters section and builder flags. Also fix a duplicate entry in variables/codeql.yml. --- eng/_util/go.mod | 2 +- eng/_util/go.sum | 4 +- eng/pipeline/data/containers.yml | 10 +++ eng/pipeline/pr-outerloop-pipeline.yml | 22 +++--- eng/pipeline/pr-pipeline.yml | 19 ++--- eng/pipeline/pr.gen.yml | 49 +++++++++++++ eng/pipeline/rolling-innerloop-pipeline.yml | 17 ++--- eng/pipeline/rolling-pipeline.yml | 16 +++-- eng/pipeline/rolling.gen.yml | 78 +++++++++++++++++++++ eng/pipeline/variables/codeql.yml | 2 - 10 files changed, 178 insertions(+), 41 deletions(-) create mode 100644 eng/pipeline/data/containers.yml create mode 100644 eng/pipeline/pr.gen.yml create mode 100644 eng/pipeline/rolling.gen.yml diff --git a/eng/_util/go.mod b/eng/_util/go.mod index 60e6ad8fc03..8e405ed4fba 100644 --- a/eng/_util/go.mod +++ b/eng/_util/go.mod @@ -8,7 +8,7 @@ go 1.25.0 require ( github.com/golang-jwt/jwt/v5 v5.3.1 - github.com/microsoft/go-infra v0.0.10-0.20260411064856-24be3e9cffcc + github.com/microsoft/go-infra v0.0.10-0.20260420165249-d41a92f0b571 github.com/microsoft/go-infra/goinstallscript v1.2.0 golang.org/x/net v0.53.0 ) diff --git a/eng/_util/go.sum b/eng/_util/go.sum index 81a5ae3cd83..eb511d93883 100644 --- a/eng/_util/go.sum +++ b/eng/_util/go.sum @@ -31,8 +31,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/microsoft/azure-devops-go-api/azuredevops v1.0.0-b5 h1:YH424zrwLTlyHSH/GzLMJeu5zhYVZSx5RQxGKm1h96s= github.com/microsoft/azure-devops-go-api/azuredevops v1.0.0-b5/go.mod h1:PoGiBqKSQK1vIfQ+yVaFcGjDySHvym6FM1cNYnwzbrY= -github.com/microsoft/go-infra v0.0.10-0.20260411064856-24be3e9cffcc h1:30J8WxjqbdWfBhQ1e3qoWFCj/nzySj6BfpHTbCkj62s= -github.com/microsoft/go-infra v0.0.10-0.20260411064856-24be3e9cffcc/go.mod h1:DST10Gfood7K6NWquhn+jY3/NABtvlyeRjG5oEFNiVE= +github.com/microsoft/go-infra v0.0.10-0.20260420165249-d41a92f0b571 h1:9FWo2PHJ6HGLPYF4VP6DupIeA0YN39xg9c4hnn75L+E= +github.com/microsoft/go-infra v0.0.10-0.20260420165249-d41a92f0b571/go.mod h1:DST10Gfood7K6NWquhn+jY3/NABtvlyeRjG5oEFNiVE= github.com/microsoft/go-infra/goinstallscript v1.2.0 h1:ArYnZHsmv0jnpeDZdFACBUxSmhmYl+Vof8sfk19aYZI= github.com/microsoft/go-infra/goinstallscript v1.2.0/go.mod h1:SFsdKAEHdmGsGoh8FkksVaxoQ3rnnJ/TBqN09Ml/0Cw= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= diff --git a/eng/pipeline/data/containers.yml b/eng/pipeline/data/containers.yml new file mode 100644 index 00000000000..55cd66438aa --- /dev/null +++ b/eng/pipeline/data/containers.yml @@ -0,0 +1,10 @@ +# Containers used in pipelines. This data template can be used with pipelineymlgen +# to generate the right format for "real" AzDO pipelines and 1ES pipelines. +- container: ubuntu2204 + image: mcr.microsoft.com/microsoft-go/infra-images:ubuntu-22.04-amd64-default +- container: mariner2 + image: mcr.microsoft.com/microsoft-go/infra-images:cbl-mariner-2.0-amd64-default +- container: mariner2arm64 + image: mcr.microsoft.com/microsoft-go/infra-images:cbl-mariner-2.0-arm64-default +- container: azurelinux3 + image: mcr.microsoft.com/microsoft-go/infra-images:azurelinux-3.0-amd64-default diff --git a/eng/pipeline/pr-outerloop-pipeline.yml b/eng/pipeline/pr-outerloop-pipeline.yml index 39003c269c5..b7c7a02c614 100644 --- a/eng/pipeline/pr-outerloop-pipeline.yml +++ b/eng/pipeline/pr-outerloop-pipeline.yml @@ -1,26 +1,25 @@ +# Code generated by pipelineymlgen; DO NOT EDIT. +# Origin file: pr.gen.yml + # Copyright (c) Microsoft Corporation. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. -# This pipeline can be triggered via PR comment to run outerloop builders. +# PR validation pipelines: innerloop and outerloop. +# The outerloop pipeline can be triggered via PR comment to run outerloop builders. +# The outerloop pipeline definition must be adjusted using the AzDO UI to require +# a comment before running the build. There is unfortunately no way to configure +# this from YAML. -# https://dev.azure.com/dnceng-public/public/_build?definitionId=192 +# innerloop: https://dev.azure.com/dnceng-public/public/_build?definitionId=191 +# outerloop: https://dev.azure.com/dnceng-public/public/_build?definitionId=192 trigger: none pr: - # Configure this pipeline to *potentially* run on any Microsoft-maintained branch. The pattern - # allows commands like "/azp run" to find this pipeline. - # - # Note: if all we did was configure "pr:", this pipeline would be triggered *by default* on any - # new PR. To make the pipeline run on demand, the pipeline definition must be adjusted using the - # AzDO UI to require a comment before running the build. There is unfortunately no way to - # configure this from YAML. - microsoft/* - dev/* - variables: - template: variables/pipeline.yml - resources: containers: - container: ubuntu2204 @@ -31,7 +30,6 @@ resources: image: mcr.microsoft.com/microsoft-go/infra-images:cbl-mariner-2.0-arm64-default - container: azurelinux3 image: mcr.microsoft.com/microsoft-go/infra-images:azurelinux-3.0-amd64-default - stages: - template: stages/go-builder-matrix-stages.yml parameters: diff --git a/eng/pipeline/pr-pipeline.yml b/eng/pipeline/pr-pipeline.yml index 8fdc2ed9bbf..072005a908e 100644 --- a/eng/pipeline/pr-pipeline.yml +++ b/eng/pipeline/pr-pipeline.yml @@ -1,25 +1,27 @@ +# Code generated by pipelineymlgen; DO NOT EDIT. +# Origin file: pr.gen.yml + # Copyright (c) Microsoft Corporation. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. -# This pipeline validates PRs. It builds Go and runs inner loop tests. +# PR validation pipelines: innerloop and outerloop. +# The outerloop pipeline can be triggered via PR comment to run outerloop builders. +# The outerloop pipeline definition must be adjusted using the AzDO UI to require +# a comment before running the build. There is unfortunately no way to configure +# this from YAML. -# https://dev.azure.com/dnceng-public/public/_build?definitionId=191 +# innerloop: https://dev.azure.com/dnceng-public/public/_build?definitionId=191 +# outerloop: https://dev.azure.com/dnceng-public/public/_build?definitionId=192 trigger: none pr: - microsoft/* - dev/* - variables: - template: variables/pipeline.yml - resources: containers: - # Predefine named containers. Using "container:" inside the job would work, because this is not - # 1ES PT. However, to share code, use the same names here. Unfortunately the format used here - # (container: ... image: ...) is not the same as the one 1ES PT uses, so updating these requires - # separate changes. - container: ubuntu2204 image: mcr.microsoft.com/microsoft-go/infra-images:ubuntu-22.04-amd64-default - container: mariner2 @@ -28,7 +30,6 @@ resources: image: mcr.microsoft.com/microsoft-go/infra-images:cbl-mariner-2.0-arm64-default - container: azurelinux3 image: mcr.microsoft.com/microsoft-go/infra-images:azurelinux-3.0-amd64-default - stages: - template: stages/go-builder-matrix-stages.yml parameters: diff --git a/eng/pipeline/pr.gen.yml b/eng/pipeline/pr.gen.yml new file mode 100644 index 00000000000..67ee00a8ffd --- /dev/null +++ b/eng/pipeline/pr.gen.yml @@ -0,0 +1,49 @@ +# Copyright (c) Microsoft Corporation. +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file. + +# PR validation pipelines: innerloop and outerloop. +# The outerloop pipeline can be triggered via PR comment to run outerloop builders. +# The outerloop pipeline definition must be adjusted using the AzDO UI to require +# a comment before running the build. There is unfortunately no way to configure +# this from YAML. + +# innerloop: https://dev.azure.com/dnceng-public/public/_build?definitionId=191 +# outerloop: https://dev.azure.com/dnceng-public/public/_build?definitionId=192 + +pipelineymlgen: + data: + containers: + ${ inlinetemplate "data/containers.yml" } + output: + - file: pr-pipeline.yml + data: + outerloop: false + - file: pr-outerloop-pipeline.yml + data: + outerloop: true +--- + +trigger: none +pr: + - microsoft/* + - dev/* + +variables: + - template: variables/pipeline.yml + +resources: + containers: + - ${ inlinerange .containers }: + - container: ${ .container } + image: ${ .image } + +stages: + - template: stages/go-builder-matrix-stages.yml + parameters: + ctx: {} + ${ inlineif .outerloop }: + outerloop: true + ${ inlineelse }: + innerloop: true + buildandpack: true diff --git a/eng/pipeline/rolling-innerloop-pipeline.yml b/eng/pipeline/rolling-innerloop-pipeline.yml index 1f7b0232784..777c48d8c89 100644 --- a/eng/pipeline/rolling-innerloop-pipeline.yml +++ b/eng/pipeline/rolling-innerloop-pipeline.yml @@ -1,11 +1,17 @@ +# Code generated by pipelineymlgen; DO NOT EDIT. +# Origin file: rolling.gen.yml + # Copyright (c) Microsoft Corporation. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. -# This pipeline runs innerloop (reliable, relatively quick) tests on rolling builds. -# The intent is that if this pipeline fails, it should block official release for a good reason. +# Rolling test pipelines: innerloop and outerloop. +# The innerloop pipeline runs reliable, relatively quick tests. +# If the innerloop pipeline fails, it should block official release for a good reason. +# The outerloop pipeline runs tests that may be unreliable or very slow. -# https://dev.azure.com/dnceng/internal/_build?definitionId=1342 +# innerloop: https://dev.azure.com/dnceng/internal/_build?definitionId=1342 +# outerloop: https://dev.azure.com/dnceng/internal/_build?definitionId=987 trigger: batch: true @@ -14,24 +20,20 @@ trigger: - microsoft/* - dev/official/* pr: none - parameters: # By default, don't use the shared, potentially constrained linux-arm64 pool. - name: includeArm64Host displayName: 'Include Linux arm64 host builders' type: boolean default: false - variables: - template: variables/pipeline.yml - resources: repositories: - repository: 1ESPipelineTemplates type: git name: 1ESPipelineTemplates/1ESPipelineTemplates ref: refs/tags/release - extends: template: v1/1ES.Unofficial.PipelineTemplate.yml@1ESPipelineTemplates parameters: @@ -51,7 +53,6 @@ extends: image: mcr.microsoft.com/microsoft-go/infra-images:cbl-mariner-2.0-arm64-default azurelinux3: image: mcr.microsoft.com/microsoft-go/infra-images:azurelinux-3.0-amd64-default - stages: - template: stages/go-builder-matrix-stages.yml parameters: diff --git a/eng/pipeline/rolling-pipeline.yml b/eng/pipeline/rolling-pipeline.yml index fdb49aeb640..c273f0050bd 100644 --- a/eng/pipeline/rolling-pipeline.yml +++ b/eng/pipeline/rolling-pipeline.yml @@ -1,11 +1,17 @@ +# Code generated by pipelineymlgen; DO NOT EDIT. +# Origin file: rolling.gen.yml + # Copyright (c) Microsoft Corporation. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. -# This pipeline runs rolling builders that include tests that may be unreliable or very slow. -# If a test is reliable/fast, it should be run by rolling-innerloop-pipeline.yml. +# Rolling test pipelines: innerloop and outerloop. +# The innerloop pipeline runs reliable, relatively quick tests. +# If the innerloop pipeline fails, it should block official release for a good reason. +# The outerloop pipeline runs tests that may be unreliable or very slow. -# https://dev.azure.com/dnceng/internal/_build?definitionId=987 +# innerloop: https://dev.azure.com/dnceng/internal/_build?definitionId=1342 +# outerloop: https://dev.azure.com/dnceng/internal/_build?definitionId=987 trigger: batch: true @@ -14,17 +20,14 @@ trigger: - microsoft/* - dev/official/* pr: none - variables: - template: variables/pipeline.yml - resources: repositories: - repository: 1ESPipelineTemplates type: git name: 1ESPipelineTemplates/1ESPipelineTemplates ref: refs/tags/release - extends: template: v1/1ES.Unofficial.PipelineTemplate.yml@1ESPipelineTemplates parameters: @@ -44,7 +47,6 @@ extends: image: mcr.microsoft.com/microsoft-go/infra-images:cbl-mariner-2.0-arm64-default azurelinux3: image: mcr.microsoft.com/microsoft-go/infra-images:azurelinux-3.0-amd64-default - stages: - template: stages/go-builder-matrix-stages.yml parameters: diff --git a/eng/pipeline/rolling.gen.yml b/eng/pipeline/rolling.gen.yml new file mode 100644 index 00000000000..4cf89cc9e24 --- /dev/null +++ b/eng/pipeline/rolling.gen.yml @@ -0,0 +1,78 @@ +# Copyright (c) Microsoft Corporation. +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file. + +# Rolling test pipelines: innerloop and outerloop. +# The innerloop pipeline runs reliable, relatively quick tests. +# If the innerloop pipeline fails, it should block official release for a good reason. +# The outerloop pipeline runs tests that may be unreliable or very slow. + +# innerloop: https://dev.azure.com/dnceng/internal/_build?definitionId=1342 +# outerloop: https://dev.azure.com/dnceng/internal/_build?definitionId=987 + +pipelineymlgen: + data: + containers: + ${ inlinetemplate "data/containers.yml" } + output: + - file: rolling-innerloop-pipeline.yml + data: + innerloop: true + - file: rolling-pipeline.yml + data: + innerloop: false +--- + +trigger: + batch: true + branches: + include: + - microsoft/* + - dev/official/* +pr: none + +${ inlineif .innerloop }: + parameters: + # By default, don't use the shared, potentially constrained linux-arm64 pool. + - name: includeArm64Host + displayName: 'Include Linux arm64 host builders' + type: boolean + default: false + +variables: + - template: variables/pipeline.yml + +resources: + repositories: + - repository: 1ESPipelineTemplates + type: git + name: 1ESPipelineTemplates/1ESPipelineTemplates + ref: refs/tags/release + +extends: + template: v1/1ES.Unofficial.PipelineTemplate.yml@1ESPipelineTemplates + parameters: + sdl: + sourceAnalysisPool: + name: NetCore1ESPool-Internal + image: 1es-windows-2022 + os: windows + suppression: + suppressionFile: $(Build.SourcesDirectory)/.config/guardian/.gdnsuppress + containers: + ${ inlinerange .containers }: + ${ .container }: + image: ${ .image } + + stages: + - template: stages/go-builder-matrix-stages.yml + parameters: + ctx: {} + ${ inlineif .innerloop }: + innerloop: true + # Include buildandpack builders. The official internal build uses slightly different build + # machines than this pipeline. This one tests against our minimum requirements. + buildandpack: true + includeArm64Host: ${{ parameters.includeArm64Host }} + ${ inlineelse }: + outerloop: true diff --git a/eng/pipeline/variables/codeql.yml b/eng/pipeline/variables/codeql.yml index 599ade703db..78992edc543 100644 --- a/eng/pipeline/variables/codeql.yml +++ b/eng/pipeline/variables/codeql.yml @@ -7,5 +7,3 @@ variables: value: true - name: Codeql.PublishDatabaseLog value: true - - name: Codeql.PublishDatabaseLog - value: true From efa2b65a8c7355831bc1a2cbd920c4220f00fd98 Mon Sep 17 00:00:00 2001 From: Davis Goodin Date: Mon, 20 Apr 2026 10:07:26 -0700 Subject: [PATCH 2/2] Simplify pool.yml template chain MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace the 3-file pool chain (pool.yml → pool-1.yml → pool-2.yml) with a single pool.gen.yml that generates pool.yml. The chain existed because AzDO template expressions can't compute a value and reuse it. pipelineymlgen data variables define the repeated expressions once and expand them in the generated output. --- eng/pipeline/stages/pool-1.yml | 43 ------------- eng/pipeline/stages/pool-2.yml | 64 ------------------- eng/pipeline/stages/pool-netcore.yml | 15 +++++ eng/pipeline/stages/pool.gen.yml | 84 +++++++++++++++++++++++++ eng/pipeline/stages/pool.yml | 91 ++++++++++++++++++++++------ 5 files changed, 171 insertions(+), 126 deletions(-) delete mode 100644 eng/pipeline/stages/pool-1.yml delete mode 100644 eng/pipeline/stages/pool-2.yml create mode 100644 eng/pipeline/stages/pool-netcore.yml create mode 100644 eng/pipeline/stages/pool.gen.yml diff --git a/eng/pipeline/stages/pool-1.yml b/eng/pipeline/stages/pool-1.yml deleted file mode 100644 index 5a2a095f08f..00000000000 --- a/eng/pipeline/stages/pool-1.yml +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright (c) Microsoft Corporation. -# Use of this source code is governed by a BSD-style -# license that can be found in the LICENSE file. - -parameters: - - name: ctx - type: object - - - name: inner - type: object - - - name: public - type: boolean - - name: servicing - type: boolean - - name: os - type: string - - name: hostArch - type: string - - name: distro - type: string - -stages: - - template: pool-2.yml - parameters: - ${{ insert }}: ${{ parameters }} - - ${{ if eq(parameters.os, 'darwin') }}: - name: Azure Pipelines # use the default AzDo hosted pool - ${{ elseif and(eq(parameters.hostArch, 'arm64'), eq(parameters.os, 'linux')) }}: - name: Docker-Linux-Arm-Internal - ${{ else }}: - ${{ if parameters.public }}: - # https://github.com/dotnet/arcade/blob/0db07252ccb18afdf94820ba6125da6de729ec04/Documentation/AzureDevOps/AzureDevOpsOnboarding.md#agent-queues - ${{ if parameters.servicing }}: - name: NetCore-Svc-Public - ${{ else }}: - name: NetCore-Public - ${{ else }}: - ${{ if parameters.servicing }}: - name: netcore1espool-svc-internal - ${{ else }}: - name: netcore1espool-internal diff --git a/eng/pipeline/stages/pool-2.yml b/eng/pipeline/stages/pool-2.yml deleted file mode 100644 index c560822a1b0..00000000000 --- a/eng/pipeline/stages/pool-2.yml +++ /dev/null @@ -1,64 +0,0 @@ -# Copyright (c) Microsoft Corporation. -# Use of this source code is governed by a BSD-style -# license that can be found in the LICENSE file. - -parameters: - - name: ctx - type: object - - - name: inner - type: object - - - name: public - type: boolean - - name: servicing - type: boolean - - name: os - type: string - - name: hostArch - type: string - - name: distro - type: string - - - name: name - type: string - -stages: - - template: ${{ parameters.inner.template }} - parameters: - ${{ insert }}: ${{ parameters.inner.parameters }} - - pool: - name: ${{ parameters.name }} - - ${{ if eq(parameters.os, 'windows') }}: - ${{ if parameters.ctx['Go1ESOfficial'] }}: - image: 1es-windows-${{ parameters.distro }} - os: windows - ${{ elseif parameters.public }}: - # https://helix.dot.net/#1esPools - demands: ImageOverride -equals 1es-windows-${{ parameters.distro }}-open - ${{ else }}: - demands: ImageOverride -equals 1es-windows-${{ parameters.distro }} - os: windows - - ${{ elseif eq(parameters.os, 'linux') }}: - # The arm64 pool doesn't need demands: it runs on a uniform pool. - ${{ if ne(parameters.name, 'Docker-Linux-Arm-Internal') }}: - ${{ if parameters.ctx['Go1ESOfficial'] }}: - image: 1es-ubuntu-2204 - os: linux - ${{ elseif parameters.public }}: - demands: ImageOverride -equals build.ubuntu.2204.amd64.open - ${{ else }}: - demands: ImageOverride -equals 1es-ubuntu-2204 - os: linux - - ${{ elseif eq(parameters.os, 'darwin') }}: - # https://learn.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops&tabs=yaml#software - ${{ if eq(parameters.hostArch, 'amd64') }}: - vmImage: 'macos-14' - os: macOS - ${{ else }}: - vmImage: 'macos-15-arm64' - os: macOS diff --git a/eng/pipeline/stages/pool-netcore.yml b/eng/pipeline/stages/pool-netcore.yml new file mode 100644 index 00000000000..b6733c30b2e --- /dev/null +++ b/eng/pipeline/stages/pool-netcore.yml @@ -0,0 +1,15 @@ +# Copyright (c) Microsoft Corporation. +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file. + +# The correct dnceng pool name based on the current AzDO project and branch. +${{ if ${ .isPublicExpr } }}: + ${{ if ${ .isServicingExpr } }}: + name: NetCore-Svc-Public + ${{ else }}: + name: NetCore-Public +${{ else }}: + ${{ if ${ .isServicingExpr } }}: + name: netcore1espool-svc-internal + ${{ else }}: + name: netcore1espool-internal diff --git a/eng/pipeline/stages/pool.gen.yml b/eng/pipeline/stages/pool.gen.yml new file mode 100644 index 00000000000..35e7c41cfac --- /dev/null +++ b/eng/pipeline/stages/pool.gen.yml @@ -0,0 +1,84 @@ +# Copyright (c) Microsoft Corporation. +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file. + +# This template determines the correct pool names and agent demands based on the +# current branch and AzDO project and passes them into the provided inner stages +# template. +# +# Previously, this was a 3-file chain (pool.yml -> pool-1.yml -> pool-2.yml) +# because AzDO template expressions can't compute a value and reuse it later in +# the same file. pipelineymlgen lets us define expressions once as data +# variables and expand them in the generated output, so all the logic is here. + +pipelineymlgen: + data: + # Shorthand for AzDO expressions that are reused multiple times below. + + # "public" (vs. internal) AzDO project. + isPublicExpr: "eq(variables['System.TeamProject'], 'public')" + # "servicing" (vs. R&D) branch. + isServicingExpr: "startsWith(variables['Build.SourceBranch'], 'refs/heads/microsoft/release-branch')" + + osExpr: "parameters.inner.parameters.builder.os" + hostArchExpr: "parameters.inner.parameters.builder.hostArch" + distroExpr: "parameters.inner.parameters.builder.distro" + output: self +--- + +parameters: + - name: ctx + type: object + + # The inner template: { template string, parameters object } + # Note: the template path is relative to this file (inside "stages/"), not the caller's file path. + - name: inner + type: object + +stages: + - template: ${{ parameters.inner.template }} + parameters: + ${{ insert }}: ${{ parameters.inner.parameters }} + + pool: + # --- darwin: use Azure Pipelines hosted pool --- + ${{ if eq(${ .osExpr }, 'darwin') }}: + name: Azure Pipelines + # https://learn.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops&tabs=yaml#software + ${{ if eq(${ .hostArchExpr }, 'amd64') }}: + vmImage: 'macos-14' + ${{ else }}: + vmImage: 'macos-15-arm64' + os: macOS + + # --- linux --- + ${{ elseif eq(${ .osExpr }, 'linux') }}: + # arm64 host: dedicated uniform pool, no demands needed. + ${{ if eq(${ .hostArchExpr }, 'arm64') }}: + name: Docker-Linux-Arm-Internal + # amd64 host: needs pool name and demands. + ${{ else }}: + ${ inlinetemplate "pool-netcore.yml" }: + # Pool image/demands + ${{ if parameters.ctx['Go1ESOfficial'] }}: + image: 1es-ubuntu-2204 + os: linux + ${{ elseif ${ .isPublicExpr } }}: + demands: ImageOverride -equals build.ubuntu.2204.amd64.open + ${{ else }}: + demands: ImageOverride -equals 1es-ubuntu-2204 + os: linux + + # --- windows (default) --- + ${{ else }}: + ${ inlinetemplate "pool-netcore.yml" }: + # Pool image/demands + # https://helix.dot.net/#1esPools + ${{ if parameters.ctx['Go1ESOfficial'] }}: + image: 1es-windows-${{ ${ .distroExpr } }} + os: windows + ${{ elseif ${ .isPublicExpr } }}: + demands: ImageOverride -equals 1es-windows-${{ ${ .distroExpr } }}-open + ${{ else }}: + demands: ImageOverride -equals 1es-windows-${{ ${ .distroExpr } }} + os: windows diff --git a/eng/pipeline/stages/pool.yml b/eng/pipeline/stages/pool.yml index 4d9441442f9..7fa70d27069 100644 --- a/eng/pipeline/stages/pool.yml +++ b/eng/pipeline/stages/pool.yml @@ -1,34 +1,87 @@ +# Code generated by pipelineymlgen; DO NOT EDIT. +# Origin file: pool.gen.yml + # Copyright (c) Microsoft Corporation. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. -# This template determines the correct pool names and agent demands based on the current branch and -# AzDO project and passes them into the provided inner stages template. -# -# This is the entrypoint for pool*.yml. -# -# The "public" (vs. internal) and "servicing" (vs. R&D) conditions are evaluated here and then -# passed into an inner template so the values can be reused to determine the pools to use. +# This template determines the correct pool names and agent demands based on the +# current branch and AzDO project and passes them into the provided inner stages +# template. # -# The numbered pool templates map parameters to pool names and demands and the reasons behind the -# choices. Each pool*.yml feeds more information into the next one. +# Previously, this was a 3-file chain (pool.yml -> pool-1.yml -> pool-2.yml) +# because AzDO template expressions can't compute a value and reuse it later in +# the same file. pipelineymlgen lets us define expressions once as data +# variables and expand them in the generated output, so all the logic is here. parameters: - name: ctx type: object - # The inner template: { template string, parameters object } # Note: the template path is relative to this file (inside "stages/"), not the caller's file path. - name: inner type: object - stages: - - template: pool-1.yml + - template: ${{ parameters.inner.template }} parameters: - ctx: ${{ parameters.ctx }} - public: ${{ eq(variables['System.TeamProject'], 'public') }} - servicing: ${{ startsWith(variables['Build.SourceBranch'], 'refs/heads/microsoft/release-branch') }} - os: ${{ parameters.inner.parameters.builder.os }} - hostArch: ${{ parameters.inner.parameters.builder.hostArch }} - distro: ${{ parameters.inner.parameters.builder.distro }} - inner: ${{ parameters.inner }} + ${{ insert }}: ${{ parameters.inner.parameters }} + pool: + # --- darwin: use Azure Pipelines hosted pool --- + ${{ if eq(parameters.inner.parameters.builder.os, 'darwin') }}: + name: Azure Pipelines + # https://learn.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops&tabs=yaml#software + ${{ if eq(parameters.inner.parameters.builder.hostArch, 'amd64') }}: + vmImage: 'macos-14' + ${{ else }}: + vmImage: 'macos-15-arm64' + os: macOS + # --- linux --- + ${{ elseif eq(parameters.inner.parameters.builder.os, 'linux') }}: + # arm64 host: dedicated uniform pool, no demands needed. + ${{ if eq(parameters.inner.parameters.builder.hostArch, 'arm64') }}: + name: Docker-Linux-Arm-Internal + # amd64 host: needs pool name and demands. + ${{ else }}: + # The correct dnceng pool name based on the current AzDO project and branch. + ${{ if eq(variables['System.TeamProject'], 'public') }}: + ${{ if startsWith(variables['Build.SourceBranch'], 'refs/heads/microsoft/release-branch') }}: + name: NetCore-Svc-Public + ${{ else }}: + name: NetCore-Public + ${{ else }}: + ${{ if startsWith(variables['Build.SourceBranch'], 'refs/heads/microsoft/release-branch') }}: + name: netcore1espool-svc-internal + ${{ else }}: + name: netcore1espool-internal + # Pool image/demands + ${{ if parameters.ctx['Go1ESOfficial'] }}: + image: 1es-ubuntu-2204 + os: linux + ${{ elseif eq(variables['System.TeamProject'], 'public') }}: + demands: ImageOverride -equals build.ubuntu.2204.amd64.open + ${{ else }}: + demands: ImageOverride -equals 1es-ubuntu-2204 + os: linux + # --- windows (default) --- + ${{ else }}: + # The correct dnceng pool name based on the current AzDO project and branch. + ${{ if eq(variables['System.TeamProject'], 'public') }}: + ${{ if startsWith(variables['Build.SourceBranch'], 'refs/heads/microsoft/release-branch') }}: + name: NetCore-Svc-Public + ${{ else }}: + name: NetCore-Public + ${{ else }}: + ${{ if startsWith(variables['Build.SourceBranch'], 'refs/heads/microsoft/release-branch') }}: + name: netcore1espool-svc-internal + ${{ else }}: + name: netcore1espool-internal + # Pool image/demands + # https://helix.dot.net/#1esPools + ${{ if parameters.ctx['Go1ESOfficial'] }}: + image: 1es-windows-${{ parameters.inner.parameters.builder.distro }} + os: windows + ${{ elseif eq(variables['System.TeamProject'], 'public') }}: + demands: ImageOverride -equals 1es-windows-${{ parameters.inner.parameters.builder.distro }}-open + ${{ else }}: + demands: ImageOverride -equals 1es-windows-${{ parameters.inner.parameters.builder.distro }} + os: windows