Browse Source

infra(main): proper branch name for mirroring within azdo (#65472)

* proper branch name for mirroring within azdo

* support both internal/ and non-internal branches in mirroring
Korolev Dmitry 1 week ago
parent
commit
53bb2652f5
1 changed files with 8 additions and 3 deletions
  1. 8 3
      .azure/pipelines/azure-pipelines-mirror-within-azdo.yml

+ 8 - 3
.azure/pipelines/azure-pipelines-mirror-within-azdo.yml

@@ -4,7 +4,7 @@ trigger:
   branches:
     include:
     - internal/release/8.0
-    - internal/release/10.0
+    - release/10.0
 
 parameters:
 # Run the pipeline manually (usually disallowed)
@@ -19,7 +19,7 @@ variables:
 
 # Merges code from one AzDO branch into another
 jobs:
-- ${{ if and(contains(variables['Build.SourceBranch'], 'internal'), or(eq(variables['Build.Reason'], 'BatchedCI'), eq(parameters.manualRun, 'true'))) }}:
+- ${{ if or(eq(variables['Build.Reason'], 'BatchedCI'), eq(parameters.manualRun, 'true')) }}:
   - template: /eng/common/templates/jobs/jobs.yml
     parameters:
       enableTelemetry: true
@@ -39,8 +39,13 @@ jobs:
         - powershell: |
             $branch = "$(Build.SourceBranch)".Replace("refs/heads/", "");
             $suffix = "-nonstable"
+            if ($branch.StartsWith("internal/")) {
+              $targetBranch = "$branch$suffix"
+            } else {
+              $targetBranch = "internal/$branch$suffix"
+            }
             Write-Host "##vso[task.setvariable variable=BranchToMirror]$branch"
-            Write-Host "##vso[task.setvariable variable=TargetBranchName]$branch$suffix"
+            Write-Host "##vso[task.setvariable variable=TargetBranchName]$targetBranch"
           displayName: Calculate Mirrored Branch Names
         - 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)