Skip to content

Commit b837aa1

Browse files
Get rid of vscode-engineering template in the npm publish pipeline (#1328)
It's been a disaster trying to get the pipeline running from a different org. I keep running into service connection and permission issues, fixing one just reveals two more. At this point it doesn't seem feasible to use the `vscode-engineering` template from another org. I looked at some other pipelines we migrated for extensions like `pylint`, and they dropped the template and just run the raw jobs for npm pack and publishing. I'm going to try the same approach for this extension.
1 parent d747327 commit b837aa1

File tree

3 files changed

+111
-62
lines changed

3 files changed

+111
-62
lines changed

build/azure-pipeline.npm.yml

Lines changed: 111 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,49 +5,124 @@ pr: none
55

66
resources:
77
repositories:
8-
- repository: templates
9-
type: github
10-
name: microsoft/vscode-engineering
11-
ref: main
12-
endpoint: Monaco
8+
- repository: MicroBuildTemplate
9+
type: git
10+
name: 1ESPipelineTemplates/MicroBuildTemplate
11+
ref: refs/tags/release
1312

1413
parameters:
1514
- name: quality
16-
displayName: Quality
15+
displayName: 📦 Release Quality
1716
type: string
18-
default: latest
17+
default: stable
1918
values:
20-
- latest
21-
- next
22-
- name: publishPythonEnvsApi
23-
displayName: 🚀 Publish @vscode/python-environments
19+
- stable
20+
- preview
21+
22+
- name: publishPackage
23+
displayName: 🚀 Publish to npm
2424
type: boolean
2525
default: false
2626

27+
- name: buildSteps
28+
type: stepList
29+
default:
30+
- task: NodeTool@0
31+
inputs:
32+
versionSpec: '22.21.1'
33+
displayName: Select Node version
34+
35+
- script: npm ci
36+
workingDirectory: $(Build.SourcesDirectory)/pythonEnvironmentsApi
37+
displayName: Install package dependencies
38+
39+
- script: npm run compile
40+
workingDirectory: $(Build.SourcesDirectory)/pythonEnvironmentsApi
41+
displayName: Compile TypeScript
42+
43+
- script: npm pack --ignore-scripts
44+
workingDirectory: $(Build.SourcesDirectory)/pythonEnvironmentsApi
45+
displayName: Pack npm package
46+
47+
variables:
48+
- name: TeamName
49+
value: vscode-python-environments
50+
- name: PackageName
51+
value: '@vscode/python-environments'
52+
- name: PackageDir
53+
value: pythonEnvironmentsApi
54+
- name: npmTag
55+
${{ if eq(parameters.quality, 'preview') }}:
56+
value: next
57+
${{ else }}:
58+
value: latest
59+
2760
extends:
28-
template: azure-pipelines/npm-package/pipeline.yml@templates
61+
template: azure-pipelines/MicroBuild.1ES.Official.yml@MicroBuildTemplate
2962
parameters:
30-
npmPackages:
31-
- name: pythonEnvironmentsApi
32-
testPlatforms:
33-
- name: Linux
34-
nodeVersions:
35-
- 22.21.1
36-
- name: MacOS
37-
nodeVersions:
38-
- 22.21.1
39-
- name: Windows
40-
nodeVersions:
41-
- 22.21.1
42-
testSteps:
43-
- template: /build/templates/test-steps.yml@self
44-
parameters:
45-
package: pythonEnvironmentsApi
46-
buildSteps:
47-
- template: /build/templates/pack-steps.yml@self
48-
parameters:
49-
package: pythonEnvironmentsApi
50-
ghTagPrefix: release/pythonEnvironmentsApi/
51-
tag: ${{ parameters.quality }}
52-
publishPackage: ${{ parameters.publishPythonEnvsApi }}
53-
workingDirectory: $(Build.SourcesDirectory)/pythonEnvironmentsApi
63+
sdl:
64+
sourceAnalysisPool: VSEngSS-MicroBuild2022-1ES
65+
codeSignValidation:
66+
enabled: true
67+
sbom:
68+
enabled: true
69+
pool:
70+
name: AzurePipelines-EO
71+
os: windows
72+
73+
customBuildTags:
74+
- ES365AIMigrationTooling
75+
76+
stages:
77+
- stage: Build
78+
displayName: Build & Pack
79+
jobs:
80+
- job: BuildPackage
81+
displayName: Build npm package
82+
steps:
83+
- ${{ each step in parameters.buildSteps }}:
84+
- ${{ step }}
85+
86+
- task: CopyFiles@2
87+
displayName: Copy package tarball to staging
88+
inputs:
89+
sourceFolder: $(Build.SourcesDirectory)/pythonEnvironmentsApi
90+
contents: '*.tgz'
91+
targetFolder: $(Build.ArtifactStagingDirectory)
92+
93+
- task: 1ES.PublishBuildArtifacts@1
94+
displayName: Publish build artifact
95+
inputs:
96+
pathToPublish: $(Build.ArtifactStagingDirectory)
97+
artifactName: npm-package
98+
99+
- stage: Publish
100+
displayName: Publish to npm
101+
dependsOn: Build
102+
condition: and(succeeded(), eq('${{ parameters.publishPackage }}', 'true'))
103+
jobs:
104+
- job: PublishPackage
105+
displayName: Publish $(PackageName)
106+
steps:
107+
- task: DownloadBuildArtifacts@1
108+
displayName: Download build artifact
109+
inputs:
110+
buildType: current
111+
downloadType: single
112+
artifactName: npm-package
113+
downloadPath: $(Build.ArtifactStagingDirectory)
114+
115+
- task: NodeTool@0
116+
inputs:
117+
versionSpec: '22.21.1'
118+
displayName: Select Node version
119+
120+
- bash: echo '//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}' > .npmrc
121+
workingDirectory: $(Build.SourcesDirectory)/pythonEnvironmentsApi
122+
displayName: Configure npm auth
123+
124+
- bash: npm publish $(Build.ArtifactStagingDirectory)/npm-package/*.tgz --tag $(npmTag) --access public
125+
displayName: Publish to npm (${{ parameters.quality }})
126+
workingDirectory: $(Build.SourcesDirectory)/pythonEnvironmentsApi
127+
env:
128+
NODE_AUTH_TOKEN: $(NpmAuthToken)

build/templates/pack-steps.yml

Lines changed: 0 additions & 7 deletions
This file was deleted.

build/templates/test-steps.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)