Change how "NPM packaging pipeline" downloads packages from another pipeline (#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."
This commit is contained in:
Changming Sun 2023-10-11 21:07:27 -07:00 committed by GitHub
parent 20798a9f03
commit 138ccecd22
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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
@ -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
@ -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'