# How to get global input and use it across all pipeline steps

**URL:** <https://forum.buildkite.community/t/how-to-get-global-input-and-use-it-across-all-pipeline-steps/1872>\
**Category:** General\
**Created:** [January 28, 2022, 6:07pm UTC](https://forum.buildkite.community/t/how-to-get-global-input-and-use-it-across-all-pipeline-steps/1872 "2022-01-28T18:07:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Derrick](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Derrick](https://forum.buildkite.community/u/Derrick)\
**Post date:** [January 28, 2022, 6:07pm UTC](https://forum.buildkite.community/t/how-to-get-global-input-and-use-it-across-all-pipeline-steps/1872/1 "2022-01-28T18:07:01Z")

</div>

Is there a way to get an input parameter and have the parameter available across all input steps?

For instance, in jenkins, I can define a top-level input parameter BRANCH, and use it across multiple steps:

parameters {  
string(  
name: ‘BRANCH’,  
defaultValue: ‘master’,  
description: ‘branch to build’  
)  
}

Alternatively, is there a way to share an input parameter across steps? For instance, the first step gets a parameter, and I would like following steps to be able read that parameter.

---

<div class="post-metadata">

**Author:** ![jeremy](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.buildkite.community/jeremy/32/1040_2.png) [@jeremy](https://forum.buildkite.community/u/jeremy)\
**Post date:** [January 28, 2022, 11:19pm UTC](https://forum.buildkite.community/t/how-to-get-global-input-and-use-it-across-all-pipeline-steps/1872/2 "2022-01-28T23:19:52Z")

</div>

Hey @Derrick, welcome to the community!

You can use an [input step](https://buildkite.com/docs/pipelines/input-step) to collect input, assign the value to a key, and access that key with the [`buildkite-agent meta-data`](https://buildkite.com/docs/agent/v3/cli-meta-data) command.

Hopefully that helps you get started, and if you have other questions feel free to reach out 🙂

Best,

Jeremy

---

<div class="post-metadata">

**Author:** ![Derrick](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Derrick](https://forum.buildkite.community/u/Derrick)\
**Post date:** [January 28, 2022, 11:50pm UTC](https://forum.buildkite.community/t/how-to-get-global-input-and-use-it-across-all-pipeline-steps/1872/3 "2022-01-28T23:50:49Z")

</div>

Thanks, understood. My question is whether the input obtained in one step can be used in a following step.

Eg. ‘my-input’ is obtained in Step A. Can ‘my-input’ be used in Step B?

---

<div class="post-metadata">

**Author:** ![jeremy](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.buildkite.community/jeremy/32/1040_2.png) [@jeremy](https://forum.buildkite.community/u/jeremy)\
**Post date:** [January 29, 2022, 12:56am UTC](https://forum.buildkite.community/t/how-to-get-global-input-and-use-it-across-all-pipeline-steps/1872/4 "2022-01-29T00:56:19Z")

</div>

Since `my-input` would be stored as meta-data, it would not be available in a [conditional](https://buildkite.com/docs/pipelines/conditionals#navicon) within the pipeline, but you would be able to access it in Step B. If you are wanting to use it in a conditional though, you would need to use the `buildkite-agent meta-data` command and some scripting. There is a great example of how to do this over in this thread:

> [@Meta-data in conditional clause](https://forum.buildkite.community/t/meta-data-in-conditional-clause/1190/6):
>
> Hi folks! After a deep discussion we’ve decided not to support meta-data in conditionals just yet, sorry! We want to do it well, and have an answer for what happens when meta-data changes over the lifecycle of a build, and we haven’t quite figured that out yet. For now, you can do this with the buildkite-agent and a bit of scripting — and it’s not super different, like: # buildkite.yml steps: - block: "Request release" prompt: "Fill out the details for release" fields: - text: …

Hope that helps!
