1- parameters :
2- - name : AutorestVersion
3- displayName : ' Version of Autorest that trigger batch generation'
4- type : string
5- default : ' 4.x.x'
6-
71variables :
82 IntermediateStepTimeoutInMinutes : 30
93 GenerateTimeoutInMinutes : 120
@@ -23,6 +17,13 @@ variables:
2317
2418trigger : none
2519
20+ resources :
21+ pipelines :
22+ - pipeline : pipelineA
23+ project : release
24+ source : pipelineA
25+ trigger : true
26+
2627stages :
2728 - stage : Generate
2829 jobs :
@@ -55,6 +56,19 @@ stages:
5556 & $createBranchPath -Owner 'Azure' -Repo 'azure-powershell' -BaseBranch "$(GenerationBaseBranch)" -NewBranch $generationBranch -Token $token
5657 Write-Host "##vso[task.setvariable variable=GenerationBranch;isOutput=true]$generationBranch"
5758
59+ - task : PowerShell@2
60+ name : version
61+ displayName : ' Get latest Autorest Version'
62+ inputs :
63+ targetType : inline
64+ pwsh : true
65+ script : |
66+ $autorestPowershellUrl = "https://registry.npmjs.org/@autorest/powershell"
67+ $response = Invoke-RestMethod -Uri $autorestPowershellUrl -Method Get
68+ $latestAutorestVersion = $response.'dist-tags'.latest
69+ Write-Host "Latest version of Autorest Powershell is $latestAutorestVersion"
70+ Write-Host "##vso[task.setvariable variable=LatestAutorestVersion;isOutput=true]$latestAutorestVersion"
71+
5872 - task : PowerShell@2
5973 name : mtrx
6074 displayName : ' Generate Build Targets Matrix'
@@ -80,6 +94,7 @@ stages:
8094 )
8195 variables :
8296 GenerationBranch : $[dependencies.prepare.outputs['checkout.GenerationBranch']]
97+ LatestAutorestVersion : $[dependencies.prepare.outputs['version.LatestAutorestVersion']]
8398 timeoutInMinutes : ${{ variables.GenerateTimeoutInMinutes }}
8499 pool : ${{ variables.WindowsAgentPoolName }}
85100 strategy :
@@ -107,7 +122,7 @@ stages:
107122 git checkout "$(GenerationBranch)"
108123
109124 $batchGenerateModulesPath = Join-Path "$(Build.SourcesDirectory)" '.azure-pipelines' 'PipelineSteps' 'BatchGeneration' 'batch-generate-modules.ps1'
110- & $batchGenerateModulesPath -MatrixKey "$(MatrixKey)" -RepoRoot "$(Build.SourcesDirectory)" -AutorestVersion "${{ parameters.AutorestVersion }} "
125+ & $batchGenerateModulesPath -MatrixKey "$(MatrixKey)" -RepoRoot "$(Build.SourcesDirectory)" -AutorestVersion "$(LatestAutorestVersion) "
111126 workingDirectory : $(Build.SourcesDirectory)
112127
113128 - task : PublishPipelineArtifact@1
@@ -122,6 +137,7 @@ stages:
122137 condition : always()
123138 variables :
124139 GenerationBranch : $[stageDependencies.Generate.prepare.outputs['checkout.GenerationBranch']]
140+ LatestAutorestVersion : $[stageDependencies.Generate.prepare.outputs['version.LatestAutorestVersion']]
125141 jobs :
126142 - job : filter
127143 displayName : ' Filter Changed Modules'
@@ -170,7 +186,7 @@ stages:
170186 }
171187
172188 git add .
173- git commit -m "Autorest Upgrade - ${{ parameters.AutorestVersion }} "
189+ git commit -m "Autorest Upgrade - $(GenerationBranch) "
174190 git push origin "$(GenerationBranch)"
175191
176192 - task : PowerShell@2
0 commit comments