@@ -20,7 +20,6 @@ variables:
20
20
LinuxAgentPoolName : pool-ubuntu-2004
21
21
MacOSAgentPoolName : ' Azure Pipelines'
22
22
MacOSAgentPoolVMImage : macOS-latest
23
- GenerationBranch : batch-generation/branch-$(Build.BuildId)
24
23
25
24
trigger : none
26
25
@@ -42,17 +41,20 @@ stages:
42
41
- template : util/get-github-pat-steps.yml
43
42
44
43
- task : PowerShell@2
44
+ name : checkout
45
45
displayName : ' Create Batch Generation Branch'
46
46
inputs :
47
47
targetType : inline
48
48
pwsh : true
49
49
script : |
50
- $newBranch = "$(GenerationBranch)"
50
+ $date = Get-Date -Format "yy-MM-dd"
51
+ $generationBranch = "batch-generation/branch-$date-$(Build.BuildId)"
51
52
$token = "$(GitHubToken)"
52
53
53
54
$createBranchPath = Join-Path "$(Build.SourcesDirectory)" '.azure-pipelines' 'PipelineSteps' 'BatchGeneration' 'create-branch.ps1'
54
55
# TODO: (Bernard) Change BaseBranch to main after test
55
- & $createBranchPath -Owner 'Azure' -Repo 'azure-powershell' -BaseBranch 'bernard-pipeline-generation' -NewBranch $newBranch -Token $token
56
+ & $createBranchPath -Owner 'Azure' -Repo 'azure-powershell' -BaseBranch 'bernard-pipeline-generation' -NewBranch $generationBranch -Token $token
57
+ Write-Host "##vso[task.setvariable variable=GenerationBranch;isOutput=true]$generationBranch"
56
58
57
59
- task : PowerShell@2
58
60
name : mtrx
@@ -77,6 +79,8 @@ stages:
77
79
ne(dependencies.prepare.outputs['mtrx.generationTargets'], ''),
78
80
ne(dependencies.prepare.outputs['mtrx.generationTargets'], '{}')
79
81
)
82
+ variables :
83
+ GenerationBranch : $[dependencies.prepare.outputs['checkout.GenerationBranch']]
80
84
timeoutInMinutes : ${{ variables.GenerateTimeoutInMinutes }}
81
85
pool : ${{ variables.WindowsAgentPoolName }}
82
86
strategy :
@@ -100,12 +104,11 @@ stages:
100
104
targetType : inline
101
105
pwsh : true
102
106
script : |
103
- git fetch origin "${{ variables. GenerationBranch }} "
104
- git checkout "${{ variables. GenerationBranch }} "
107
+ git fetch origin "$( GenerationBranch) "
108
+ git checkout "$( GenerationBranch) "
105
109
106
110
$batchGenerateModulesPath = Join-Path "$(Build.SourcesDirectory)" '.azure-pipelines' 'PipelineSteps' 'BatchGeneration' 'batch-generate-modules.ps1'
107
111
& $batchGenerateModulesPath -MatrixKey "$(MatrixKey)" -RepoRoot "$(Build.SourcesDirectory)" -CommitTitle "${{ parameters.CommitTitle }}"
108
-
109
112
workingDirectory : $(Build.SourcesDirectory)
110
113
111
114
- task : PublishPipelineArtifact@1
@@ -116,7 +119,10 @@ stages:
116
119
condition : always()
117
120
118
121
- stage : Build
122
+ dependsOn : Generate
119
123
condition : always()
124
+ variables :
125
+ GenerationBranch : $[stageDependencies.Generate.prepare.outputs['checkout.GenerationBranch']]
120
126
jobs :
121
127
- job : filter
122
128
displayName : ' Filter Changed Modules'
@@ -134,8 +140,8 @@ stages:
134
140
targetType : inline
135
141
pwsh : true
136
142
script : |
137
- git fetch origin "${{ variables. GenerationBranch }} "
138
- git checkout "${{ variables. GenerationBranch }} "
143
+ git fetch origin "$( GenerationBranch) "
144
+ git checkout "$( GenerationBranch) "
139
145
140
146
- task : DownloadPipelineArtifact@2
141
147
inputs :
@@ -156,7 +162,7 @@ stages:
156
162
git config user.email "[email protected] "
157
163
git config user.name "azure-powershell-bot"
158
164
159
- Write-Host "Applying all .patch files to ${{ variables. GenerationBranch }} ..."
165
+ Write-Host "Applying all .patch files to "$( GenerationBranch)" ..."
160
166
$patchFiles = Get-ChildItem -Path "$env:PIPELINE_WORKSPACE" -Recurse -Filter *.patch
161
167
162
168
foreach ($patch in $patchFiles) {
@@ -165,8 +171,8 @@ stages:
165
171
}
166
172
167
173
git add .
168
- git commit -m "Apply batch generation patches to ${{ variables.GenerationBranch }}"
169
- git push origin "${{ variables. GenerationBranch }} "
174
+ git commit -m "Autorest Upgration - ${{ parameters.CommitTitle }}"
175
+ git push origin "$( GenerationBranch) "
170
176
171
177
- task : PowerShell@2
172
178
name : mtrx
@@ -229,8 +235,8 @@ stages:
229
235
targetType : inline
230
236
pwsh : true
231
237
script : |
232
- git fetch origin "${{ variables. GenerationBranch }} "
233
- git checkout "${{ variables. GenerationBranch }} "
238
+ git fetch origin "$( GenerationBranch) "
239
+ git checkout "$( GenerationBranch) "
234
240
235
241
$buildModulesPath = Join-Path "$(Build.SourcesDirectory)" '.azure-pipelines' 'PipelineSteps' 'BatchGeneration' 'build-modules.ps1'
236
242
& $buildModulesPath -MatrixKey "$(MatrixKey)" -RepoRoot "$(Build.SourcesDirectory)"
0 commit comments