Hi ![]()
I am trying to pass some arguments from one pipeline to another using a trigger step but I am unable to do so.
Suppose the following (abridged) trigger step:
- trigger: "some-other-pipeline"
label: "My step label"
build:
env:
MY_ARG: "$(buildkite-agent meta-data get my_arg)"
The intention here is to set MY_ARG with whatever value was set to my_arg with the buildkite-agent meta-data get set command in the same pipeline and pass that through to some-other-pipeline.
That however doesn’t work and MY_ARG always ends up with an empty value in some-other-pipeline because I believe shell commands aren’t getting executed inside the env section?
One solution that works is doing something similar to:
commands:
- |
cat <<YAML | buildkite-agent pipeline upload
steps:
- trigger: "some-other-pipeline"
build:
env:
MY_ARG: "$(buildkite-agent meta-data get my_arg)"
YAML
but that looks truly gruesome ![]()
Is there a better way of achieving the same effect as the above?
Thanks!