Home > Mobile >  How to share files between pipelines in different repositories?
How to share files between pipelines in different repositories?

Time:11-06

I have two pipelines: one creates binary files, the other one uses this binary file. For this, I need to share the files created by the first pipeline to the other one. I tried using the Publish Artifact task, but I get an error message when trying to download the artifacts in the second pipeline.

This is the pipeline configuration for the first pipeline:

steps:
#this script creates the binaries
- script: do something
- publish: $(System.DefaultWorkingDirectory)/path/to/folder
  artifact: artifact1

This is the pipeline configuration for the second pipeline:

steps:
- download: current
  artifact: artifact1

This second pipeline fails with the following error: ##[error]Artifact artifact1 was not found for build 123.

I think the reason for this error might be that published artifacts are only available in jobs of the same pipeline run. Is this correct? If so then how can I share these files?

CodePudding user response:

You need to put specific instead of current if you are downloading from a artifact published by another pipeline:

steps:
- download: specific
  artifact: artifact1

Check this out:

- task: DownloadPipelineArtifact@2
  inputs:
    source: 'specific'
    project: 'FabrikamFiber'
    pipeline: 12
    runVersion: 'latest'

https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/download-pipeline-artifact?view=azure-devops#download-artifacts-from-a-specific-projectpipeline

  • Related