-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1ES Pipelines Template Adoption (#367)
* 1ES Pipelines Template Adoption - Switch to 1ES templates * 1ES Pipelines Template Adoption - CreadScan Fix * 1ES Pipelines Template Adoption - CreadScan Fix
- Loading branch information
1 parent
7375ce1
commit ed71272
Showing
2 changed files
with
122 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,117 +1,128 @@ | ||
# This Yaml Document has been converted by ESAI Yaml Pipeline Conversion Tool. | ||
# Please make sure to check all the converted content, it is your team's responsibility to make sure that the pipeline is still valid and functions as expected. | ||
# This pipeline will be extended to the OneESPT template | ||
# If you are not using the E+D shared hosted pool with windows-2022, replace the pool section with your hosted pool, os, and image name. If you are using a Linux image, you must specify an additional windows image for SDL: https://eng.ms/docs/cloud-ai-platform/devdiv/one-engineering-system-1es/1es-docs/1es-pipeline-templates/features/sdlanalysis/overview#how-to-specify-a-windows-pool-for-the-sdl-source-analysis-stage | ||
# The Task 'PublishPipelineArtifact@1' has been converted to an output named 'Publish _build artifact' in the templateContext section. | ||
trigger: | ||
- master | ||
- releases/* | ||
|
||
- master | ||
- releases/* | ||
variables: | ||
isMaster: $[eq(variables['Build.SourceBranch'], 'refs/heads/master')] | ||
isRelease: $[startsWith(variables['Build.SourceBranch'], 'refs/heads/releases')] | ||
|
||
parameters: | ||
- name: nodeVersionList | ||
type: object | ||
default: [6, 8, 10, 12, 14, 16] | ||
|
||
- name: imageList | ||
type: object | ||
default: ['windows-latest', 'ubuntu-latest'] | ||
|
||
- name: publishToNpm | ||
displayName: Publish to npm | ||
type: boolean | ||
default: false | ||
|
||
stages: | ||
- stage: Build | ||
displayName: Build typed-rest-client | ||
jobs: | ||
- name: nodeVersionList | ||
type: object | ||
default: [6, 8, 10, 12, 14, 16] | ||
- name: imageList | ||
type: object | ||
default: | ||
windows: 'windows-latest' | ||
ubuntu: 'ubuntu-latest' | ||
- name: publishToNpm | ||
displayName: Publish to npm | ||
type: boolean | ||
default: false | ||
resources: | ||
repositories: | ||
- repository: 1ESPipelineTemplates | ||
type: git | ||
name: 1ESPipelineTemplates/1ESPipelineTemplates | ||
ref: refs/tags/release | ||
extends: | ||
template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates | ||
parameters: | ||
sdl: | ||
sourceAnalysisPool: | ||
name: Azure-Pipelines-1ESPT-ExDShared | ||
image: windows-2022 | ||
os: windows | ||
customBuildTags: | ||
- ES365AIMigrationTooling | ||
stages: | ||
- stage: Build | ||
displayName: Build typed-rest-client | ||
jobs: | ||
- job: Build_and_Publish | ||
displayName: Build and Publish artifact | ||
pool: | ||
vmImage: 'ubuntu-20.04' | ||
name: Azure-Pipelines-1ESPT-ExDShared | ||
image: ubuntu-latest | ||
os: linux | ||
templateContext: | ||
outputs: | ||
- output: pipelineArtifact | ||
displayName: 'Publish _build artifact' | ||
targetPath: _build | ||
artifactType: pipeline | ||
artifactName: _build | ||
steps: | ||
#build on node 8.x | ||
- task: NodeTool@0 | ||
inputs: | ||
versionSpec: '8.x' | ||
displayName: Install node 8 | ||
|
||
- script: npm install | ||
displayName: npm install | ||
|
||
- script: npm run build | ||
displayName: npm run build | ||
|
||
- task: PublishPipelineArtifact@1 | ||
displayName: Publish _build artifact | ||
inputs: | ||
targetPath: _build | ||
artifactType: pipeline | ||
artifactName: _build | ||
|
||
# run unit tests on different platforms and node versions | ||
- stage: Test | ||
displayName: Test typed-rest-client | ||
jobs: | ||
- task: NodeTool@0 | ||
inputs: | ||
versionSpec: '8.x' | ||
displayName: Install node 8 | ||
- script: npm install | ||
displayName: npm install | ||
- script: npm run build | ||
displayName: npm run build | ||
- stage: Test | ||
displayName: Test typed-rest-client | ||
jobs: | ||
- ${{ each image in parameters.imageList }}: | ||
- ${{ each nodeVersion in parameters.nodeVersionList }}: | ||
- job: Node_os_${{ nodeVersion }}_${{ replace(image,'-','_') }} | ||
displayName: Node.js ${{ nodeVersion }} on ${{ image }} | ||
pool: | ||
vmImage: ${{ image }} | ||
steps: | ||
- task: DownloadPipelineArtifact@2 | ||
displayName: Download built typed-rest-client package | ||
inputs: | ||
artifact: _build | ||
path: $(Build.SourcesDirectory)/_build | ||
patterns: '!package-lock.json' #Exclude package-lock.json | ||
|
||
- script: npm install | ||
displayName: npm install | ||
|
||
- task: NodeTool@0 | ||
inputs: | ||
versionSpec: ${{ nodeVersion }}.x | ||
displayName: Install node ${{ nodeVersion }} | ||
|
||
- script: npm run units | ||
displayName: npm run units | ||
|
||
- script: npm run test | ||
displayName: npm run test | ||
|
||
- stage: Publish | ||
condition: and(succeeded(), or(eq('${{ parameters.publishToNpm }}', true), eq(variables.isRelease, true), eq(variables.isMaster, true))) | ||
jobs: | ||
- ${{ each nodeVersion in parameters.nodeVersionList }}: | ||
- job: Node_os_${{ nodeVersion }}_${{ image.key }} | ||
displayName: Node.js ${{ nodeVersion }} on ${{ image.key }} | ||
pool: | ||
name: Azure-Pipelines-1ESPT-ExDShared | ||
image: ${{ image.value }} | ||
os: ${{ image.key }} | ||
steps: | ||
- task: DownloadPipelineArtifact@2 | ||
displayName: Download built typed-rest-client package | ||
inputs: | ||
artifact: _build | ||
path: $(Build.SourcesDirectory)/_build | ||
patterns: '!package-lock.json' | ||
- script: npm install | ||
displayName: npm install | ||
- task: NodeTool@0 | ||
inputs: | ||
versionSpec: ${{ nodeVersion }}.x | ||
displayName: Install node ${{ nodeVersion }} | ||
- script: npm run units | ||
displayName: npm run units | ||
- script: npm run test | ||
displayName: npm run test | ||
- stage: Publish | ||
condition: and(succeeded(), or(eq('${{ parameters.publishToNpm }}', true), eq(variables.isRelease, true), eq(variables.isMaster, true))) | ||
jobs: | ||
- job: Publish_package | ||
displayName: Publish npm package | ||
pool: | ||
vmImage: 'ubuntu-20.04' | ||
name: Azure-Pipelines-1ESPT-ExDShared | ||
image: ubuntu-latest | ||
os: linux | ||
steps: | ||
- task: DownloadPipelineArtifact@2 | ||
displayName: Download built typed-rest-client package | ||
inputs: | ||
artifact: _build | ||
path: $(Build.SourcesDirectory)/_build | ||
|
||
- task: Npm@1 | ||
displayName: Publish typed-rest-client to npm | ||
inputs: | ||
command: publish | ||
workingDir: '_build' | ||
publishRegistry: useExternalRegistry | ||
publishEndpoint: NPM-Automation-Token | ||
continueOnError: true | ||
|
||
- script: npm install | ||
displayName: npm install | ||
continueOnError: true | ||
condition: and(succeeded(), eq(variables.isMaster, true)) | ||
|
||
- script: node ./ci/create-release-notes.js | ||
continueOnError: true | ||
condition: and(succeeded(), eq(variables.isMaster, true)) | ||
env: | ||
GH_TOKEN: $(githubToken) | ||
branch: $(Build.SourceBranchName) | ||
displayName: Create Release | ||
- task: DownloadPipelineArtifact@2 | ||
displayName: Download built typed-rest-client package | ||
inputs: | ||
artifact: _build | ||
path: $(Build.SourcesDirectory)/_build | ||
- task: Npm@1 | ||
displayName: Publish typed-rest-client to npm | ||
inputs: | ||
command: publish | ||
workingDir: '_build' | ||
publishRegistry: useExternalRegistry | ||
publishEndpoint: NPM-Automation-Token | ||
continueOnError: true | ||
- script: npm install | ||
displayName: npm install | ||
continueOnError: true | ||
condition: and(succeeded(), eq(variables.isMaster, true)) | ||
- script: node ./ci/create-release-notes.js | ||
continueOnError: true | ||
condition: and(succeeded(), eq(variables.isMaster, true)) | ||
env: | ||
GH_TOKEN: $(githubToken) | ||
branch: $(Build.SourceBranchName) | ||
displayName: Create Release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters