Skip to content

Commit 11f5778

Browse files
authored
Sync to Azs-tzl and generation branch when tools branch is changed (#15508)
* Add pipeline to sync tools folder
1 parent 17d9a8b commit 11f5778

File tree

2 files changed

+86
-68
lines changed

2 files changed

+86
-68
lines changed
Lines changed: 19 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,35 @@
1-
# Variable 'BaseBranch' was defined in the Variables tab
2-
# Variable 'ServiceName' was defined in the Variables tab
3-
# Multi-job configuration must be converted to matrix strategy: https://docs.microsoft.com/en-us/azure/devops/pipelines/process/phases?view=azure-devops&tabs=yaml#multi-job-configuration
41
resources:
52
repositories:
63
- repository: self
74
type: git
85
ref: main
96

10-
pr:
7+
trigger:
118
branches:
129
include:
1310
- main
1411
paths:
1512
include:
16-
- .azure-pipeline
13+
- .azure-pipelines
1714
- tools
1815
- src/lib
16+
17+
variables:
18+
GenerationBranchName: generation
19+
AzureStackBranchName: Azs-tzl
1920

2021
jobs:
21-
- job: Job_1
22-
displayName: 'Service: '
23-
timeoutInMinutes: 90
24-
pool:
25-
name: Hosted VS2017
26-
steps:
27-
- checkout: self
28-
- task: PowerShell@2
29-
displayName: Config git
30-
inputs:
31-
targetType: inline
32-
script: >-
33-
git config --global user.email "[email protected]"
34-
35-
git config --global user.name "azurepowershell"
36-
37-
git checkout generation
38-
pwsh: true
39-
- task: PowerShell@2
40-
displayName: Sync .azure-pipeline folder from main to generation
41-
inputs:
42-
targetType: inline
43-
script: >-
44-
#cp .azure-pipeline .azure-pipeline-tmp -r
45-
46-
rm .azure-pipeline -r
47-
48-
mv .azure-pipeline-tmp .azure-pipeline
49-
50-
git add .azure-pipeline
51-
pwsh: true
52-
- task: PowerShell@2
53-
displayName: Sync src/lib folder from main to generation
54-
inputs:
55-
targetType: inline
56-
script: >-
57-
#cp src/lib src/lib-tmp -r
58-
59-
rm src/lib -r
60-
61-
mv src/lib-tmp src/lib
22+
- job: Sync
23+
displayName: Sync task
24+
condition: succeeded()
25+
strategy:
26+
matrix:
27+
Generation:
28+
BranchName: ${{ variables.GenerationBranchName }}
29+
AzureStack:
30+
BranchName: ${{ variables.AzureStackBranchName }}
6231

63-
git add src/lib
64-
pwsh: true
65-
- task: PowerShell@2
66-
displayName: Sync tools folder from main to generation
67-
inputs:
68-
targetType: inline
69-
script: >-
70-
#cp tools tools-tmp -r
71-
72-
rm tools -r
73-
74-
mv tools-tmp tools
75-
76-
git add tools
77-
78-
git commit -m "Sync tools folder from main branch to generation branch"
79-
80-
git remote set-url origin https://$env:[email protected]/Azure/azure-powershell.git
81-
82-
git push origin syncToolsFolder --force
83-
pwsh: true
84-
...
32+
steps:
33+
- template: util/sync-tools-folder-template.yml
34+
parameters:
35+
BranchName: $(BranchName)
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
parameters:
2+
BranchName: ''
3+
4+
steps:
5+
- checkout: self
6+
- task: PowerShell@2
7+
displayName: Save folders need to be sync
8+
inputs:
9+
targetType: inline
10+
script: >-
11+
cp .azure-pipelines .azure-pipelines-tmp -r
12+
13+
cp src/lib src/lib-tmp -r
14+
15+
cp tools tools-tmp -r
16+
pwsh: true
17+
- task: PowerShell@2
18+
displayName: Config git
19+
inputs:
20+
targetType: inline
21+
script: >-
22+
git config --global user.email "[email protected]"
23+
24+
git config --global user.name "azurepowershell"
25+
26+
git checkout -b syncToolsFolder-${{ parameters.BranchName }} origin/${{ parameters.BranchName }}
27+
pwsh: true
28+
- task: PowerShell@2
29+
displayName: Sync .azure-pipelines folder from main to ${{ parameters.BranchName }}
30+
inputs:
31+
targetType: inline
32+
script: >-
33+
rm .azure-pipelines -r
34+
35+
mv .azure-pipelines-tmp .azure-pipelines
36+
37+
git add .azure-pipelines
38+
pwsh: true
39+
- task: PowerShell@2
40+
displayName: Sync src/lib folder from main to ${{ parameters.BranchName }}
41+
inputs:
42+
targetType: inline
43+
script: >-
44+
rm src/lib -r
45+
46+
mv src/lib-tmp src/lib
47+
48+
git add src/lib
49+
pwsh: true
50+
- task: PowerShell@2
51+
displayName: Sync tools folder from main to ${{ parameters.BranchName }}
52+
inputs:
53+
targetType: inline
54+
script: >-
55+
rm tools -r
56+
57+
mv tools-tmp tools
58+
59+
git add tools
60+
61+
git commit -m "Sync tools folder from main branch to ${{ parameters.BranchName }} branch"
62+
63+
git remote set-url origin https://$env:[email protected]/Azure/azure-powershell.git
64+
65+
git push origin syncToolsFolder-${{ parameters.BranchName }} --force
66+
pwsh: true
67+

0 commit comments

Comments
 (0)