From 0e0f41f86b0b6225005d7b0a7c88670b23fe8d7b Mon Sep 17 00:00:00 2001 From: Ryan Shepherd Date: Fri, 10 Mar 2023 20:15:22 -0800 Subject: [PATCH 1/3] Add pipeline to sync mirror repo --- .pipelines/sync-mirror.yml | 54 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .pipelines/sync-mirror.yml diff --git a/.pipelines/sync-mirror.yml b/.pipelines/sync-mirror.yml new file mode 100644 index 000000000..01a4a5a15 --- /dev/null +++ b/.pipelines/sync-mirror.yml @@ -0,0 +1,54 @@ +# Sync branches in a mirror repository to a base repo by running this pipeline +# from the mirror repo, and supplying the base repo as a parameter +name: $(MajorVersion).$(MinorVersion).$(date:yyMMdd)$(rev:.r) + +parameters: + - name: "SourceToTargetBranches" + type: object + default: + master: master + - name: "SourceRepository" + type: string + default: "https://github.com/microsoft/cppwinrt.git" + +jobs: + - job: SyncMirror + strategy: + matrix: + ${{ each branches in parameters.SourceToTargetBranches }}: + ${{ branches.key }}: + SourceBranch: ${{ branches.key }} + TargetBranch: ${{ branches.value }} + dependsOn: [] + pool: + name: Azure Pipelines + vmImage: 'windows-2022' + steps: + - checkout: self + persistCredentials: true + + - task: PowerShell@2 + inputs: + targetType: 'inline' + script: | + Write-Host "SourceBranch " + "$(SourceBranch)" + Write-Host "TargetBranch " + "$(TargetBranch)" + + $repo = "${{ parameters.SourceRepository }}" + git remote add sourcerepo $repo + git remote + + $target = "$(TargetBranch)" + git fetch origin $target + git checkout $target + git pull origin $target + + $source = "$(SourceBranch)" + git fetch sourcerepo $source + git pull sourcerepo $sourcerepo + + - task: CmdLine@2 + inputs: + script: | + git push + From f189097e1fe9fa966d095719fd2ff18efd227630 Mon Sep 17 00:00:00 2001 From: Ryan Shepherd Date: Sat, 11 Mar 2023 05:27:40 +0000 Subject: [PATCH 2/3] Fix pipeline name --- .pipelines/sync-mirror.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pipelines/sync-mirror.yml b/.pipelines/sync-mirror.yml index 01a4a5a15..573a20f1b 100644 --- a/.pipelines/sync-mirror.yml +++ b/.pipelines/sync-mirror.yml @@ -1,6 +1,6 @@ # Sync branches in a mirror repository to a base repo by running this pipeline # from the mirror repo, and supplying the base repo as a parameter -name: $(MajorVersion).$(MinorVersion).$(date:yyMMdd)$(rev:.r) +name: $(BuildDefinitionName)_$(date:yyMMdd)$(rev:.r) parameters: - name: "SourceToTargetBranches" From 35faea9342d9ee718ddcbe03222de657ca235868 Mon Sep 17 00:00:00 2001 From: Ryan Shepherd Date: Sat, 11 Mar 2023 05:34:10 +0000 Subject: [PATCH 3/3] Fix typo --- .pipelines/sync-mirror.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pipelines/sync-mirror.yml b/.pipelines/sync-mirror.yml index 573a20f1b..add70e3ba 100644 --- a/.pipelines/sync-mirror.yml +++ b/.pipelines/sync-mirror.yml @@ -45,7 +45,7 @@ jobs: $source = "$(SourceBranch)" git fetch sourcerepo $source - git pull sourcerepo $sourcerepo + git pull sourcerepo $source - task: CmdLine@2 inputs: