Skip to content

Instantly share code, notes, and snippets.

@lox
Created February 24, 2018 04:19
Show Gist options
  • Save lox/9a7430aa56ae3a059bb8f8286aa7632f to your computer and use it in GitHub Desktop.
Save lox/9a7430aa56ae3a059bb8f8286aa7632f to your computer and use it in GitHub Desktop.
Helpers for Buildkite Plugins
# Reads either a value or a list from plugin config
function plugin_read_list() {
local prefix="BUILDKITE_PLUGIN_GOLANG_BUILD_$1"
local parameter="${prefix}_0"
if [[ -n "${!parameter:-}" ]]; then
local i=0
local parameter="${prefix}_${i}"
while [[ -n "${!parameter:-}" ]]; do
echo "${!parameter}"
i=$((i+1))
parameter="${prefix}_${i}"
done
elif [[ -n "${!prefix:-}" ]]; then
echo "${!prefix}"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment