Skip to content

Commit

Permalink
1ES Pipelines Template Adoption (#449)
Browse files Browse the repository at this point in the history
* 1ES Pipelines Template Adoption

- Added 1Es templates ci
- Changed pools for Windows/Ubuntu to 1ES pools

* 1ES Pipelines Template Adoption

- Skib baseline for now
  • Loading branch information
DmitriiBobreshev authored Feb 26, 2024
1 parent ff07236 commit 706c0b0
Showing 1 changed file with 75 additions and 51 deletions.
126 changes: 75 additions & 51 deletions .azure-pipelines/azure-pipeline.yml
Original file line number Diff line number Diff line change
@@ -1,57 +1,81 @@
# This Yaml Document has been converted by ESAI Yaml Pipeline Conversion Tool.
# This pipeline will be extended to the OneESPT template

trigger:
- master
- releases/*

pool:
vmImage: windows-latest

variables:
- group: npm-tokens
resources:
repositories:
- repository: 1ESPipelineTemplates
type: git
name: 1ESPipelineTemplates/1ESPipelineTemplates
ref: refs/tags/release
extends:
template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates
parameters:
settings:
skipBuildTagsForGitHubPullRequests: true
# featureFlags:
# autoBaseline: false
# sdl:
# baseline:
# baselineSet: default
# baselineFile: $(Build.SourcesDirectory)/.gdn/.gdnbaselines
pool:
name: 1ES-ABTT-Shared-Pool
image: abtt-windows-2022
os: windows
stages:
- stage: stage
jobs:
- job: job
templateContext:
outputs:
- ${{ if in(variables['build.reason'], 'IndividualCI', 'BatchedCI', 'Manual') }}:
- output: pipelineArtifact
displayName: 'Publish tfx-cli package to pipeline artifacts'
targetPath: '$(Build.ArtifactStagingDirectory)'
artifactType: 'pipeline'
artifactName: 'tfx-cli-package'
steps:
- checkout: self
clean: true

- task: NodeTool@0
displayName: Use node 10
inputs:
versionSpec: "10.x"

- script: npm i -g [email protected] --force
displayName: Use npm version 6.14.12

- bash: |
npm ci
npm run build
displayName: Build TFX CLI
- ${{ if in(variables['build.reason'], 'IndividualCI', 'BatchedCI', 'Manual') }}:
# For CI and Manual runs automatically publish packages
# The npm cli will replace ${NPM_TOKEN} with the contents of the NPM_TOKEN environment variable.
- bash: |
echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}' > .npmrc
npm publish --ignore-scripts
exit_status=$?
if [ $exit_status -eq 1 ]; then
echo "##vso[task.logissue type=warning]Publishing TFX CLI was unsuccessful"
echo "##vso[task.complete result=SucceededWithIssues;]"
fi
rm .npmrc
displayName: Publish TFX CLI to npm
env:
NPM_TOKEN: $(npm-automation.token)
steps:
- checkout: self
clean: true

- task: NodeTool@0
displayName: Use node 10
inputs:
versionSpec: "10.x"

- script: npm i -g [email protected] --force
displayName: Use npm version 6.14.12

- bash: |
npm ci
npm run build
displayName: Build TFX CLI

- ${{ if in(variables['build.reason'], 'IndividualCI', 'BatchedCI', 'Manual') }}:
# For CI and Manual runs automatically publish packages
# The npm cli will replace ${NPM_TOKEN} with the contents of the NPM_TOKEN environment variable.
- bash: |
echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}' > .npmrc
npm publish --ignore-scripts
exit_status=$?
if [ $exit_status -eq 1 ]; then
echo "##vso[task.logissue type=warning]Publishing TFX CLI was unsuccessful"
echo "##vso[task.complete result=SucceededWithIssues;]"
fi
rm .npmrc
displayName: Publish TFX CLI to npm
env:
NPM_TOKEN: $(npm-automation.token)
# Generate a pipeline artifact so we can publish the package manually if there are issues with automation
- bash: |
npm pack
cp *.tgz '$(Build.ArtifactStagingDirectory)'
displayName: Run npm-pack and copy to ArtifactStagingDirectory
- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)'
artifactType: 'pipeline'
artifactName: 'tfx-cli-package'
displayName: Publish tfx-cli package to pipeline artifacts
# Generate a pipeline artifact so we can publish the package manually if there are issues with automation
- bash: |
npm pack
cp *.tgz '$(Build.ArtifactStagingDirectory)'
displayName: Run npm-pack and copy to ArtifactStagingDirectory

0 comments on commit 706c0b0

Please sign in to comment.