@@ -4,115 +4,129 @@ trigger:
44variables :
55 - group : ' DotNet-VSTS-Infra-Access'
66
7- pool :
8- name : VSEngSS-MicroBuild2019-1ES
9-
10- jobs :
11- - job : Mirror
12- steps :
13- - task : PowerShell@1
14- displayName : ' Set SourceBranch Variable'
15- inputs :
16- scriptType : inlineScript
17- arguments : ' $(Build.SourceBranch)'
18- inlineScript : |
19- param(
20- [string]$SourceBranch
21- )
22- if ($SourceBranch.StartsWith("refs/heads/"))
23- {
24- # strip off the refs/heads/ prefix
25- $SourceBranch=$SourceBranch.Substring(11)
26- }
27- $env:SourceBranch=$SourceBranch
28- Write-Host ("##vso[task.setvariable variable=SourceBranch;]$env:SourceBranch")
29-
30- - task : PowerShell@1
31- displayName : ' Set MirrorBranch Variable'
32- inputs :
33- scriptType : inlineScript
34- inlineScript : |
35- $env:MirrorBranch='mirror/'+[Guid]::NewGuid().ToString()
36- Write-Host ("##vso[task.setvariable variable=MirrorBranch;]$env:MirrorBranch")
37-
38- - task : UsePythonVersion@0
39- displayName : ' Use Python 3.x'
40- inputs :
41- versionSpec : 3.x
42-
43- - task : CmdLine@1
44- displayName : ' Update pip to latest'
45- inputs :
46- filename : python
47- arguments : ' -m pip install --upgrade pip'
48-
49- - task : CmdLine@1
50- displayName : ' Install Azure CLI'
51- inputs :
52- filename : pip
53- arguments : ' install --pre azure-cli'
54-
55- - task : CmdLine@1
56- displayName : ' Install Azure DevOps Extension'
57- inputs :
58- filename : az
59- arguments : ' extension add -n azure-devops'
60-
61- - task : CmdLine@1
62- displayName : ' Configure Git user.email'
63- inputs :
64- filename : git
65- arguments : ' config user.email "dn-bot@microsoft.com"'
66-
67- - task : CmdLine@1
68- displayName : ' Configure git user.name'
69- inputs :
70- filename : git
71- arguments : ' config user.name "dotnet-bot"'
72-
73- - task : CmdLine@1
74- displayName : ' Checkout GitHub main Branch'
75- inputs :
76- filename : git
77- arguments : ' checkout $(SourceBranch)'
78-
79- - task : CmdLine@1
80- displayName : ' Create Mirror Branch'
81- inputs :
82- filename : git
83- arguments : ' checkout -b $(MirrorBranch)'
84-
85- - task : CmdLine@1
86- displayName : ' Run git reset'
87- inputs :
88- filename : git
89- arguments : ' reset --hard origin/$(SourceBranch)'
90- enabled : false
91-
92- - task : CmdLine@1
93- displayName : ' Pull AzDO SourceBranch'
94- inputs :
95- filename : ' git '
96- arguments : ' pull https://dn-bot:$(dn-bot-devdiv-build-rw-code-rw)@devdiv.visualstudio.com/DevDiv/_git/perfView $(SourceBranch)'
97-
98- - task : CmdLine@1
99- displayName : ' Run git push '
100- inputs :
101- filename : ' git '
102- arguments : ' push https://dn-bot:$(dn-bot-devdiv-build-rw-code-rw)@devdiv.visualstudio.com/DevDiv/_git/perfView $(MirrorBranch)'
103-
104- - task : PowerShell@1
105- displayName : ' Create Pull Request'
106- inputs :
107- scriptType : inlineScript
108- arguments : ' $(dn-bot-devdiv-build-rw-code-rw)'
109- inlineScript : |
110- param(
111- [string]$AccessToken
112- )
113- $env:AZURE_DEVOPS_EXT_PAT=$AccessToken
114- $Organization="https://devdiv.visualstudio.com"
115- $Project="DevDiv"
116- $Repository="PerfView"
117- az devops configure --defaults organization=$Organization project=$Project
118- az repos pr create --repository $Repository --auto-complete true --delete-source-branch true --title "Mirror Changes from GitHub" --source-branch $(MirrorBranch) --target-branch $(SourceBranch)
7+ resources :
8+ repositories :
9+ - repository : 1esPipelines
10+ type : git
11+ name : 1ESPipelineTemplates/1ESPipelineTemplates
12+ ref : refs/tags/release
13+
14+ extends :
15+ template : v1/1ES.Official.PipelineTemplate.yml@1esPipelines
16+ parameters :
17+ pool :
18+ name : AzurePipelines-EO
19+ image : 1ESPT-Windows2022
20+ os : windows
21+
22+ stages :
23+ - stage : Mirror
24+ jobs :
25+ - job : Mirror
26+ steps :
27+ - task : PowerShell@1
28+ displayName : ' Set SourceBranch Variable'
29+ inputs :
30+ scriptType : inlineScript
31+ arguments : ' $(Build.SourceBranch)'
32+ inlineScript : |
33+ param(
34+ [string]$SourceBranch
35+ )
36+ if ($SourceBranch.StartsWith("refs/heads/"))
37+ {
38+ # strip off the refs/heads/ prefix
39+ $SourceBranch=$SourceBranch.Substring(11)
40+ }
41+ $env:SourceBranch=$SourceBranch
42+ Write-Host ("##vso[task.setvariable variable=SourceBranch;]$env:SourceBranch")
43+
44+ - task : PowerShell@1
45+ displayName : ' Set MirrorBranch Variable'
46+ inputs :
47+ scriptType : inlineScript
48+ inlineScript : |
49+ $env:MirrorBranch='mirror/'+[Guid]::NewGuid().ToString()
50+ Write-Host ("##vso[task.setvariable variable=MirrorBranch;]$env:MirrorBranch")
51+
52+ - task : UsePythonVersion@0
53+ displayName : ' Use Python 3.11.x'
54+ inputs :
55+ versionSpec : 3.11.x
56+
57+ - task : CmdLine@1
58+ displayName : ' Update pip to latest'
59+ inputs :
60+ filename : python
61+ arguments : ' -m pip install --upgrade pip'
62+
63+ - task : CmdLine@1
64+ displayName : ' Install Azure CLI'
65+ inputs :
66+ filename : pip
67+ arguments : ' install --pre azure-cli'
68+
69+ - task : CmdLine@1
70+ displayName : ' Install Azure DevOps Extension'
71+ inputs :
72+ filename : az
73+ arguments : ' extension add -n azure-devops'
74+
75+ - task : CmdLine@1
76+ displayName : ' Configure Git user.email'
77+ inputs :
78+ filename : git
79+ arguments : ' config user.email "dn-bot@microsoft.com"'
80+
81+ - task : CmdLine@1
82+ displayName : ' Configure git user.name'
83+ inputs :
84+ filename : git
85+ arguments : ' config user.name "dotnet-bot"'
86+
87+ - task : CmdLine@1
88+ displayName : ' Checkout GitHub main Branch'
89+ inputs :
90+ filename : git
91+ arguments : ' checkout $(SourceBranch)'
92+
93+ - task : CmdLine@1
94+ displayName : ' Create Mirror Branch'
95+ inputs :
96+ filename : git
97+ arguments : ' checkout -b $(MirrorBranch)'
98+
99+ - task : CmdLine@1
100+ displayName : ' Run git reset'
101+ inputs :
102+ filename : git
103+ arguments : ' reset --hard origin/$(SourceBranch)'
104+ enabled : false
105+
106+ - task : CmdLine@1
107+ displayName : ' Pull AzDO SourceBranch'
108+ inputs :
109+ filename : ' git '
110+ arguments : ' pull https://dn-bot:$(dn-bot-devdiv-build-rw-code-rw)@devdiv.visualstudio.com/DevDiv/_git/perfView $(SourceBranch)'
111+
112+ - task : CmdLine@1
113+ displayName : ' Run git push '
114+ inputs :
115+ filename : ' git '
116+ arguments : ' push https://dn-bot:$(dn-bot-devdiv-build-rw-code-rw)@devdiv.visualstudio.com/DevDiv/_git/perfView $(MirrorBranch)'
117+
118+ - task : PowerShell@1
119+ displayName : ' Create Pull Request'
120+ inputs :
121+ scriptType : inlineScript
122+ arguments : ' $(dn-bot-devdiv-build-rw-code-rw)'
123+ inlineScript : |
124+ param(
125+ [string]$AccessToken
126+ )
127+ $env:AZURE_DEVOPS_EXT_PAT=$AccessToken
128+ $Organization="https://devdiv.visualstudio.com"
129+ $Project="DevDiv"
130+ $Repository="PerfView"
131+ az devops configure --defaults organization=$Organization project=$Project
132+ az repos pr create --repository $Repository --auto-complete true --delete-source-branch true --title "Mirror Changes from GitHub" --source-branch $(MirrorBranch) --target-branch $(SourceBranch)
0 commit comments