Welcome to the community!
Apologies for the delayed response.
You can do what you posted, or you can use the environment variable BUILDKITE_PLUGIN_DOCKER_LOGIN_USERNAME defined in the plugin. For the latter, you shouldn’t use username on the plugin invocation. For example:
Hi @paula, I think there is a misunderstanding here. I think @thomas was asking how you can use an environment variable on the parameters of a plugin. Which is actually not possible.
I’m trying to develop my own plugin right now and I am trying to pass in a parameter that contains an environment variable. Something like
${BUILDKITE_LABEL} is actually not resolved, it’s just empty in the script of the plugin. I’ve also tried $${BUILDKITE_LABEL}, in which case it just resolves to the string “${BUILDKITE_LABEL}”, but not the actual value of the env variable.
That works because environment variables like ${BUILDKITE_LABEL} are actually available during execution of the hooks.
But for some reason they don’t get evaluated if they are just used as value on a plugin property.
Hmm, This sounds like a different issue than the original one in this thread.
If you use the single dollar sign, values will be interpolated at pipeline upload time. If you want to interpolate when your plugin runs, then your plugins need to handle that
Agree with @jonnylangefeld. The author intended to dynamically read an (environment) variable. Keen to get a solution as well. Tried your proposed:
MESSAGE="$(envsubst < <(echo "${ENVIRONMENT}"))"
but it fails with Pipeline parsing of "pipeline.yaml" failed (Failed to parse pipeline.yaml: line 103: did not find expected key). I am trying to use an environment variable defined in env which should exist and be set.