Plugin inputs as array

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!

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:

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

Hope this helps!

Cheers,

perfect, thanks!