Skip to content

Commit a50b77a

Browse files
Seperating CI/PR yml from release yml to seperate out the pipelines (#647)
* Seperating CI/PR yml from release yml to seperate out the pipelines * Updating the location for the files * updating references --------- Co-authored-by: Tarun R <>
1 parent 0de04b5 commit a50b77a

File tree

3 files changed

+147
-91
lines changed

3 files changed

+147
-91
lines changed
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# Release Pipeline - Build, Test, and Release
2+
# This pipeline will be extended to the OneESPT template
3+
trigger: none
4+
resources:
5+
repositories:
6+
- repository: 1ESPipelineTemplates
7+
type: git
8+
name: 1ESPipelineTemplates/1ESPipelineTemplates
9+
ref: refs/tags/release
10+
extends:
11+
template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates
12+
parameters:
13+
sdl:
14+
sbom:
15+
enabled: false
16+
sourceAnalysisPool:
17+
name: 1ES-ABTT-Shared-Pool
18+
image: abtt-windows-2022
19+
os: windows
20+
pool:
21+
name: 1ES-ABTT-Shared-Pool
22+
image: abtt-ubuntu-2204
23+
os: linux
24+
customBuildTags:
25+
- ES365AIMigrationTooling
26+
stages:
27+
- stage: Build
28+
displayName: Build and Prerelease
29+
jobs:
30+
- template: .azure-pipelines/build-template.yml@self
31+
- job: PublishPrerelease
32+
displayName: Publish Prerelease
33+
dependsOn: BuildAndTest
34+
condition: and(succeeded(), in(variables['build.reason'], 'IndividualCI', 'BatchedCI', 'Manual'), eq(variables['build.sourcebranchname'], 'master'))
35+
steps:
36+
- task: NodeTool@0
37+
inputs:
38+
versionSpec: '16.x'
39+
displayName: Install node
40+
- script: npm install -g npm@8
41+
displayName: Upgrade npm
42+
- task: NpmAuthenticate@0
43+
inputs:
44+
workingFile: .npmrc
45+
- script: npm install
46+
displayName: npm install
47+
- script: npm run build
48+
displayName: npm run build
49+
- task: Npm@1
50+
displayName: Publish azure-devops-node-api to npm
51+
inputs:
52+
command: custom
53+
customCommand: publish --tag prerelease
54+
workingDir: '_build'
55+
publishRegistry: useExternalRegistry
56+
customEndpoint: btt-npm-publish-token
57+
publishEndpoint: btt-npm-publish-token
58+
continueOnError: true
59+
- stage: Release
60+
displayName: Release to Latest
61+
trigger: manual
62+
dependsOn: Build
63+
jobs:
64+
- job: Release
65+
displayName: Release to Latest
66+
steps:
67+
- checkout: self
68+
clean: true
69+
- task: NodeTool@0
70+
inputs:
71+
versionSpec: 16.x
72+
displayName: Install node
73+
- task: NpmAuthenticate@0
74+
inputs:
75+
workingFile: .npmrc
76+
- script: npm install
77+
displayName: npm install
78+
- script: npm run build
79+
displayName: npm run build
80+
- bash: |
81+
package_name=$(npm pkg get name version | jq -r '"\(.name)@\(.version)"')
82+
echo "##vso[task.setvariable variable=npm_package]$package_name"
83+
workingDirectory: '_build'
84+
displayName: Get package name and version
85+
- task: Npm@1
86+
displayName: Remove prerelease tag for azure-devops-node-api in Npm
87+
condition: and(succeeded(), in(variables['build.reason'], 'IndividualCI', 'BatchedCI', 'Manual'), eq(variables['build.sourcebranchname'], 'master'))
88+
inputs:
89+
command: custom
90+
customCommand: dist-tag remove "$(npm_package)" prerelease
91+
workingDir: '_build'
92+
publishRegistry: useExternalRegistry
93+
customEndpoint: btt-npm-publish-token
94+
publishEndpoint: btt-npm-publish-token
95+
- task: Npm@1
96+
displayName: Add latest tag for azure-devops-node-api in Npm
97+
condition: and(succeeded(), in(variables['build.reason'], 'IndividualCI', 'BatchedCI', 'Manual'), eq(variables['build.sourcebranchname'], 'master'))
98+
inputs:
99+
command: custom
100+
customCommand: dist-tag add "$(npm_package)" latest
101+
workingDir: '_build'
102+
publishRegistry: useExternalRegistry
103+
customEndpoint: btt-npm-publish-token
104+
publishEndpoint: btt-npm-publish-token
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Shared template for build and test steps
2+
parameters:
3+
- name: nodeVersions
4+
type: object
5+
default:
6+
'Node 16':
7+
versionSpec: '16.x'
8+
npmVersion: '8'
9+
'Node 18':
10+
versionSpec: '18.x'
11+
npmVersion: '10'
12+
'Node 20':
13+
versionSpec: '20.x'
14+
npmVersion: '10'
15+
'Node 22':
16+
versionSpec: '22.x'
17+
npmVersion: '10'
18+
19+
jobs:
20+
- job: BuildAndTest
21+
displayName: Build and Test
22+
strategy:
23+
matrix: ${{ parameters.nodeVersions }}
24+
steps:
25+
- task: NodeTool@0
26+
inputs:
27+
versionSpec: $(versionSpec)
28+
displayName: Install node
29+
- script: npm install -g npm@$(npmVersion)
30+
displayName: Upgrade npm
31+
- task: NpmAuthenticate@0
32+
inputs:
33+
workingFile: .npmrc
34+
- script: npm install
35+
displayName: npm install
36+
- script: npm run build
37+
displayName: npm run build
38+
- script: npm run units
39+
displayName: Run unit tests

azure-pipelines.yml

Lines changed: 4 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This Yaml Document has been converted by ESAI Yaml Pipeline Conversion Tool.
1+
# CI Pipeline - Build and Test
22
# This pipeline will be extended to the OneESPT template
33
resources:
44
repositories:
@@ -20,95 +20,8 @@ extends:
2020
name: 1ES-ABTT-Shared-Pool
2121
image: abtt-ubuntu-2204
2222
os: linux
23-
customBuildTags:
24-
- ES365AIMigrationTooling
2523
stages:
26-
- stage: stage
24+
- stage: CI
25+
displayName: Build And Test
2726
jobs:
28-
- job: job
29-
strategy:
30-
matrix:
31-
'Node 16':
32-
versionSpec: '16.x'
33-
npmVersion: '8'
34-
'Node 18':
35-
versionSpec: '18.x'
36-
npmVersion: '10'
37-
'Node 20':
38-
versionSpec: '20.x'
39-
npmVersion: '10'
40-
'Node 22':
41-
versionSpec: '22.x'
42-
npmVersion: '10'
43-
steps:
44-
- task: NodeTool@0
45-
inputs:
46-
versionSpec: $(versionSpec)
47-
displayName: Install node
48-
- script: npm install -g npm@$(npmVersion)
49-
displayName: Upgrade npm
50-
- task: NpmAuthenticate@0
51-
inputs:
52-
workingFile: .npmrc
53-
- script: npm install
54-
displayName: npm install
55-
- script: npm run build
56-
displayName: npm run build
57-
- script: npm run units
58-
displayName: Run unit tests
59-
- task: Npm@1
60-
displayName: Publish azure-devops-node-api to npm
61-
condition: and(succeeded(), in(variables['build.reason'], 'IndividualCI', 'BatchedCI', 'Manual'), eq(variables['build.sourcebranchname'], 'master'), eq(variables['npmVersion'], '8'))
62-
inputs:
63-
command: custom
64-
customCommand: publish --tag prerelease
65-
workingDir: '_build'
66-
publishRegistry: useExternalRegistry
67-
customEndpoint: btt-npm-publish-token
68-
publishEndpoint: btt-npm-publish-token
69-
continueOnError: true
70-
- stage: Release
71-
displayName: Release to Latest
72-
trigger: manual
73-
jobs:
74-
- job: Release
75-
displayName: Release to Latest
76-
steps:
77-
- checkout: self
78-
clean: true
79-
- task: NodeTool@0
80-
inputs:
81-
versionSpec: 16.x
82-
displayName: Install node
83-
- task: NpmAuthenticate@0
84-
inputs:
85-
workingFile: .npmrc
86-
- script: npm install
87-
displayName: npm install
88-
- script: npm run build
89-
displayName: npm run build
90-
- bash: |
91-
package_name=$(npm pkg get name version | jq -r '"\(.name)@\(.version)"')
92-
echo "##vso[task.setvariable variable=npm_package]$package_name"
93-
workingDirectory: '_build'
94-
displayName: Get package name and version
95-
- task: Npm@1
96-
displayName: Remove prerelease tag for azure-devops-node-api in Npm
97-
condition: and(succeeded(), in(variables['build.reason'], 'IndividualCI', 'BatchedCI', 'Manual'), eq(variables['build.sourcebranchname'], 'master'))
98-
inputs:
99-
command: custom
100-
customCommand: dist-tag remove "$(npm_package)" prerelease
101-
workingDir: '_build'
102-
publishRegistry: useExternalRegistry
103-
customEndpoint: btt-npm-publish-token
104-
publishEndpoint: btt-npm-publish-token
105-
- task: Npm@1
106-
displayName: Add latest tag for azure-devops-node-api in Npm
107-
condition: and(succeeded(), in(variables['build.reason'], 'IndividualCI', 'BatchedCI', 'Manual'), eq(variables['build.sourcebranchname'], 'master'))
108-
inputs:
109-
command: custom
110-
customCommand: dist-tag add "$(npm_package)" latest
111-
workingDir: '_build'
112-
publishRegistry: useExternalRegistry
113-
customEndpoint: btt-npm-publish-token
114-
publishEndpoint: btt-npm-publish-token
27+
- template: .azure-pipelines/build-template.yml@self

0 commit comments

Comments
 (0)