# Concurrency of triggered pipelines

**URL:** <https://forum.buildkite.community/t/concurrency-of-triggered-pipelines/3044>\
**Category:** Pipelines\
**Created:** [July 16, 2023, 11:55pm UTC](https://forum.buildkite.community/t/concurrency-of-triggered-pipelines/3044 "2023-07-16T23:55:40Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![uh-toby](https://avatars.discourse-cdn.com/v4/letter/u/c5a1d2/32.png) [@uh-toby](https://forum.buildkite.community/u/uh-toby)\
**Post date:** [July 16, 2023, 11:55pm UTC](https://forum.buildkite.community/t/concurrency-of-triggered-pipelines/3044/1 "2023-07-16T23:55:40Z")

</div>

I’d like to have a deploy pipeline with steps to deploy to multiple environments, ending in a production deploy. I’m intending for this pipeline to be triggered by a successful run of a build/test pipeline. It sounds like I can use [concurrency groups](https://buildkite.com/docs/pipelines/controlling-concurrency#concurrency-groups) to ensure that only a single deploy is happening at any one time.

My questions is do triggered pipelines inherit ordering from triggering builds? My concern is that if I have two merges, resulting in two build/test pipeline runs, the second may complete and trigger it’s deploy before the first. eg:

1. build/test for first merge
2. build/test for second merge
3. deploy for second merge
4. deploy for first merge - accidentally removes features added in second merge

I can’t find any explicit documentation on the behaviour here in the concurrency docs linked or the [trigger step docs](https://buildkite.com/docs/pipelines/trigger-step).

---

<div class="post-metadata">

**Author:** ![lizette](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.buildkite.community/lizette/32/1161_2.png) [@lizette](https://forum.buildkite.community/u/lizette)\
**Post date:** [July 17, 2023, 12:53am UTC](https://forum.buildkite.community/t/concurrency-of-triggered-pipelines/3044/2 "2023-07-17T00:53:57Z")

</div>

hi @uh-toby,

Welcome to the Buildkite Support Community! 👋

We have a blog that explains concurrency gates that you might find useful. You can read more about it here [Concurrency Gates - Buildkite Blog](https://buildkite.com/blog/concurrency-gates). If you put your deploy steps in concurrency gates, this would ensure the order when they run.

Cheers!

---

<div class="post-metadata">

**Author:** ![uh-toby](https://avatars.discourse-cdn.com/v4/letter/u/c5a1d2/32.png) [@uh-toby](https://forum.buildkite.community/u/uh-toby)\
**Post date:** [July 17, 2023, 1:52am UTC](https://forum.buildkite.community/t/concurrency-of-triggered-pipelines/3044/3 "2023-07-17T01:52:32Z")

</div>

Hi @lizette ,

Thanks for the link, useful reading! If I understand, since concurrency group labels are accessible by all pipelines in an organization the concurrency gate technique could be used across multiple pipelines.  
I think that would mean that the triggering step would need to wait for the triggered build to complete to “end” the concurrency gate, does that sound right?

Thanks,  
Toby

---

<div class="post-metadata">

**Author:** ![lizette](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.buildkite.community/lizette/32/1161_2.png) [@lizette](https://forum.buildkite.community/u/lizette)\
**Post date:** [July 17, 2023, 2:18am UTC](https://forum.buildkite.community/t/concurrency-of-triggered-pipelines/3044/4 "2023-07-17T02:18:52Z")

</div>

Hi @uh-toby,

Yes, the concurrency group label applies across pipelines within the organisation. However, for the triggering step to wait for the triggered build to complete or not depends on the value you set for the `async` trigger step attribute. For the use case you described, the trigger step should have `async: false`.

Cheers!

---

<div class="post-metadata">

**Author:** ![paula](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.buildkite.community/paula/32/954_2.png) [@paula](https://forum.buildkite.community/u/paula)\
**Post date:** [August 29, 2023, 5:39am UTC](https://forum.buildkite.community/t/concurrency-of-triggered-pipelines/3044/5 "2023-08-29T05:39:31Z")

</div>


