Skip to content

Commit

Permalink
Change how "NPM packaging pipeline" downloads packages from another p…
Browse files Browse the repository at this point in the history
…ipeline (microsoft#17838)

### Description
"NPM packaging pipeline" needs to download an artifact from
"Zip-Nuget-Java-Nodejs Packaging Pipeline".
It has been a long-time issue that they two pipelines often use
different commit ids.
This change declares 'Zip-Nuget-Java-Nodejs Packaging Pipeline' as a
resource, so that "NPM packaging pipeline" will always fetch from the
pipeline run that triggers this NPM pipeline.
Their official document says:
"When you define a resource trigger, if its pipeline resource is from
the same repo as the current pipeline, triggering follows the same
branch and commit on which the event is raised."
  • Loading branch information
snnn authored and kleiti committed Mar 22, 2024
1 parent 9bd9d70 commit 9b57af7
Showing 1 changed file with 9 additions and 31 deletions.
40 changes: 9 additions & 31 deletions tools/ci_build/github/azure-pipelines/npm-packaging-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ parameters:
- 'custom'
default: 'nightly (@dev)'

- name: NodePipelineId
displayName: 'Node npm package build Id'
type: string
default: 'latest'

variables:
# pipeline should define the following varaibles
# ExtraBuildArgs
Expand All @@ -29,6 +24,11 @@ variables:
NpmPackagingMode: '$(VersionSuffix)'

resources:
pipelines:
- pipeline: build
source: 'Zip-Nuget-Java-Nodejs Packaging Pipeline'
trigger: true
branch: main
repositories:
- repository: manylinux
type: Github
Expand Down Expand Up @@ -65,35 +65,13 @@ stages:
runCodesignValidationInjection: false
timeoutInMinutes: 10
steps:

- ${{ if eq(parameters.NodePipelineId, 'latest') }}:
- task: DownloadPipelineArtifact@2
inputs:
buildType: 'specific'
project: '530acbc4-21bc-487d-8cd8-348ff451d2ff'
definition: '940'
specificBuildWithTriggering: true
buildVersionToDownload: 'latestFromBranch'
branchName: 'refs/heads/main'
artifactName: 'NPM_packages'
targetPath: '$(Pipeline.Workspace)'
displayName: 'Download onnxruntime-node Pipeline Artifact'

- ${{ if ne(parameters.NodePipelineId, 'latest') }}:
- task: DownloadPipelineArtifact@2
inputs:
buildType: 'specific'
project: '530acbc4-21bc-487d-8cd8-348ff451d2ff'
definition: '940'
buildVersionToDownload: 'specific'
pipelineId: '${{ parameters.NodePipelineId }}'
artifactName: 'NPM_packages'
targetPath: '$(Pipeline.Workspace)'
displayName: 'Download onnxruntime-node Pipeline Artifact'
- download: build
artifact: 'NPM_packages'
displayName: 'Download onnxruntime-node Pipeline Artifact'

- task: CopyFiles@2
inputs:
sourceFolder: $(Pipeline.Workspace)
sourceFolder: '$(Pipeline.Workspace)\build\NPM_packages'
contents: onnxruntime-*.tgz
targetFolder: $(Build.ArtifactStagingDirectory)\node-artifacts
displayName: 'Copy onnxruntime-node Artifacts'
Expand Down

0 comments on commit 9b57af7

Please sign in to comment.