0
votes

I have created a YAML pipeline that triggers on completion of another pipeline, which publishes artifacts:

trigger: none
pr: none

resources:
  pipelines:
    - pipeline: build_pipeline
      source: 'Build All'
      trigger: true

jobs:
  - job: PushArtifacts
    steps:
      - task: DownloadPipelineArtifact@2
        inputs:
          source: specific
          project: MyProject
          pipeline: $(Build.TriggeredBy.DefinitionName)
          runId: $(Build.TriggeredBy.BuildId)
          preferTriggeringPipeline: true
          path: 'artifacts'

This is what I've got so far, but my issue is, I cannot get my pipeline to "consume" artifacts if I choose them from the Resource Picker on the New Run dialog.

I pick a build, run my pipeline, and it LOOKS like it works... the Summary pane says "2 consumed artifacts", and if I click it, I can see that it claims the appropriate artifacts were selected from the right build (although it shows no files under them).

But, my download task always fails. Is there a way to download the "selected resources" inside my pipeline, from either a triggering build or from the build I picked in the manual run pipeline dialog?

(So far, I've tried the YAML I posted, I've tried changing the source to "current", I've tried removing most of the options, but nothing will let me download the artifacts I'm looking for.)

1

1 Answers

1
votes

Of course, I found the answer shortly after typing out this question...

Despite what both the Microsoft doc pages say for "download build artifacts" and "download pipeline artifacts" tasks, there is another option for the "download" task.

You can specify the name of the pipeline you provided in the resources section, and it will download whatever artifacts are available from that pipeline:

resources:
  pipelines:
    - pipeline: build_pipeline        # <<<<
      source: 'Build All'
      trigger: true

steps:
  - download: build_pipeline          # <<<<