Backport templates-official directory

This commit is contained in:
Phil Allen 2024-08-21 14:57:24 -07:00
Родитель af43e3bcad
Коммит 8a17d35edd
25 изменённых файлов: 331 добавлений и 0 удалений

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

@ -0,0 +1,65 @@
jobs:
- template: /eng/common/core-templates/job/job.yml
parameters:
is1ESPipeline: true
# publish artifacts
# for 1ES managed templates, use the templateContext.output to handle multiple outputs.
templateContext:
outputParentDirectory: $(Build.ArtifactStagingDirectory)
outputs:
- ${{ if ne(parameters.artifacts.publish, '') }}:
- ${{ if and(ne(parameters.artifacts.publish.artifacts, 'false'), ne(parameters.artifacts.publish.artifacts, '')) }}:
- output: buildArtifacts
displayName: Publish pipeline artifacts
PathtoPublish: '$(Build.ArtifactStagingDirectory)/artifacts'
ArtifactName: ${{ coalesce(parameters.artifacts.publish.artifacts.name , 'Artifacts_$(Agent.Os)_$(_BuildConfig)') }}
condition: always()
continueOnError: true
- ${{ if and(ne(parameters.artifacts.publish.logs, 'false'), ne(parameters.artifacts.publish.logs, '')) }}:
- output: pipelineArtifact
targetPath: '$(Build.ArtifactStagingDirectory)/artifacts/log'
artifactName: ${{ coalesce(parameters.artifacts.publish.logs.name, 'Logs_Build_$(Agent.Os)_$(_BuildConfig)_Attempt$(System.JobAttempt)') }}
displayName: 'Publish logs'
continueOnError: true
condition: always()
sbomEnabled: false # we don't need SBOM for logs
- ${{ if eq(parameters.enablePublishBuildArtifacts, true) }}:
- output: buildArtifacts
displayName: Publish Logs
PathtoPublish: '$(Build.ArtifactStagingDirectory)/artifacts/log/$(_BuildConfig)'
publishLocation: Container
ArtifactName: ${{ coalesce(parameters.enablePublishBuildArtifacts.artifactName, '$(Agent.Os)_$(Agent.JobName)' ) }}
continueOnError: true
condition: always()
sbomEnabled: false # we don't need SBOM for logs
- ${{ if eq(parameters.enableBuildRetry, 'true') }}:
- output: pipelineArtifact
targetPath: '$(Build.ArtifactStagingDirectory)/artifacts/eng/common/BuildConfiguration'
artifactName: 'BuildConfiguration'
displayName: 'Publish build retry configuration'
continueOnError: true
sbomEnabled: false # we don't need SBOM for BuildConfiguration
- ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(parameters.enableSbom, 'true')) }}:
- output: pipelineArtifact
displayName: Publish SBOM manifest
continueOnError: true
targetPath: $(Build.ArtifactStagingDirectory)/sbom
artifactName: $(ARTIFACT_NAME)
# add any outputs provided via root yaml
- ${{ if ne(parameters.templateContext.outputs, '') }}:
- ${{ each output in parameters.templateContext.outputs }}:
- ${{ output }}
# add any remaining templateContext properties
${{ each context in parameters.templateContext }}:
${{ if and(ne(context.key, 'outputParentDirectory'), ne(context.key, 'outputs')) }}:
${{ context.key }}: ${{ context.value }}
${{ each parameter in parameters }}:
${{ if and(ne(parameter.key, 'templateContext'), ne(parameter.key, 'is1ESPipeline')) }}:
${{ parameter.key }}: ${{ parameter.value }}

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

@ -0,0 +1,7 @@
jobs:
- template: /eng/common/core-templates/job/onelocbuild.yml
parameters:
is1ESPipeline: true
${{ each parameter in parameters }}:
${{ parameter.key }}: ${{ parameter.value }}

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

@ -0,0 +1,7 @@
jobs:
- template: /eng/common/core-templates/job/publish-build-assets.yml
parameters:
is1ESPipeline: true
${{ each parameter in parameters }}:
${{ parameter.key }}: ${{ parameter.value }}

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

@ -0,0 +1,7 @@
jobs:
- template: /eng/common/core-templates/job/source-build.yml
parameters:
is1ESPipeline: true
${{ each parameter in parameters }}:
${{ parameter.key }}: ${{ parameter.value }}

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

@ -0,0 +1,7 @@
jobs:
- template: /eng/common/core-templates/job/source-index-stage1.yml
parameters:
is1ESPipeline: true
${{ each parameter in parameters }}:
${{ parameter.key }}: ${{ parameter.value }}

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

@ -0,0 +1,7 @@
jobs:
- template: /eng/common/core-templates/jobs/codeql-build.yml
parameters:
is1ESPipeline: true
${{ each parameter in parameters }}:
${{ parameter.key }}: ${{ parameter.value }}

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

@ -0,0 +1,7 @@
jobs:
- template: /eng/common/core-templates/jobs/jobs.yml
parameters:
is1ESPipeline: true
${{ each parameter in parameters }}:
${{ parameter.key }}: ${{ parameter.value }}

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

@ -0,0 +1,7 @@
jobs:
- template: /eng/common/core-templates/jobs/source-build.yml
parameters:
is1ESPipeline: true
${{ each parameter in parameters }}:
${{ parameter.key }}: ${{ parameter.value }}

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

@ -0,0 +1,8 @@
variables:
- template: /eng/common/core-templates/post-build/common-variables.yml
parameters:
# Specifies whether to use 1ES
is1ESPipeline: true
${{ each parameter in parameters }}:
${{ parameter.key }}: ${{ parameter.value }}

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

@ -0,0 +1,8 @@
stages:
- template: /eng/common/core-templates/post-build/post-build.yml
parameters:
# Specifies whether to use 1ES
is1ESPipeline: true
${{ each parameter in parameters }}:
${{ parameter.key }}: ${{ parameter.value }}

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

@ -0,0 +1,8 @@
steps:
- template: /eng/common/core-templates/post-build/setup-maestro-vars.yml
parameters:
# Specifies whether to use 1ES
is1ESPipeline: true
${{ each parameter in parameters }}:
${{ parameter.key }}: ${{ parameter.value }}

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

@ -0,0 +1,7 @@
steps:
- template: /eng/common/core-templates/steps/component-governance.yml
parameters:
is1ESPipeline: true
${{ each parameter in parameters }}:
${{ parameter.key }}: ${{ parameter.value }}

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

@ -0,0 +1,9 @@
# Obtains internal runtime download credentials and populates the 'dotnetbuilds-internal-container-read-token-base64'
# variable with the base64-encoded SAS token, by default
steps:
- template: /eng/common/core-templates/steps/enable-internal-runtimes.yml
parameters:
is1ESPipeline: true
${{ each parameter in parameters }}:
${{ parameter.key }}: ${{ parameter.value }}

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

@ -0,0 +1,7 @@
steps:
- template: /eng/common/core-templates/steps/enable-internal-sources.yml
parameters:
is1ESPipeline: true
${{ each parameter in parameters }}:
${{ parameter.key }}: ${{ parameter.value }}

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

@ -0,0 +1,7 @@
steps:
- template: /eng/common/core-templates/steps/generate-sbom.yml
parameters:
is1ESPipeline: true
${{ each parameter in parameters }}:
${{ parameter.key }}: ${{ parameter.value }}

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

@ -0,0 +1,7 @@
steps:
- template: /eng/common/core-templates/steps/get-delegation-sas.yml
parameters:
is1ESPipeline: true
${{ each parameter in parameters }}:
${{ parameter.key }}: ${{ parameter.value }}

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

@ -0,0 +1,7 @@
steps:
- template: /eng/common/core-templates/steps/get-federated-access-token.yml
parameters:
is1ESPipeline: true
${{ each parameter in parameters }}:
${{ parameter.key }}: ${{ parameter.value }}

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

@ -0,0 +1,41 @@
parameters:
- name: displayName
type: string
default: 'Publish to Build Artifact'
- name: condition
type: string
default: succeeded()
- name: artifactName
type: string
- name: pathToPublish
type: string
- name: continueOnError
type: boolean
default: false
- name: publishLocation
type: string
default: 'Container'
- name: is1ESPipeline
type: boolean
default: true
steps:
- ${{ if ne(parameters.is1ESPipeline, true) }}:
- 'eng/common/templates-official cannot be referenced from a non-1ES managed template': error
- task: 1ES.PublishBuildArtifacts@1
displayName: ${{ parameters.displayName }}
condition: ${{ parameters.condition }}
${{ if parameters.continueOnError }}:
continueOnError: ${{ parameters.continueOnError }}
inputs:
PublishLocation: ${{ parameters.publishLocation }}
PathtoPublish: ${{ parameters.pathToPublish }}
${{ if parameters.artifactName }}:
ArtifactName: ${{ parameters.artifactName }}

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

@ -0,0 +1,7 @@
steps:
- template: /eng/common/core-templates/steps/publish-logs.yml
parameters:
is1ESPipeline: true
${{ each parameter in parameters }}:
${{ parameter.key }}: ${{ parameter.value }}

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

@ -0,0 +1,28 @@
parameters:
- name: is1ESPipeline
type: boolean
default: true
- name: args
type: object
default: {}
steps:
- ${{ if ne(parameters.is1ESPipeline, true) }}:
- 'eng/common/templates-official cannot be referenced from a non-1ES managed template': error
- task: 1ES.PublishPipelineArtifact@1
displayName: ${{ coalesce(parameters.args.displayName, 'Publish to Build Artifact') }}
${{ if parameters.args.condition }}:
condition: ${{ parameters.args.condition }}
${{ else }}:
condition: succeeded()
${{ if parameters.args.continueOnError }}:
continueOnError: ${{ parameters.args.continueOnError }}
inputs:
targetPath: ${{ parameters.args.targetPath }}
${{ if parameters.args.artifactName }}:
artifactName: ${{ parameters.args.artifactName }}
${{ if parameters.args.properties }}:
properties: ${{ parameters.args.properties }}
${{ if parameters.args.sbomEnabled }}:
sbomEnabled: ${{ parameters.args.sbomEnabled }}

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

@ -0,0 +1,7 @@
steps:
- template: /eng/common/core-templates/steps/retain-build.yml
parameters:
is1ESPipeline: true
${{ each parameter in parameters }}:
${{ parameter.key }}: ${{ parameter.value }}

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

@ -0,0 +1,7 @@
steps:
- template: /eng/common/core-templates/steps/send-to-helix.yml
parameters:
is1ESPipeline: true
${{ each parameter in parameters }}:
${{ parameter.key }}: ${{ parameter.value }}

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

@ -0,0 +1,7 @@
steps:
- template: /eng/common/core-templates/steps/source-build.yml
parameters:
is1ESPipeline: true
${{ each parameter in parameters }}:
${{ parameter.key }}: ${{ parameter.value }}

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

@ -0,0 +1,45 @@
# Select a pool provider based off branch name. Anything with branch name containing 'release' must go into an -Svc pool,
# otherwise it should go into the "normal" pools. This separates out the queueing and billing of released branches.
# Motivation:
# Once a given branch of a repository's output has been officially "shipped" once, it is then considered to be COGS
# (Cost of goods sold) and should be moved to a servicing pool provider. This allows both separation of queueing
# (allowing release builds and main PR builds to not intefere with each other) and billing (required for COGS.
# Additionally, the pool provider name itself may be subject to change when the .NET Core Engineering Services
# team needs to move resources around and create new and potentially differently-named pools. Using this template
# file from an Arcade-ified repo helps guard against both having to update one's release/* branches and renaming.
# How to use:
# This yaml assumes your shipped product branches use the naming convention "release/..." (which many do).
# If we find alternate naming conventions in broad usage it can be added to the condition below.
#
# First, import the template in an arcade-ified repo to pick up the variables, e.g.:
#
# variables:
# - template: /eng/common/templates-official/variables/pool-providers.yml
#
# ... then anywhere specifying the pool provider use the runtime variables,
# $(DncEngInternalBuildPool)
#
# pool:
# name: $(DncEngInternalBuildPool)
# image: 1es-windows-2022
variables:
# Coalesce the target and source branches so we know when a PR targets a release branch
# If these variables are somehow missing, fall back to main (tends to have more capacity)
# Any new -Svc alternative pools should have variables added here to allow for splitting work
- name: DncEngInternalBuildPool
value: $[
replace(
replace(
eq(contains(coalesce(variables['System.PullRequest.TargetBranch'], variables['Build.SourceBranch'], 'refs/heads/main'), 'release'), 'true'),
True,
'NetCore1ESPool-Svc-Internal'
),
False,
'NetCore1ESPool-Internal'
)
]

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

@ -0,0 +1,7 @@
variables:
# The Guardian version specified in 'eng/common/sdl/packages.config'. This value must be kept in
# sync with the packages.config file.
- name: DefaultGuardianVersion
value: 0.109.0
- name: GuardianPackagesConfigFile
value: $(Build.SourcesDirectory)\eng\common\sdl\packages.config