Pass metadata to triggered pipelines with pure YAML

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:

- trigger: "dependent-pipeline"
  label: "Doing nifty things"
  build:
    meta_data:
    - key_that_i_set_earlier_in_the_triggering_pipeline

And @keithpitt responded:

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?”

Thanks!

+1 to this - we have a lot of pipelines which trigger other pipelines with dynamic metadata.

e.g:

steps:
  - command: "create_deployment.sh" # sets deployment-name metadata

  - wait: ~

  # script which reads metadata + uploads trigger step below
  - command: "profile_deployment.sh" 
  - 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

This is a great idea, thanks for taking the time to raise this! I have raised this internally with the team!