简体   繁体   中英

Download Artifact from other pipeline in Multistage YAML

In azure devops i am trying to create a multistage release definition via yaml. Build is done via classic editor and the artifacts are uploaded to azure pipelines. so i want to access a specific artifact for deployment

- task: DownloadPipelineArtifact@2 displayName: 'Download Pipeline Artifact' inputs: buildType: specific project: 'vvxxxxxx-vxxv-xxxv-vxxx-xxxxxxvvxxvv' definition: 5 buildVersionToDownload: specific pipelineId: 'SSE_XXXXXXXXXXXXXXXXXX_Auto-import_dev_20200423.4' artifactName: Service targetPath: '$(Pipeline.Workspace)'

When i try it via classic release using task 'Download Pipeline Artifact' it's successful but when I try it via yaml it's failing with error "##[error]Run Id is not valid: SSE_XXXXXXXXXXXXXXXXXX_Auto-import_dev_20200423.4" if there is anyother way to get the artifact from a pipeline would be helpful and also instead of hardcoding pipelineId I want to make it dynamic as well.

Download Artifact from other pipeline in Multistage YAML

The value of the pipelineId should be the ID of the build pipeline, which you want to download, rather than the name/title of the build pipeline.

Find the build pipeline you want to download, click on a build record you want to download, you could see it in the web address bar of the browser:

在此处输入图像描述

also instead of hardcoding pipelineId I want to make it dynamic as well.

If you don't want hard code the pipelineId/runid in YAML definition, you can consider to pass queue variable as a work around.

For example:

- task: DownloadPipelineArtifact@2
  inputs:
    source: 'specific'
    artifact: 'drop'
    path: $(Build.SourcesDirectory)/bin
    project: 'AndroidBuild'
    pipeline: 12
    runVersion: 'specific'
    runId: $(buildid)

In above definition, buildid is the variable, and you can configure its value at queue time:

在此处输入图像描述

This do not need you to do any modification to the pipeline when you want to choosing another runId, just pass the value at queue time.

Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM