# How do you pass an artifact to a build step that runs a plugin?

**URL:** <https://forum.buildkite.community/t/how-do-you-pass-an-artifact-to-a-build-step-that-runs-a-plugin/1631>\
**Category:** General\
**Created:** [July 9, 2021, 8:39pm UTC](https://forum.buildkite.community/t/how-do-you-pass-an-artifact-to-a-build-step-that-runs-a-plugin/1631 "2021-07-09T20:39:21Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![kenyee](https://avatars.discourse-cdn.com/v4/letter/k/ac8455/32.png) [@kenyee](https://forum.buildkite.community/u/kenyee)\
**Post date:** [July 9, 2021, 8:39pm UTC](https://forum.buildkite.community/t/how-do-you-pass-an-artifact-to-a-build-step-that-runs-a-plugin/1631/1 "2021-07-09T20:39:21Z")

</div>

My pipeline.yml looks like this:

```
- label: ":Step1"
  plugins:
    - ssh://.../docker-compose-buildkite-plugin.git#v3.5.1:
        config:
          - tools/sonarqube/docker-compose.yaml
        run: generateCsv
  key: "sonarqube"
  agents:
    queue: "sonarqube"
  artifact_paths: stats.csv
- wait
- label: "step2"
  // want to download stats.csv here before running the plugin
  plugins:
    - ssh://.../cqs-importer-buildkite-plugin.git#v0.9.5:
        csv_file: "stats.csv"
  agents:
    queue: java

```

---

<div class="post-metadata">

**Author:** ![paula](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.buildkite.community/paula/32/954_2.png) [@paula](https://forum.buildkite.community/u/paula)\
**Post date:** [July 10, 2021, 3:13pm UTC](https://forum.buildkite.community/t/how-do-you-pass-an-artifact-to-a-build-step-that-runs-a-plugin/1631/2 "2021-07-10T15:13:54Z")

</div>

Hi @kenyee!

Welcome to the community! 👋

Assuming your plugin uses a command hook, any plugin (or hook) that runs before the command hook, should allow you to download an artifact for use in the step.  
We have for example this plugin that does that as a pre-command hook: [artifacts-buildkite-plugin/hooks at master · buildkite-plugins/artifacts-buildkite-plugin · GitHub](https://github.com/buildkite-plugins/artifacts-buildkite-plugin/tree/master/hooks)

Hope this helps!

Cheers

---

<div class="post-metadata">

**Author:** ![kenyee](https://avatars.discourse-cdn.com/v4/letter/k/ac8455/32.png) [@kenyee](https://forum.buildkite.community/u/kenyee)\
**Post date:** [July 10, 2021, 3:30pm UTC](https://forum.buildkite.community/t/how-do-you-pass-an-artifact-to-a-build-step-that-runs-a-plugin/1631/3 "2021-07-10T15:30:58Z")

</div>

Hi Paula,

Thanks for the reply.  
Is there any way to do this via a pipeline.yml directly?  
Sounds like the answer is no?  
Essentially, what I want is the opposite of “artifact\_paths” in a buildstep.

e.g.,

- label: “step2”  
download\_artifacts:  
name: stats.csv  
location: “.”

---

<div class="post-metadata">

**Author:** ![paula](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.buildkite.community/paula/32/954_2.png) [@paula](https://forum.buildkite.community/u/paula)\
**Post date:** [July 10, 2021, 6:19pm UTC](https://forum.buildkite.community/t/how-do-you-pass-an-artifact-to-a-build-step-that-runs-a-plugin/1631/4 "2021-07-10T18:19:17Z")

</div>

Hey!

Oh, right … hmm 🤔, unfortunately, that particular functionality is not available; you can only automatically upload artifacts (`artifact_paths`) but to download them you have to use the command in your build scripts `buildkite-agent artifact download`  
You do make a good suggestion though. I’m going to pass this info to our Product team.

Thanks!

---

<div class="post-metadata">

**Author:** ![kenyee](https://avatars.discourse-cdn.com/v4/letter/k/ac8455/32.png) [@kenyee](https://forum.buildkite.community/u/kenyee)\
**Post date:** [July 10, 2021, 6:25pm UTC](https://forum.buildkite.community/t/how-do-you-pass-an-artifact-to-a-build-step-that-runs-a-plugin/1631/5 "2021-07-10T18:25:23Z")

</div>

Thanks for confirming and really hope to get that feature in the pipeline.yml someday soon 🙂

I’ll add the download call into my plugin.

---

<div class="post-metadata">

**Author:** ![tigris](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.buildkite.community/tigris/32/826_2.png) [@tigris](https://forum.buildkite.community/u/tigris)\
**Post date:** [July 13, 2021, 4:57am UTC](https://forum.buildkite.community/t/how-do-you-pass-an-artifact-to-a-build-step-that-runs-a-plugin/1631/6 "2021-07-13T04:57:00Z")

</div>

Using the `artifacts_path` notation is basically a shorthand for using the artifacts plugin.

```auto
- label: ":Step1"
  plugins:
    - ssh://.../docker-compose-buildkite-plugin.git#v3.5.1:
        config:
          - tools/sonarqube/docker-compose.yaml
        run: generateCsv
  key: "sonarqube"
  agents:
    queue: "sonarqube"
  artifact_paths: stats.csv

```

Your step above, can also be written as:

```auto
- label: ":Step1"
  plugins:
    - ssh://.../docker-compose-buildkite-plugin.git#v3.5.1:
        config:
          - tools/sonarqube/docker-compose.yaml
        run: generateCsv
    - artifacts#v1.3.0:
        upload: stats.csv
  key: "sonarqube"
  agents:
    queue: "sonarqube"

```

When you consider that artifacts can be managed via a plugin, and that plugins are processed in order, you should be able to get your artifact to the second step, like this:

```auto
- label: "step2"
  // want to download stats.csv here before running the plugin
  plugins:
    - artifacts#v1.3.0:
        download: stats.csv
    - ssh://.../cqs-importer-buildkite-plugin.git#v0.9.5:
        csv_file: "stats.csv"
  agents:
    queue: java

```
