I’ll paste the interaction from Slack for posterity:
When using a trigger step (https://buildkite.com/docs/pipelines/trigger-step), I see that we can pass meta-data to the triggered pipeline. I have some data that I generate and set as meta-data within the triggering pipeline that I’d like to pass to the triggered pipeline. Absent dynamically generating the content of the trigger step, is there any way I can set this up using pure YAML? Something like, say:
Hey @cm! It’s a good question! The only way to do it at the moment is to have a step that re-generates the trigger step at runtime and pipeline uploads it
(basically kinda what you were thinking)
However, I hadn’t considered the docker-compose model before as a quick shortcut…
Can you shoot this through to support and say “Keith said this could be a good idea?”
- trigger: "deployment-profiling"
build:
meta_data:
# has to be resolved by script, doesnt work in steps.yaml
deployment-name: $(buildkite-agent meta-data get deployment-name)
It would be ideal if we could remove the profile_deployment.sh script and just directly put that trigger step into the yaml
Hey, I’ve seen this idea floated around in a few places, and I’d like to ask is there any update on this feature? I’d be happy to submit a PR to implement it, but unfortunately I would need some help finding where this behaviour happens on the agent.
Our specific use case for this is that we have build with lots of options, and we have some defaults set for UI triggered builds, but we’d like to add a second “advanced” build that just triggers the first with some metadata customised. It would be really great if we didn’t have to duplicate the metadata parsing logic in both pipelines in a script, and instead could just do:
Welcome back to the forum, @Donal! Thank you for your suggestion!
Unfortunately, metadata is not handled by the Buildkite agent but by Buildkite itself, so a PR for an agent will not solve your issue. The idea of implementing passing metadata to triggered pipelines with YAML has been floating around for some time on the forum. However, for the time being, the only possible workaround is using dynamic pipelines, trigger step, and a command to get metadata from the trigger pipeline.
You’ll need the triggered pipeline (Pipeline B) to use the command buildkite-agent meta-data get "release-version" in the pipeline steps to get the metadata contained in the trigger pipeline (Pipeline A).