2022-05-18 04:16:58 +03:00
|
|
|
# Configure which branches trigger builds
|
|
|
|
trigger:
|
|
|
|
batch: true
|
|
|
|
branches:
|
|
|
|
include:
|
2024-08-12 18:57:54 +03:00
|
|
|
- internal/release/8.0
|
2022-10-04 20:42:02 +03:00
|
|
|
|
2022-05-19 22:45:12 +03:00
|
|
|
parameters:
|
|
|
|
# Run the pipeline manually (usually disallowed)
|
|
|
|
- name: manualRun
|
|
|
|
default: false
|
|
|
|
displayName: Are you sure you want to run this pipeline manually?
|
|
|
|
type: boolean
|
2022-05-18 04:16:58 +03:00
|
|
|
|
|
|
|
variables:
|
2023-02-09 05:49:01 +03:00
|
|
|
- group: Mirror-Credentials
|
|
|
|
- template: /eng/common/templates/variables/pool-providers.yml
|
2022-05-18 04:16:58 +03:00
|
|
|
|
|
|
|
# Merges code from one AzDO branch into another
|
|
|
|
jobs:
|
2022-05-19 22:45:12 +03:00
|
|
|
- ${{ if and(contains(variables['Build.SourceBranch'], 'internal'), or(eq(variables['Build.Reason'], 'BatchedCI'), eq(parameters.manualRun, 'true'))) }}:
|
|
|
|
- template: /eng/common/templates/jobs/jobs.yml
|
|
|
|
parameters:
|
|
|
|
enableTelemetry: true
|
|
|
|
helixRepo: dotnet/aspnetcore
|
|
|
|
jobs:
|
|
|
|
- job: Merge_Azure_DevOps_Branches
|
|
|
|
enableSBOM: false
|
|
|
|
pool:
|
2023-02-09 05:49:01 +03:00
|
|
|
name: $(DncEngInternalBuildPool)
|
2022-10-04 20:42:02 +03:00
|
|
|
demands: ImageOverride -equals 1es-windows-2019
|
2022-05-19 22:45:12 +03:00
|
|
|
variables:
|
|
|
|
- name: WorkingDirectoryName
|
|
|
|
value: repo-dir
|
|
|
|
- name: AzdoRepo
|
|
|
|
value: dotnet-aspnetcore
|
|
|
|
steps:
|
2022-06-11 03:09:15 +03:00
|
|
|
- powershell: |
|
|
|
|
$branch = "$(Build.SourceBranch)".Replace("refs/heads/", "");
|
|
|
|
$suffix = "-nonstable"
|
|
|
|
Write-Host "##vso[task.setvariable variable=BranchToMirror]$branch"
|
2022-06-12 20:15:02 +03:00
|
|
|
Write-Host "##vso[task.setvariable variable=TargetBranchName]$branch$suffix"
|
2022-06-11 03:09:15 +03:00
|
|
|
displayName: Calculate Mirrored Branch Names
|
2022-05-19 22:45:12 +03:00
|
|
|
- script: |
|
|
|
|
git clone https://dn-bot:$(dn-bot-dnceng-build-rw-code-rw)@dev.azure.com/dnceng/internal/_git/$(AzdoRepo) $(WorkingDirectoryName) --recursive --no-tags --branch $(TargetBranchName)
|
|
|
|
displayName: Clone AzDO repo
|
|
|
|
- script: |
|
|
|
|
git -c user.email="dotnet-bot@microsoft.com" -c user.name="dotnet-bot" merge origin/$(BranchToMirror) -m "Merge in '$(BranchToMirror)' changes"
|
|
|
|
displayName: Merge head branch to target branch
|
|
|
|
workingDirectory: $(WorkingDirectoryName)
|
|
|
|
- script: |
|
|
|
|
git push origin $(TargetBranchName)
|
|
|
|
displayName: Push changes to Azure DevOps repo
|
2022-05-18 04:16:58 +03:00
|
|
|
workingDirectory: $(WorkingDirectoryName)
|
|
|
|
|
2022-05-19 22:45:12 +03:00
|
|
|
- task: PowerShell@1
|
|
|
|
displayName: Broadcast target, branch, commit in metadata
|
|
|
|
continueOnError: true
|
|
|
|
condition: always()
|
|
|
|
inputs:
|
|
|
|
scriptType: inlineScript
|
|
|
|
arguments: '$(BranchToMirror)'
|
|
|
|
workingDirectory: $(WorkingDirectoryName)
|
|
|
|
inlineScript: |
|
|
|
|
param([string]$branch)
|
|
|
|
|
|
|
|
$commit = (git rev-parse HEAD).Substring(0, 7)
|
|
|
|
$target = "$branch".Replace('/', ' ')
|
2022-05-18 04:16:58 +03:00
|
|
|
|
2022-05-19 22:45:12 +03:00
|
|
|
Write-Host "##vso[build.updatebuildnumber]$target $commit"
|
|
|
|
Write-Host "##vso[build.addbuildtag]$target"
|