From 4de825f5e188b20d9be86d79185f6bc52a1ba762 Mon Sep 17 00:00:00 2001 From: William Godbe Date: Wed, 18 May 2022 09:17:07 -0700 Subject: [PATCH 1/6] Allow explicit manual runs of mirror pipeline --- .../pipelines/azure-pipelines-mirror-within-azdo.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.azure/pipelines/azure-pipelines-mirror-within-azdo.yml b/.azure/pipelines/azure-pipelines-mirror-within-azdo.yml index 23a15f8b8fd1..f8c4240d0042 100644 --- a/.azure/pipelines/azure-pipelines-mirror-within-azdo.yml +++ b/.azure/pipelines/azure-pipelines-mirror-within-azdo.yml @@ -4,6 +4,13 @@ trigger: branches: include: - internal/release/6.0 + +parameters: +# Run the pipeline manually (usually disallowed) +- name: manualRun + default: false + displayName: Are you sure you want to run this pipeline manually? + type: boolean variables: - group: Mirror-Credentials @@ -17,7 +24,7 @@ jobs: jobs: - job: Merge_Azure_DevOps_Branches enableSBOM: false - condition: and(contains(variables['Build.SourceBranch'], 'internal'), eq(variables['Build.Reason'], 'BatchedCI')) + condition: or((and(contains(variables['Build.SourceBranch'], 'internal'), eq(variables['Build.Reason'], 'BatchedCI'))), (eq(parameters.manualRun, 'true'))) pool: name: NetCore1ESPool-Internal demands: ImageOverride -equals Build.Server.Amd64.VS2019 @@ -58,4 +65,4 @@ jobs: $target = "$branch".Replace('/', ' ') Write-Host "##vso[build.updatebuildnumber]$target $commit" - Write-Host "##vso[build.addbuildtag]$target" \ No newline at end of file + Write-Host "##vso[build.addbuildtag]$target" From c76ce262d79b3aa092709eb2ce1139d3f9352edf Mon Sep 17 00:00:00 2001 From: Will Godbe Date: Wed, 18 May 2022 09:22:50 -0700 Subject: [PATCH 2/6] Fixup --- .azure/pipelines/azure-pipelines-mirror-within-azdo.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure/pipelines/azure-pipelines-mirror-within-azdo.yml b/.azure/pipelines/azure-pipelines-mirror-within-azdo.yml index f8c4240d0042..7bdf3011065b 100644 --- a/.azure/pipelines/azure-pipelines-mirror-within-azdo.yml +++ b/.azure/pipelines/azure-pipelines-mirror-within-azdo.yml @@ -24,7 +24,7 @@ jobs: jobs: - job: Merge_Azure_DevOps_Branches enableSBOM: false - condition: or((and(contains(variables['Build.SourceBranch'], 'internal'), eq(variables['Build.Reason'], 'BatchedCI'))), (eq(parameters.manualRun, 'true'))) + condition: or(and(contains(variables['Build.SourceBranch'], 'internal'), eq(variables['Build.Reason'], 'BatchedCI')), eq(parameters.manualRun, 'true')) pool: name: NetCore1ESPool-Internal demands: ImageOverride -equals Build.Server.Amd64.VS2019 From 91869b426470d44c68833a12e380696850615e9f Mon Sep 17 00:00:00 2001 From: Will Godbe Date: Wed, 18 May 2022 09:25:36 -0700 Subject: [PATCH 3/6] Fixup 2 --- .azure/pipelines/azure-pipelines-mirror-within-azdo.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.azure/pipelines/azure-pipelines-mirror-within-azdo.yml b/.azure/pipelines/azure-pipelines-mirror-within-azdo.yml index 7bdf3011065b..d643006bf854 100644 --- a/.azure/pipelines/azure-pipelines-mirror-within-azdo.yml +++ b/.azure/pipelines/azure-pipelines-mirror-within-azdo.yml @@ -21,6 +21,7 @@ jobs: parameters: enableTelemetry: true helixRepo: dotnet/arcade + manualRun: ${{ parameters.manualRun }} jobs: - job: Merge_Azure_DevOps_Branches enableSBOM: false From db9e712ccbff95e2b7f83db8df7ef9d3c81137ab Mon Sep 17 00:00:00 2001 From: Will Godbe Date: Wed, 18 May 2022 09:31:12 -0700 Subject: [PATCH 4/6] Try different approach --- .../azure-pipelines-mirror-within-azdo.yml | 94 +++++++++---------- 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/.azure/pipelines/azure-pipelines-mirror-within-azdo.yml b/.azure/pipelines/azure-pipelines-mirror-within-azdo.yml index d643006bf854..deb32c8d873f 100644 --- a/.azure/pipelines/azure-pipelines-mirror-within-azdo.yml +++ b/.azure/pipelines/azure-pipelines-mirror-within-azdo.yml @@ -17,53 +17,53 @@ variables: # Merges code from one AzDO branch into another jobs: -- template: /eng/common/templates/jobs/jobs.yml - parameters: - enableTelemetry: true - helixRepo: dotnet/arcade - manualRun: ${{ parameters.manualRun }} - jobs: - - job: Merge_Azure_DevOps_Branches - enableSBOM: false - condition: or(and(contains(variables['Build.SourceBranch'], 'internal'), eq(variables['Build.Reason'], 'BatchedCI')), eq(parameters.manualRun, 'true')) - pool: - name: NetCore1ESPool-Internal - demands: ImageOverride -equals Build.Server.Amd64.VS2019 - variables: - - name: WorkingDirectoryName - value: repo-dir - - name: AzdoRepo - value: dotnet-aspnetcore - - name: TargetBranchName - value: $(Build.SourceBranch)-nonstable - - name: BranchToMirror - value: $(Build.SourceBranch) - steps: - - 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 - workingDirectory: $(WorkingDirectoryName) - - - task: PowerShell@1 - displayName: Broadcast target, branch, commit in metadata - continueOnError: true - condition: always() - inputs: - scriptType: inlineScript - arguments: '$(BranchToMirror)' +- ${{ if or(and(contains(variables['Build.SourceBranch'], 'internal'), eq(variables['Build.Reason'], 'BatchedCI')), eq(parameters.manualRun, 'true')) }}: + - template: /eng/common/templates/jobs/jobs.yml + parameters: + enableTelemetry: true + helixRepo: dotnet/aspnetcore + manualRun: ${{ parameters.manualRun }} + jobs: + - job: Merge_Azure_DevOps_Branches + enableSBOM: false + pool: + name: NetCore1ESPool-Internal + demands: ImageOverride -equals Build.Server.Amd64.VS2019 + variables: + - name: WorkingDirectoryName + value: repo-dir + - name: AzdoRepo + value: dotnet-aspnetcore + - name: TargetBranchName + value: $(Build.SourceBranch)-nonstable + - name: BranchToMirror + value: $(Build.SourceBranch) + steps: + - 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 workingDirectory: $(WorkingDirectoryName) - inlineScript: | - param([string]$branch) - $commit = (git rev-parse HEAD).Substring(0, 7) - $target = "$branch".Replace('/', ' ') + - 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('/', ' ') - Write-Host "##vso[build.updatebuildnumber]$target $commit" - Write-Host "##vso[build.addbuildtag]$target" + Write-Host "##vso[build.updatebuildnumber]$target $commit" + Write-Host "##vso[build.addbuildtag]$target" From c0fe7b5008dc352c9429b553e442facb630784df Mon Sep 17 00:00:00 2001 From: William Godbe Date: Wed, 18 May 2022 10:33:59 -0700 Subject: [PATCH 5/6] Update .azure/pipelines/azure-pipelines-mirror-within-azdo.yml --- .azure/pipelines/azure-pipelines-mirror-within-azdo.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure/pipelines/azure-pipelines-mirror-within-azdo.yml b/.azure/pipelines/azure-pipelines-mirror-within-azdo.yml index deb32c8d873f..35a7766fe6e7 100644 --- a/.azure/pipelines/azure-pipelines-mirror-within-azdo.yml +++ b/.azure/pipelines/azure-pipelines-mirror-within-azdo.yml @@ -17,7 +17,7 @@ variables: # Merges code from one AzDO branch into another jobs: -- ${{ if or(and(contains(variables['Build.SourceBranch'], 'internal'), eq(variables['Build.Reason'], 'BatchedCI')), eq(parameters.manualRun, 'true')) }}: +- ${{ 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 From 999368b0d7cae6775292cd2369cfc47568dc101e Mon Sep 17 00:00:00 2001 From: William Godbe Date: Wed, 18 May 2022 10:36:01 -0700 Subject: [PATCH 6/6] Update .azure/pipelines/azure-pipelines-mirror-within-azdo.yml Co-authored-by: Doug Bunting <6431421+dougbu@users.noreply.github.com> --- .azure/pipelines/azure-pipelines-mirror-within-azdo.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.azure/pipelines/azure-pipelines-mirror-within-azdo.yml b/.azure/pipelines/azure-pipelines-mirror-within-azdo.yml index 35a7766fe6e7..2d7422688be8 100644 --- a/.azure/pipelines/azure-pipelines-mirror-within-azdo.yml +++ b/.azure/pipelines/azure-pipelines-mirror-within-azdo.yml @@ -22,7 +22,6 @@ jobs: parameters: enableTelemetry: true helixRepo: dotnet/aspnetcore - manualRun: ${{ parameters.manualRun }} jobs: - job: Merge_Azure_DevOps_Branches enableSBOM: false