Split VMR synchronization for public & internal branches (#15409)

This commit is contained in:
Milena Hristova 2023-02-07 18:33:41 +01:00 committed by GitHub
commit b0e14be151
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 75 additions and 24 deletions

View file

@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"microsoft.dotnet.darc": {
"version": "1.1.0-beta.23101.1",
"version": "1.1.0-beta.23106.1",
"commands": [
"darc"
]

View file

@ -208,13 +208,13 @@
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>c453dfef2f41533de5cb03b2115aab9d0dfc74c6</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.Darc" Version="1.1.0-beta.23101.1">
<Dependency Name="Microsoft.DotNet.Darc" Version="1.1.0-beta.23106.1">
<Uri>https://github.com/dotnet/arcade-services</Uri>
<Sha>ef64ef0af25b1b29b4b5e0415788a0b7a1be004f</Sha>
<Sha>8b6dc24326637735543511b2b5c5e6331adc293b</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.DarcLib" Version="1.1.0-beta.23101.1">
<Dependency Name="Microsoft.DotNet.DarcLib" Version="1.1.0-beta.23106.1">
<Uri>https://github.com/dotnet/arcade-services</Uri>
<Sha>ef64ef0af25b1b29b4b5e0415788a0b7a1be004f</Sha>
<Sha>8b6dc24326637735543511b2b5c5e6331adc293b</Sha>
</Dependency>
<Dependency Name="Microsoft.Extensions.Logging.Console" Version="8.0.0-alpha.1.22557.12">
<Uri>https://github.com/dotnet/runtime</Uri>

View file

@ -30,7 +30,7 @@
</PropertyGroup>
<PropertyGroup>
<!-- Dependency from https://github.com/dotnet/arcade-services -->
<MicrosoftDotNetDarcLibVersion>1.1.0-beta.23101.1</MicrosoftDotNetDarcLibVersion>
<MicrosoftDotNetDarcLibVersion>1.1.0-beta.23106.1</MicrosoftDotNetDarcLibVersion>
</PropertyGroup>
<PropertyGroup>
<!-- Dependency from https://github.com/dotnet/winforms -->

View file

@ -25,12 +25,16 @@ jobs:
- template: /eng/common/templates/variables/pool-providers.yml
- name: vmrPath
value: $(Agent.BuildDirectory)/vmr
- ${{ if eq(variables['System.TeamProject'], 'internal') }}:
- ${{ if and( eq(variables['System.TeamProject'], 'internal'), or(startswith(variables['Build.SourceBranch'], 'refs/heads/release/'), eq(variables['Build.SourceBranch'], 'refs/heads/main'))) }}:
- group: DotNetBot-GitHub
- ${{ else }}:
- name: BotAccount-dotnet-bot-repo-PAT
value: N/A
- group: DotNetBot-GitHub-No-Scopes
- name: vmrPublicUrl
value: https://github.com/dotnet/dotnet
- ${{ if and( eq(variables['System.TeamProject'], 'internal'), startswith(variables['Build.SourceBranch'], 'refs/heads/internal/release/')) }}:
- group: DotNetBot-AzDO-PAT
- name: vmrInternalUrl
value: https://dnceng@dev.azure.com/dnceng/internal/_git/dotnet-dotnet
pool:
${{ if eq(variables['System.TeamProject'], 'public') }}:
name: $(DncEngPublicBuildPool)
@ -51,17 +55,30 @@ jobs:
vmrBranch: ${{ parameters.vmrBranch }}
targetRef: ${{ parameters.targetRef }}
# For official builds, push the changes to the VMR
# Push only main and release branches
- ${{ if and(not(parameters.noPush), not(in(variables['Build.Reason'], 'PullRequest')), eq(variables['System.TeamProject'], 'internal')) }}:
- script: |
set -x
git config --global user.email 'dotnet-maestro[bot]@users.noreply.github.com' && git config --global user.name 'dotnet-maestro[bot]'
git remote add dotnet 'https://$(BotAccount-dotnet-bot-repo-PAT)@github.com/dotnet/dotnet.git'
git fetch dotnet
git branch ${{ parameters.vmrBranch }}
git branch --set-upstream-to=dotnet/${{ parameters.vmrBranch }} ${{ parameters.vmrBranch }} || echo 'Branch ${{ parameters.vmrBranch }} not found in remote'
git push dotnet ${{ parameters.vmrBranch }}
displayName: Push changes to dotnet/dotnet
workingDirectory: $(vmrPath)
condition: and(succeeded(), or(eq(variables['vmrBranch'], 'main'), startsWith(variables['vmrBranch'], 'release/')))
# Push main and release branches to the public VMR
- ${{ if or(eq(parameters.vmrBranch, 'main'), startsWith(parameters.vmrBranch, 'release/')) }}:
- script: >
./.dotnet/dotnet darc vmr push
--vmr '$(vmrPath)'
--commit-verification-pat '$(BotAccount-dotnet-maestro-bot-no-scopes-PAT)'
--branch '${{ parameters.vmrBranch }}'
--remote-url '$(vmrPublicUrl)'
--github-pat '$(BotAccount-dotnet-bot-repo-PAT)'
--verbose
displayName: Push changes to dotnet/dotnet (public)
workingDirectory: $(Agent.BuildDirectory)/installer
# Push internal/release branches to the internal VMR
- ${{ if startsWith(parameters.vmrBranch, 'internal/release/') }}:
- script: >
./.dotnet/dotnet darc vmr push
--vmr '$(vmrPath)'
--skip-commit-verification
--branch '${{ parameters.vmrBranch }}'
--remote-url '$(vmrInternalUrl)'
--azdev-pat '$(dn-bot-dnceng-build-rw-code-rw)'
--verbose
displayName: Push changes to dotnet-dotnet (internal)
workingDirectory: $(Agent.BuildDirectory)/installer

View file

@ -0,0 +1,33 @@
pr: none
trigger:
batch: true
branches:
include:
- internal/release/*
resources:
repositories:
- repository: vmr
type: git
name: dotnet-dotnet
ref: $(Build.SourceBranch)
parameters:
- name: vmrBranch
displayName: dotnet-dotnet branch to push to
type: string
default: ' '
variables:
- ${{ if ne(parameters.vmrBranch, ' ') }}:
- name: VmrBranch
value: ${{ parameters.vmrBranch }}
- ${{ else }}:
- name: VmrBranch
value: ${{ replace(replace(variables['Build.SourceBranch'], 'refs/heads/', ''), 'refs/pull/', '') }}
jobs:
- template: templates/jobs/vmr-synchronization.yml
parameters:
vmrBranch: ${{ variables.VmrBranch }}

View file

@ -13,6 +13,7 @@ resources:
type: github
name: dotnet/dotnet
endpoint: dotnet
ref: $(Build.SourceBranch)
parameters:
- name: vmrBranch