use push command

This commit is contained in:
MilenaHristova 2023-02-02 15:03:02 +01:00
parent 439d38946c
commit 2f34945ee1

View file

@ -25,12 +25,12 @@ 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
- ${{ if and( eq(variables['System.TeamProject'], 'internal'), or(startswith(variables['Build.SourceBranch'], 'refs/heads/internal/release/'), startswith(variables['Build.SourceBranch'], 'refs/heads/dev/'))) }}:
- group: DotNetBot-AzDO-PAT
pool:
${{ if eq(variables['System.TeamProject'], 'public') }}:
name: $(DncEngPublicBuildPool)
@ -52,16 +52,20 @@ jobs:
targetRef: ${{ parameters.targetRef }}
# For official builds, push the changes to the VMR
# Push only main and release branches
# Push main and release branches to the public vmr
- ${{ 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 }}
./.dotnet/dotnet darc vmr push --vmr $(vmrPath) --commit-verification-pat $(BotAccount-dotnet-maestro-bot-no-scopes-PAT) --branch ${{ parameters.vmrBranch }} --remote-url https://github.com/dotnet/dotnet.git --github-pat $(BotAccount-dotnet-bot-repo-PAT)
displayName: Push changes to dotnet/dotnet
workingDirectory: $(vmrPath)
workingDirectory: $(vmrPath)/src/installer
condition: and(succeeded(), or(eq(variables['vmrBranch'], 'main'), startsWith(variables['vmrBranch'], 'release/')))
# Push internal/release branches to the internal vmr
- ${{ if and(not(parameters.noPush), not(in(variables['Build.Reason'], 'PullRequest')), eq(variables['System.TeamProject'], 'internal')) }}:
- script: |
set -x
./.dotnet/dotnet darc vmr push --vmr $(vmrPath) --skip-commit-verification --branch ${{ parameters.vmrBranch }} --remote-url https://dnceng@dev.azure.com/dnceng/internal/_git/dotnet-dotnet --azdev-pat $(dn-bot-dnceng-build-rw-code-rw)
displayName: Push changes to dotnet/dotnet
workingDirectory: $(vmrPath)/src/installer
condition: and(succeeded(), or(startsWith(variables['vmrBranch'], 'internal/release/'), startsWith(variables['vmrBranch'], 'dev/'))