# Plugin inputs as array

**URL:** <https://forum.buildkite.community/t/plugin-inputs-as-array/1747>\
**Category:** General\
**Created:** [October 5, 2021, 5:05am UTC](https://forum.buildkite.community/t/plugin-inputs-as-array/1747 "2021-10-05T05:05:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ianwremmel](https://avatars.discourse-cdn.com/v4/letter/i/839c29/32.png) [@ianwremmel](https://forum.buildkite.community/u/ianwremmel)\
**Post date:** [October 5, 2021, 5:05am UTC](https://forum.buildkite.community/t/plugin-inputs-as-array/1747/1 "2021-10-05T05:05:45Z")

</div>

I’m trying to write a plugin that accepts an input that’s an array of strings.

I know I can express an array of string with JSON-Schema, but what will buildkite do with it? How will it get turned into a bash variable?

Thanks!

---

<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:** [October 5, 2021, 9:27pm UTC](https://forum.buildkite.community/t/plugin-inputs-as-array/1747/2 "2021-10-05T21:27:35Z")

</div>

Hi @ianwremmel!

That’s a good question!  
Arrays are a bit tricky and they are expanded into variables named like:

BUILDKITE\_PLUGIN\_SOMETHING\_PATHS\_0=…  
BUILDKITE\_PLUGIN\_SOMETHING\_PATHS\_1=…

The docker plugin uses a function to read these into a bash array, for example:

> <https://github.com/buildkite-plugins/docker-buildkite-plugin/blob/master/hooks/command#L25-L47>

You can find the full value, as it was in the original YAML, inside the JSON in $BUILDKITE\_PLUGINS.

Hope this helps!

Cheers,

---

<div class="post-metadata">

**Author:** ![ianwremmel](https://avatars.discourse-cdn.com/v4/letter/i/839c29/32.png) [@ianwremmel](https://forum.buildkite.community/u/ianwremmel)\
**Post date:** [October 5, 2021, 9:48pm UTC](https://forum.buildkite.community/t/plugin-inputs-as-array/1747/3 "2021-10-05T21:48:28Z")

</div>

perfect, thanks!

---

<div class="post-metadata">

**Author:** ![smoreno-allurion](https://avatars.discourse-cdn.com/v4/letter/s/df705f/32.png) [@smoreno-allurion](https://forum.buildkite.community/u/smoreno-allurion)\
**Post date:** [March 14, 2023, 12:20pm UTC](https://forum.buildkite.community/t/plugin-inputs-as-array/1747/4 "2023-03-14T12:20:50Z")

</div>

This has been really helpful! Thanks!

To show my gratitude I’d like to add an example of how to test the array property using BATS:

```bash

@test "Array property check" {
    export BUILDKITE_PLUGIN_PIPELINER_JEDIS_0="Luke Skywalker"
    export BUILDKITE_PLUGIN_PIPELINER_JEDIS_1="Obi-Wan Kenobi"

    run "$PWD/hooks/command"
    assert_success
}

```

---

<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:** [March 14, 2023, 2:34pm UTC](https://forum.buildkite.community/t/plugin-inputs-as-array/1747/5 "2023-03-14T14:34:26Z")

</div>

This is great! Thanks for sharing! 🤗
