Skip to content

Commit 4c0b88e

Browse files
authored
[Eng] Support Typespec based module in pipelines (#27298)
1 parent 4d66f25 commit 4c0b88e

File tree

6 files changed

+39
-11
lines changed

6 files changed

+39
-11
lines changed

.azure-pipelines/azure-powershell-ci.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ jobs:
9999
- task: NodeTool@0
100100
displayName: Install Autorest
101101
inputs:
102-
versionSpec: '14.17.1'
102+
versionSpec: '18.20.7'
103103
command: custom
104104
verbose: false
105105
customCommand: install autorest@latest
@@ -109,7 +109,11 @@ jobs:
109109
targetType: inline
110110
script: "$env:NODE_OPTIONS=\"--max-old-space-size=65536\""
111111
pwsh: true
112-
112+
- task: Npm@1
113+
displayName: Install tsp client
114+
inputs:
115+
command: custom
116+
customCommand: install -g @azure-tools/[email protected]
113117
- task: PowerShell@2
114118
displayName: 'Build'
115119
inputs:

.azure-pipelines/powershell-core.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
- task: NodeTool@0
4848
displayName: Install Autorest
4949
inputs:
50-
versionSpec: '14.17.1'
50+
versionSpec: '18.20.7'
5151
command: custom
5252
verbose: false
5353
customCommand: install autorest@latest
@@ -57,6 +57,11 @@ jobs:
5757
targetType: inline
5858
script: "$env:NODE_OPTIONS=\"--max-old-space-size=65536\""
5959
pwsh: true
60+
- task: Npm@1
61+
displayName: Install tsp client
62+
inputs:
63+
command: custom
64+
customCommand: install -g @azure-tools/[email protected]
6065
- task: PowerShell@2
6166
displayName: 'Build'
6267
inputs:

.azure-pipelines/security-tools.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
- task: NodeTool@0
2828
displayName: Install Autorest
2929
inputs:
30-
versionSpec: '14.17.1'
30+
versionSpec: '18.20.7'
3131
command: custom
3232
verbose: false
3333
customCommand: install autorest@latest
@@ -37,6 +37,11 @@ jobs:
3737
targetType: inline
3838
script: "$env:NODE_OPTIONS=\"--max-old-space-size=65536\""
3939
pwsh: true
40+
- task: Npm@1
41+
displayName: Install tsp client
42+
inputs:
43+
command: custom
44+
customCommand: install -g @azure-tools/[email protected]
4045
- task: PowerShell@2
4146
displayName: 'Build'
4247
inputs:

.azure-pipelines/util/analyze-steps.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ steps:
1111
- task: NodeTool@0
1212
displayName: Install autorest
1313
inputs:
14-
versionSpec: '14.17.1'
14+
versionSpec: '18.20.7'
1515
command: custom
1616
verbose: false
1717
customCommand: install autorest@latest
@@ -21,7 +21,11 @@ steps:
2121
targetType: inline
2222
script: "$env:NODE_OPTIONS=\"--max-old-space-size=65536\""
2323
pwsh: true
24-
24+
- task: Npm@1
25+
displayName: Install tsp client
26+
inputs:
27+
command: custom
28+
customCommand: install -g @azure-tools/[email protected]
2529
- task: UseDotNet@2
2630
displayName: 'Use .NET Core sdk 6.0.x'
2731
inputs:

.azure-pipelines/windows-powershell.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
- task: NodeTool@0
4444
displayName: Install Autorest
4545
inputs:
46-
versionSpec: '14.17.1'
46+
versionSpec: '18.20.7'
4747
command: custom
4848
verbose: false
4949
customCommand: install autorest@latest
@@ -53,6 +53,11 @@ jobs:
5353
targetType: inline
5454
script: "$env:NODE_OPTIONS=\"--max-old-space-size=65536\""
5555
pwsh: true
56+
- task: Npm@1
57+
displayName: Install tsp client
58+
inputs:
59+
command: custom
60+
customCommand: install -g @azure-tools/[email protected]
5661
- task: PowerShell@2
5762
displayName: 'Build'
5863
inputs:

tools/BuildScripts/BuildScripts.psm1

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,17 @@ function Invoke-SubModuleGeneration {
8686
)
8787
Write-Host "----------Start code generation for $GenerateDirectory----------" -ForegroundColor DarkGreen
8888
Set-Location -Path $GenerateDirectory
89-
if ($IsInvokedByPipeline) {
90-
npx autorest --max-memory-size=8192 >> $GenerateLog
89+
$tspLocationPath = Join-Path $GenerateDirectory "tsp-location.yaml"
90+
if (Test-Path $tspLocationPath) {
91+
tsp-client update >> $GenerateLog
9192
} else {
92-
autorest --max-memory-size=8192 >> $GenerateLog
93+
if ($IsInvokedByPipeline) {
94+
npx autorest --max-memory-size=8192 >> $GenerateLog
95+
} else {
96+
autorest --max-memory-size=8192 >> $GenerateLog
97+
}
9398
}
94-
99+
95100
if ($lastexitcode -ne 0) {
96101
return $false
97102
} else {

0 commit comments

Comments
 (0)