@@ -33,11 +33,6 @@ parameters:
3333 type : boolean
3434 default : false
3535
36- - name : runAPIScan
37- displayName : Run API Scan
38- type : boolean
39- default : true
40-
4136variables :
4237 - name : TeamName
4338 value : vscode-python
@@ -47,6 +42,8 @@ variables:
4742 value : pythonExtensionApi
4843 - name : NodeVersion
4944 value : ' 22.21.1'
45+ - name : AZURE_ARTIFACTS_FEED
46+ value : ' https://devdiv.pkgs.visualstudio.com/DevDiv/_packaging/DevDiv_PublicPackages/npm/registry/'
5047 - name : NpmTag
5148 value : ${{ parameters.quality }}
5249
@@ -87,21 +84,8 @@ extends:
8784 - stage : Build
8885 displayName : Build, test, and pack
8986 jobs :
90- - job : ValidateConfiguration
91- displayName : Validate pipeline parameters
92- steps :
93- - ${{ if and(eq(parameters.publishPythonApi, true), eq(parameters.runAPIScan, false)) }} :
94- - bash : |
95- echo "Publishing requires API Scan. Set runAPIScan to true." >&2
96- exit 1
97- displayName: Reject publishing without API Scan
98- - ${{ else }} :
99- - bash : echo "Pipeline parameter validation passed."
100- displayName : Validate parameters
101-
10287 - job : Linux_Node_22_21_1
10388 displayName : Linux (Node.js 22.21.1)
104- dependsOn : ValidateConfiguration
10589 timeoutInMinutes : 30
10690 pool :
10791 name : AzurePipelines-EO
@@ -114,15 +98,32 @@ extends:
11498 - template : azure-pipelines/extension/templates/steps/setup.yml@templates
11599 parameters :
116100 installPython : false
101+ customNPMRegistry : $(AZURE_ARTIFACTS_FEED)
117102 nodeVersion : $(NodeVersion)
118103
104+ - pwsh : |
105+ $registry = '$(AZURE_ARTIFACTS_FEED)'
106+ Set-Location '$(Build.SourcesDirectory)'
107+ npm config set '@types:registry' $registry --location=project
108+ if ($LASTEXITCODE -ne 0) {
109+ throw 'Failed to configure the @types npm registry.'
110+ }
111+
112+ foreach ($key in @('registry', '@types:registry')) {
113+ $effectiveRegistry = (npm config get $key | Out-String).Trim()
114+ if ($LASTEXITCODE -ne 0 -or $effectiveRegistry.TrimEnd('/') -ne $registry.TrimEnd('/')) {
115+ throw "Unexpected npm registry for ${key}: $effectiveRegistry"
116+ }
117+ Write-Host "${key}: $effectiveRegistry"
118+ }
119+ displayName: Route npm dependencies through CFS
120+
119121 - template : /build/azure-pipelines/templates/test-steps.yml@self
120122 parameters :
121123 package : $(PackageDirectory)
122124
123125 - job : MacOS_Node_22_21_1
124126 displayName : macOS (Node.js 22.21.1)
125- dependsOn : ValidateConfiguration
126127 timeoutInMinutes : 30
127128 pool :
128129 name : Azure Pipelines
@@ -137,15 +138,32 @@ extends:
137138 - template : azure-pipelines/extension/templates/steps/setup.yml@templates
138139 parameters :
139140 installPython : false
141+ customNPMRegistry : $(AZURE_ARTIFACTS_FEED)
140142 nodeVersion : $(NodeVersion)
141143
144+ - pwsh : |
145+ $registry = '$(AZURE_ARTIFACTS_FEED)'
146+ Set-Location '$(Build.SourcesDirectory)'
147+ npm config set '@types:registry' $registry --location=project
148+ if ($LASTEXITCODE -ne 0) {
149+ throw 'Failed to configure the @types npm registry.'
150+ }
151+
152+ foreach ($key in @('registry', '@types:registry')) {
153+ $effectiveRegistry = (npm config get $key | Out-String).Trim()
154+ if ($LASTEXITCODE -ne 0 -or $effectiveRegistry.TrimEnd('/') -ne $registry.TrimEnd('/')) {
155+ throw "Unexpected npm registry for ${key}: $effectiveRegistry"
156+ }
157+ Write-Host "${key}: $effectiveRegistry"
158+ }
159+ displayName: Route npm dependencies through CFS
160+
142161 - template : /build/azure-pipelines/templates/test-steps.yml@self
143162 parameters :
144163 package : $(PackageDirectory)
145164
146165 - job : Windows_Node_22_21_1
147166 displayName : Windows (Node.js 22.21.1)
148- dependsOn : ValidateConfiguration
149167 timeoutInMinutes : 30
150168 pool :
151169 name : AzurePipelines-EO
@@ -158,8 +176,26 @@ extends:
158176 - template : azure-pipelines/extension/templates/steps/setup.yml@templates
159177 parameters :
160178 installPython : false
179+ customNPMRegistry : $(AZURE_ARTIFACTS_FEED)
161180 nodeVersion : $(NodeVersion)
162181
182+ - pwsh : |
183+ $registry = '$(AZURE_ARTIFACTS_FEED)'
184+ Set-Location '$(Build.SourcesDirectory)'
185+ npm config set '@types:registry' $registry --location=project
186+ if ($LASTEXITCODE -ne 0) {
187+ throw 'Failed to configure the @types npm registry.'
188+ }
189+
190+ foreach ($key in @('registry', '@types:registry')) {
191+ $effectiveRegistry = (npm config get $key | Out-String).Trim()
192+ if ($LASTEXITCODE -ne 0 -or $effectiveRegistry.TrimEnd('/') -ne $registry.TrimEnd('/')) {
193+ throw "Unexpected npm registry for ${key}: $effectiveRegistry"
194+ }
195+ Write-Host "${key}: $effectiveRegistry"
196+ }
197+ displayName: Route npm dependencies through CFS
198+
163199 - template : /build/azure-pipelines/templates/test-steps.yml@self
164200 parameters :
165201 package : $(PackageDirectory)
@@ -187,8 +223,26 @@ extends:
187223 - template : azure-pipelines/extension/templates/steps/setup.yml@templates
188224 parameters :
189225 installPython : false
226+ customNPMRegistry : $(AZURE_ARTIFACTS_FEED)
190227 nodeVersion : $(NodeVersion)
191228
229+ - pwsh : |
230+ $registry = '$(AZURE_ARTIFACTS_FEED)'
231+ Set-Location '$(Build.SourcesDirectory)'
232+ npm config set '@types:registry' $registry --location=project
233+ if ($LASTEXITCODE -ne 0) {
234+ throw 'Failed to configure the @types npm registry.'
235+ }
236+
237+ foreach ($key in @('registry', '@types:registry')) {
238+ $effectiveRegistry = (npm config get $key | Out-String).Trim()
239+ if ($LASTEXITCODE -ne 0 -or $effectiveRegistry.TrimEnd('/') -ne $registry.TrimEnd('/')) {
240+ throw "Unexpected npm registry for ${key}: $effectiveRegistry"
241+ }
242+ Write-Host "${key}: $effectiveRegistry"
243+ }
244+ displayName: Route npm dependencies through CFS
245+
192246 - template : /build/azure-pipelines/templates/pack-steps.yml@self
193247 parameters :
194248 package : $(PackageDirectory)
@@ -197,99 +251,11 @@ extends:
197251 workingDirectory : $(Build.SourcesDirectory)/$(PackageDirectory)
198252 displayName : Pack npm package
199253
200- - ${{ if eq(parameters.runAPIScan, true) }} :
201- - stage : APIScan
202- displayName : API Scan
203- dependsOn : Build
204- condition : succeeded()
205- jobs :
206- - job : APIScan
207- displayName : Scan packed API
208- timeoutInMinutes : 30
209- pool :
210- name : VSEng-MicroBuildVSStable
211- os : windows
212- steps :
213- - checkout : self
214- clean : true
215-
216- - task : DownloadPipelineArtifact@2
217- inputs :
218- artifactName : pythonExtensionApi
219- targetPath : $(Agent.TempDirectory)/pythonExtensionApi
220- displayName : Download npm package
221-
222- - task : ExtractFiles@1
223- inputs :
224- archiveFilePatterns : $(Agent.TempDirectory)/pythonExtensionApi/*.tgz
225- destinationFolder : $(Agent.TempDirectory)/apiscan
226- cleanDestinationFolder : true
227- displayName : Extract package for API Scan
228-
229- - pwsh : |
230- $packageJsonPath = '$(Agent.TempDirectory)/apiscan/package/package.json'
231- $packageVersion = (Get-Content -LiteralPath $packageJsonPath -Raw | ConvertFrom-Json).version
232- if ([string]::IsNullOrWhiteSpace($packageVersion)) {
233- throw "Package version was not found in $packageJsonPath."
234- }
235-
236- Write-Host "##vso[task.setvariable variable=PackageVersion]$packageVersion"
237- Write-Host "Package version: $packageVersion"
238- displayName: Read package version
239-
240- - pwsh : |
241- $config = @{
242- areaPath = 'DevDiv\Python and AI Tools\Python\VS Code'
243- codebaseName = 'devdiv_microsoft_vscode_python'
244- instanceUrl = 'https://devdiv.visualstudio.com/defaultcollection'
245- notificationAliases = @('brcan@microsoft.com', 'plseng@microsoft.com')
246- serviceTreeID = '6e6194bc-7baa-4486-86d0-9f5419626d46'
247- projectName = 'DevDiv'
248- } | ConvertTo-Json -Depth 4
249-
250- $configDirectory = Join-Path '$(Build.SourcesDirectory)' '.config'
251- New-Item -Path $configDirectory -ItemType Directory -Force | Out-Null
252- $configPath = Join-Path $configDirectory 'tsaoptions.json'
253- Set-Content -Path $configPath -Value $config
254- Get-Content -Path $configPath
255- displayName: Generate TSA configuration
256-
257- # Pipeline definition 28954 must authorize the shared VSEng-APIScanSC
258- # service connection once before this job can run.
259- - task : APIScan@2
260- inputs :
261- softwareFolder : $(Agent.TempDirectory)/apiscan/package
262- softwareName : pythonExtensionApi
263- softwareVersionNum : $(PackageVersion)
264- symbolsFolder : ' SRV*https://symweb.azurefd.net;$(Agent.TempDirectory)/apiscan'
265- isLargeApp : false
266- toolVersion : Latest
267- azureSubscription : VSEng-APIScanSC
268- env :
269- SYSTEM_ACCESSTOKEN : $(System.AccessToken)
270- displayName : Run API Scan
271-
272- - task : PublishSecurityAnalysisLogs@3
273- inputs :
274- ArtifactName : CodeAnalysisLogs
275- ArtifactType : Container
276- AllTools : true
277- ToolLogsNotFoundAction : Standard
278- displayName : Publish API Scan logs
279-
280- - task : securedevelopmentteam.vss-secure-development-tools.build-task-uploadtotsa.TSAUpload@2
281- continueOnError : true
282- inputs :
283- GdnPublishTsaConfigFile : $(Build.SourcesDirectory)/.config/tsaoptions.json
284- GdnPublishTsaOnboard : true
285- displayName : TSA Upload
286-
287254 - stage : Publish
288255 displayName : Publish npm package
289- ${{ if eq(parameters.runAPIScan, true) }} :
290- dependsOn : APIScan
291- ${{ else }} :
292- dependsOn : Build
256+ dependsOn :
257+ - Build
258+ - SDLSources
293259 condition : and(succeeded(), eq('${{ parameters.publishPythonApi }}', 'true'), eq(variables['Build.Reason'], 'Manual'), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
294260 jobs :
295261 - job : ApprovePublish
@@ -308,7 +274,7 @@ extends:
308274 approvers : ' plseng@microsoft.com'
309275 allowApproversToApproveTheirOwnRuns : false
310276 instructions : |
311- Review the completed build, tests, package, and security scan results.
277+ Review the completed build, tests, package, and security analysis results.
312278 Resume only to publish the validated package to public npm through ESRP.
313279 onTimeout : reject
314280
0 commit comments