Skip to content

Commit d846de9

Browse files
Copilotraych1
authored andcommitted
Secure tsp-client usage by using pinned version from package-lock.json
Co-authored-by: raych1 <[email protected]>
1 parent c0f389e commit d846de9

File tree

1 file changed

+23
-9
lines changed

1 file changed

+23
-9
lines changed

eng/common/pipelines/templates/archetype-typespec-emitter.yml

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -259,24 +259,38 @@ extends:
259259
displayName: Download pipeline artifacts
260260

261261
- pwsh: |
262-
npm install -g @azure-tools/typespec-client-generator-cli@latest
262+
Push-Location eng/common/tsp-client
263+
try {
264+
npm ci
265+
} finally {
266+
Pop-Location
267+
}
263268
displayName: Install tsp-client
264269
265270
- pwsh: |
266271
Write-Host "Overrides location: $(buildArtifactsPath)/packages/overrides.json"
267272
268273
if (Test-Path -Path '$(buildArtifactsPath)/packages/overrides.json') {
269274
Write-Host "Using overrides.json to generate emitter-package.json"
270-
tsp-client generate-config-files `
271-
--package-json '$(buildArtifactsPath)/lock-files/package.json' `
272-
--emitter-package-json-path '${{ parameters.EmitterPackageJsonOutputPath }}' `
273-
--overrides '$(buildArtifactsPath)/packages/overrides.json'
275+
Push-Location eng/common/tsp-client
276+
try {
277+
npm exec --no -- tsp-client generate-config-files `
278+
--package-json '$(buildArtifactsPath)/lock-files/package.json' `
279+
--emitter-package-json-path '$(Build.SourcesDirectory)/${{ parameters.EmitterPackageJsonOutputPath }}' `
280+
--overrides '$(buildArtifactsPath)/packages/overrides.json'
281+
} finally {
282+
Pop-Location
283+
}
274284
} else {
275285
Write-Host "No overrides.json found. Running tsp-client without overrides."
276-
277-
tsp-client generate-config-files `
278-
--package-json '$(buildArtifactsPath)/lock-files/package.json' `
279-
--emitter-package-json-path '${{ parameters.EmitterPackageJsonOutputPath }}'
286+
Push-Location eng/common/tsp-client
287+
try {
288+
npm exec --no -- tsp-client generate-config-files `
289+
--package-json '$(buildArtifactsPath)/lock-files/package.json' `
290+
--emitter-package-json-path '$(Build.SourcesDirectory)/${{ parameters.EmitterPackageJsonOutputPath }}'
291+
} finally {
292+
Pop-Location
293+
}
280294
}
281295
displayName: Generate emitter-package.json and emitter-package-lock files
282296
workingDirectory: $(Build.SourcesDirectory)

0 commit comments

Comments
 (0)