Reputation: 61
I have a yaml pipeline that produces an artifact, and in another pipeline I want to consume this artifact and use it. The specific problem is that I can no longer find the runID from the run that produced the artifact.
Previously
In the second pipeline I used to be able to get the runID from previous pipeline by running:
$(resources.pipeline.<artifactName>.runID)
I was using the shortcut to download the artifact to the entire pipeline like:
resources:
pipelines:
- pipeline: <artifactName>
source: <pipelineName>
Currently (not working)
Now I am using a task that will instead download the artifact to a specific stage (not to the entire pipeline), and I select it through different tags on the pipeline-run. I follow this documentation: https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/download-pipeline-artifact?view=azure-devops
Specifically:
- task: DownloadPipelineArtifact@2
inputs:
source: 'specific'
project: '<myProjectName>'
pipeline: <firstPipelineID>
artifact: '<artifactName>'
targetPath: $(Pipeline.Workspace)
tags: <myTag>
I try to get the runID from the artifact almost like previously:
$(Pipeline.Workspace.<artifactName>.runID)
I can not get the runID. Does anybody know how to do this?
Thank you
Upvotes: 1
Views: 2151
Reputation: 35119
Based on your description, you need to get the runID when using the DownloadPipelineArtifact task.
I am afraid that there is no such variable can directly get the runID.
When you use the DownloadPipelineArtifact task to download the artifacts, it will generate a variable: $(DOWNLOADPIPELINEARTIFACT.BUILDNUMBER)
.
It has the same value as the variable $(resources.pipeline.<artifactName>.runID)
You can change to use the variable: $(DOWNLOADPIPELINEARTIFACT.BUILDNUMBER)
to get the RunId.
Upvotes: 1