Skip to content

Commit 6aa0758

Browse files
authored
chore: migrate pipeline to use 1ES template (#676)
1 parent 3913479 commit 6aa0758

File tree

2 files changed

+178
-157
lines changed

2 files changed

+178
-157
lines changed
File renamed without changes.

azure-pipelines.yml

Lines changed: 178 additions & 157 deletions
Original file line numberDiff line numberDiff line change
@@ -3,170 +3,191 @@
33
# Add steps that analyze code, save build artifacts, deploy, and more:
44
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript
55

6-
jobs:
7-
- job: Linux
8-
pool:
9-
vmImage: 'ubuntu-latest'
10-
strategy:
11-
matrix:
12-
node_16_x:
13-
node_version: 16.x
14-
node_18_x:
15-
node_version: 18.x
16-
steps:
17-
- task: NodeTool@0
18-
inputs:
19-
versionSpec: $(node_version)
20-
displayName: 'Install Node.js'
21-
- script: |
22-
npm i
23-
displayName: 'Install dependencies and build'
24-
- script: |
25-
npm test
26-
displayName: 'Test'
27-
- script: |
28-
npm run lint
29-
displayName: 'Lint'
6+
resources:
7+
repositories:
8+
- repository: 1esPipelines
9+
type: git
10+
name: 1ESPipelineTemplates/1ESPipelineTemplates
11+
ref: refs/tags/release
3012

31-
- job: macOS
32-
pool:
33-
vmImage: 'macOS-latest'
34-
strategy:
35-
matrix:
36-
node_16_x:
37-
node_version: 16.x
38-
node_18_x:
39-
node_version: 18.x
40-
steps:
41-
- task: NodeTool@0
42-
inputs:
43-
versionSpec: $(node_version)
44-
displayName: 'Install Node.js'
45-
- script: |
46-
python3 -m pip install setuptools
47-
displayName: Install setuptools (macOS)
48-
- script: |
49-
npm i
50-
displayName: 'Install dependencies and build'
51-
- script: |
52-
npm test
53-
displayName: 'Test'
54-
- script: |
55-
npm run lint
56-
displayName: 'Lint'
13+
extends:
14+
template: v1/1ES.Official.PipelineTemplate.yml@1esPipelines
15+
parameters:
16+
sdl:
17+
sourceAnalysisPool: 1es-oss-windows-2022-x64
18+
tsa:
19+
enabled: true
20+
stages:
21+
- stage: Build
22+
jobs:
23+
- job: Linux
24+
pool:
25+
name: 1es-oss-ubuntu-22.04-x64
26+
os: Linux
27+
strategy:
28+
matrix:
29+
node_16_x:
30+
node_version: 16.x
31+
node_18_x:
32+
node_version: 18.x
33+
steps:
34+
- task: NodeTool@0
35+
inputs:
36+
versionSpec: $(node_version)
37+
displayName: 'Install Node.js'
38+
- script: |
39+
npm i
40+
displayName: 'Install dependencies and build'
41+
- script: |
42+
npm test
43+
displayName: 'Test'
44+
- script: |
45+
npm run lint
46+
displayName: 'Lint'
5747
58-
- job: Windows
59-
pool:
60-
vmImage: 'windows-latest'
61-
strategy:
62-
matrix:
63-
node_16_x:
64-
node_version: 16.x
65-
node_18_x:
66-
node_version: 18.x
67-
steps:
68-
- task: NodeTool@0
69-
inputs:
70-
versionSpec: $(node_version)
71-
displayName: 'Install Node.js'
72-
- script: |
73-
npm i
74-
displayName: 'Install dependencies and build'
75-
- script: |
76-
npm test
77-
displayName: 'Test'
78-
- script: |
79-
npm run lint
80-
displayName: 'Lint'
48+
- job: macOS
49+
pool:
50+
name: Azure Pipelines
51+
vmImage: 'macOS-latest'
52+
os: macOS
53+
strategy:
54+
matrix:
55+
node_16_x:
56+
node_version: 16.x
57+
node_18_x:
58+
node_version: 18.x
59+
steps:
60+
- task: NodeTool@0
61+
inputs:
62+
versionSpec: $(node_version)
63+
displayName: 'Install Node.js'
64+
- script: |
65+
python3 -m pip install setuptools
66+
displayName: Install setuptools (macOS)
67+
- script: |
68+
npm i
69+
displayName: 'Install dependencies and build'
70+
- script: |
71+
npm test
72+
displayName: 'Test'
73+
- script: |
74+
npm run lint
75+
displayName: 'Lint'
8176
82-
- job: APIScan
83-
dependsOn: []
84-
pool:
85-
vmImage: 'windows-latest'
86-
strategy:
87-
matrix:
88-
node_18_x:
89-
node_version: 18.x
90-
steps:
91-
- task: NodeTool@0
92-
inputs:
93-
versionSpec: $(node_version)
94-
displayName: 'Install Node.js'
95-
- pwsh: |
96-
$includes = @'
97-
{
98-
'target_defaults': {
99-
'conditions': [
100-
['OS=="win"', {
101-
'msvs_settings': {
102-
'VCCLCompilerTool': {
103-
'AdditionalOptions': [
104-
'/Zi',
105-
'/FS'
106-
],
107-
},
108-
'VCLinkerTool': {
109-
'AdditionalOptions': [
110-
'/profile'
77+
- job: Windows
78+
pool:
79+
name: 1es-oss-windows-2022-x64
80+
os: Windows
81+
strategy:
82+
matrix:
83+
node_16_x:
84+
node_version: 16.x
85+
node_18_x:
86+
node_version: 18.x
87+
steps:
88+
- task: NodeTool@0
89+
inputs:
90+
versionSpec: $(node_version)
91+
displayName: 'Install Node.js'
92+
- script: |
93+
npm i
94+
displayName: 'Install dependencies and build'
95+
- script: |
96+
npm test
97+
displayName: 'Test'
98+
- script: |
99+
npm run lint
100+
displayName: 'Lint'
101+
102+
- job: APIScan
103+
dependsOn: []
104+
pool:
105+
name: 1es-oss-windows-2022-x64
106+
os: Windows
107+
strategy:
108+
matrix:
109+
node_18_x:
110+
node_version: 18.x
111+
steps:
112+
- task: NodeTool@0
113+
inputs:
114+
versionSpec: $(node_version)
115+
displayName: 'Install Node.js'
116+
- pwsh: |
117+
$includes = @'
118+
{
119+
'target_defaults': {
120+
'conditions': [
121+
['OS=="win"', {
122+
'msvs_settings': {
123+
'VCCLCompilerTool': {
124+
'AdditionalOptions': [
125+
'/Zi',
126+
'/FS'
127+
],
128+
},
129+
'VCLinkerTool': {
130+
'AdditionalOptions': [
131+
'/profile'
132+
]
133+
}
134+
}
135+
}]
111136
]
112137
}
113138
}
114-
}]
115-
]
116-
}
117-
}
118-
'@
119-
120-
if (!(Test-Path "~/.gyp")) {
121-
mkdir "~/.gyp"
122-
echo $includes > "~/.gyp/include.gypi"
123-
}
124-
displayName: Create include.gypi
125-
- script: |
126-
npm i
127-
displayName: 'Install dependencies and build'
128-
129-
- task: APIScan@2
130-
inputs:
131-
softwareFolder: $(Build.SourcesDirectory)\build\Release
132-
softwareName: 'vscode-node-pty'
133-
softwareVersionNum: '1'
134-
isLargeApp: false
135-
toolVersion: 'Latest'
136-
displayName: Run ApiScan
137-
condition: succeeded()
138-
env:
139-
AzureServicesAuthConnectionString: $(apiscan-connectionstring)
139+
'@
140140
141-
- task: PublishSecurityAnalysisLogs@3
142-
inputs:
143-
ArtifactName: CodeAnalysisLogs
144-
ArtifactType: Container
145-
PublishProcessedResults: false
146-
AllTools: true
141+
if (!(Test-Path "~/.gyp")) {
142+
mkdir "~/.gyp"
143+
echo $includes > "~/.gyp/include.gypi"
144+
}
145+
displayName: Create include.gypi
146+
- script: |
147+
npm i
148+
displayName: 'Install dependencies and build'
147149
148-
- task: TSAUpload@2
149-
inputs:
150-
GdnPublishTsaOnboard: true
151-
GdnPublishTsaConfigFile: '$(Build.SourcesDirectory)\tsaoptions.json'
150+
- task: APIScan@2
151+
inputs:
152+
softwareFolder: $(Build.SourcesDirectory)\build\Release
153+
softwareName: 'vscode-node-pty'
154+
softwareVersionNum: '1'
155+
isLargeApp: false
156+
toolVersion: 'Latest'
157+
displayName: Run ApiScan
158+
condition: succeeded()
159+
env:
160+
AzureServicesAuthConnectionString: $(apiscan-connectionstring)
152161

153-
- job: Release
154-
dependsOn:
155-
- Linux
156-
- macOS
157-
- Windows
158-
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
159-
pool:
160-
vmImage: 'ubuntu-latest'
161-
steps:
162-
- task: NodeTool@0
163-
inputs:
164-
versionSpec: '18.x'
165-
displayName: 'Install Node.js'
166-
- script: |
167-
npm i
168-
displayName: 'Install dependencies and build'
169-
- script: |
170-
NPM_AUTH_TOKEN="$(NPM_AUTH_TOKEN)" node ./scripts/publish.js
171-
displayName: 'Publish to npm'
162+
- task: PublishSecurityAnalysisLogs@3
163+
inputs:
164+
ArtifactName: CodeAnalysisLogs
165+
ArtifactType: Container
166+
PublishProcessedResults: false
167+
AllTools: true
172168

169+
- stage: Release
170+
dependsOn: Build
171+
jobs:
172+
- job: Release
173+
condition: eq(variables['Build.SourceBranch'], 'refs/heads/main')
174+
# Output artifact to produce SBOM and to run SDL checks
175+
templateContext:
176+
outputs:
177+
- output: pipelineArtifact
178+
targetPath: $(Build.SourcesDirectory)
179+
artifactName: drop
180+
pool:
181+
name: 1es-oss-ubuntu-22.04-x64
182+
os: Linux
183+
steps:
184+
- task: NodeTool@0
185+
inputs:
186+
versionSpec: '18.x'
187+
displayName: 'Install Node.js'
188+
- script: |
189+
npm i
190+
displayName: 'Install dependencies and build'
191+
- script: |
192+
NPM_AUTH_TOKEN="$(NPM_AUTH_TOKEN)" node ./scripts/publish.js
193+
displayName: 'Publish to npm'

0 commit comments

Comments
 (0)