1
votes

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.

1

1 Answers

1
votes

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:

enter image description here

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:

enter image description here

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.