Add a PR version of VMR pipelines (#19063)

This commit is contained in:
Přemek Vysoký 2024-03-15 17:10:10 +01:00 committed by GitHub
parent 3384a8d60f
commit bf87f95f44
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 134 additions and 0 deletions

View file

@ -0,0 +1,75 @@
# This yml is used by these pipelines and triggers:
#
# - installer-source-build (public)
# - PR: release/* and main, ultralite build
# - installer-unified-build (public)
# - PR: main, lite build
trigger: none
pr:
branches:
include:
- main
- release/*
exclude:
- release/*.0.2xx
- release/*.0.3xx
- release/*.0.4xx
parameters:
- name: vmrBranch
displayName: dotnet/dotnet branch to push to
type: string
default: ' '
- name: disableBuild
displayName: Skip the VMR Build stage
type: boolean
default: false
variables:
- ${{ if ne(parameters.vmrBranch, ' ') }}:
- name: VmrBranch
value: ${{ replace(parameters.vmrBranch, ' ', '') }}
- ${{ else }}:
- name: VmrBranch
value: ${{ replace(replace(variables['System.PullRequest.TargetBranch'], 'refs/heads/', ''), 'refs/pull/', '') }}
# enable source-only build for pipelines with the -source-build suffix
- name: isSourceOnlyBuild
value: ${{ contains(variables['Build.DefinitionName'], '-source-build') }}
resources:
repositories:
- repository: vmr
type: github
name: dotnet/dotnet
endpoint: dotnet
ref: ${{ variables.VmrBranch }}
stages:
# You can temporarily disable the VMR Build stage by setting the disableBuild variable
- ${{ if not(parameters.disableBuild) }}:
- template: templates/stages/vmr-build.yml
parameters:
vmrBranch: ${{ variables.VmrBranch }}
isBuiltFromVmr: false
isSourceOnlyBuild: ${{ variables.isSourceOnlyBuild }}
${{ if contains(variables['Build.DefinitionName'], '-full') }}:
scope: full
${{ elseif eq(variables.isSourceOnlyBuild, 'true') }}:
scope: ultralite
${{ else }}:
scope: lite
# In case the VMR Build stage is temporarily disabled, the VMR synchronization step is run to validate
# that the PR can be merged and later synchronized into the VMR without problems.
- ${{ else }}:
- stage: Synchronize_VMR
displayName: Synchronize VMR
dependsOn: []
jobs:
- template: templates/jobs/vmr-synchronization.yml
parameters:
vmrBranch: ${{ variables.VmrBranch }}
noPush: true

View file

@ -2,25 +2,30 @@
# NOTE: the triggers are defined in the Azure DevOps UI as they are too complex
#
# - dotnet-source-build (public)
# https://dev.azure.com/dnceng-public/public/_build?definitionId=240
# - PR: ultralite build
# - CI: release/* only, every batched commit, full build
# - Schedule: main only, full build
#
# - dotnet-unified-build (public)
# https://dev.azure.com/dnceng-public/public/_build?definitionId=278
# - PR: lite build
# - CI: release/* only, every batched commit, full build
# - Schedule: main only, full build
#
# - dotnet-source-build (internal)
# https://dev.azure.com/dnceng/internal/_build?definitionId=1219
# - PR: ultralite build
# - CI: release/* and internal/release/* only, every batched commit, full build
# - Schedule: main only, full build
#
# - dotnet-source-build-lite (internal)
# https://dev.azure.com/dnceng/internal/_build?definitionId=1299
# - PR: release/* and main, lite build, on-demand trigger
# - CI: main only, every batched commit, lite build
#
# - dotnet-unified-build (internal)
# https://dev.azure.com/dnceng/internal/_build?definitionId=1330
# - PR: lite build
# - CI: release/*, internal/release/* and main, every batched commit, full build

View file

@ -0,0 +1,54 @@
# This yml is used by these PR pipelines and triggers:
# NOTE: the triggers are defined in the Azure DevOps UI as they are too complex
#
# - dotnet-source-build (public)
# - PR: ultralite build
# - CI: release/* only, every batched commit, full build
# - Schedule: main only, full build
#
# - dotnet-unified-build (public)
# - PR: lite build
# - CI: release/* only, every batched commit, full build
# - Schedule: main only, full build
#
# - dotnet-source-build (internal)
# - PR: ultralite build
#
# - dotnet-source-build-lite (internal)
# - PR: release/* and main, lite build, on-demand trigger
#
# - dotnet-unified-build (internal)
# - PR: lite build
variables:
# enable source-only build for pipelines that contain the -source-build string
- name: isSourceOnlyBuild
value: ${{ contains(variables['Build.DefinitionName'], '-source-build') }}
- name: isSourceOnlyBuildLite
value: ${{ contains(variables['Build.DefinitionName'], '-source-build-lite') }}
- name: isScheduleTrigger
value: ${{ eq(variables['Build.Reason'], 'Schedule') }}
- name: isPRTrigger
value: ${{ eq(variables['Build.Reason'], 'PullRequest') }}
stages:
- ${{ if and(ne(variables.isPRTrigger, 'true'), eq(variables['System.TeamProject'], 'internal')) }}:
- template: templates/stages/vmr-scan.yml
- template: /src/installer/eng/pipelines/templates/stages/vmr-build.yml
parameters:
isBuiltFromVmr: true
isSourceOnlyBuild: ${{ variables.isSourceOnlyBuild }}
${{ if eq(variables.isScheduleTrigger, 'true') }}:
scope: full
${{ elseif eq(variables.isSourceOnlyBuildLite, 'true') }}:
scope: lite
${{ elseif and(eq(variables.isPRTrigger, 'true'), eq(variables.isSourceOnlyBuild, 'true')) }}:
scope: ultralite
${{ elseif and(eq(variables.isPRTrigger, 'true'), ne(variables.isSourceOnlyBuild, 'true')) }}:
scope: lite
${{ else }}:
scope: full