Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

DownloadPipelineArtifact task fails in azure pipelines

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:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

  - 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'
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading