I am trying to download the artifacts in a pipeline which were published in another pipeline. Here are the relevant lines from the yaml file:
I specify the source pipeline as a resource:
resources:
pipelines:
- pipeline: name
project: projekt
source: source
Then here is the download task:
- task: DownloadPipelineArtifact@2
inputs:
buildType: 'specific'
project: $(resources.pipeline.Build.projektID)
pipeline: $(resources.pipeline.Build.pipelineID)
buildVersionToDownload: $(resources.pipeline.Build.runID)
downloadType: 'single'
artifactName: 'artifact-name'
downloadPath: '$(System.DefaultWorkingDirectory)/Build/artifact-name'
displayName: 'Download Artifact'
Here is the error I am getting:
Starting: Download Artifact
==============================================================================
Task : Download Pipeline Artifacts
Description : Download build and pipeline artifacts
Version : 2.198.0
Author : Microsoft Corporation
Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/download-pipeline-artifact
==============================================================================
##[error]Unreachable code!
Finishing: Download Artifact
If I remove the variables then it works, but I need to use those variables to download the specific version of the source pipeline. What am I doing wrong?
I implemented this based on the MS documentations:
https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/download-pipeline-artifact-v2?view=azure-pipelines
https://learn.microsoft.com/en-us/azure/devops/pipelines/yaml-schema/resources-pipelines-pipeline?view=azure-pipelines
Can you please help me?
>Solution :
You have mistake in buildVersionToDownload. You should put there specific. And pass resources.pipeline.Build.runID as pipelineId. Set also specificBuildWithTriggering to true.
- task: DownloadPipelineArtifact@2
inputs:
buildType: 'specific'
project: $(resources.pipeline.Build.projektID)
pipeline: $(resources.pipeline.Build.pipelineID)
pipelineId: '$(resources.pipeline.Build.runID)'
buildVersionToDownload: 'specific'
specificBuildWithTriggering: true
downloadType: 'single'
artifactName: 'artifact-name'
downloadPath: '$(System.DefaultWorkingDirectory)/Build/artifact-name'
displayName: 'Download Artifact'