# Only one pipelines are triggered after pushing commits to a branch

**URL:** <https://forum.buildkite.community/t/only-one-pipelines-are-triggered-after-pushing-commits-to-a-branch/3757>\
**Category:** Pipelines\
**Created:** [June 26, 2024, 5:07am UTC](https://forum.buildkite.community/t/only-one-pipelines-are-triggered-after-pushing-commits-to-a-branch/3757 "2024-06-26T05:07:54Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![son.propte](https://avatars.discourse-cdn.com/v4/letter/s/a88e57/32.png) [@son.propte](https://forum.buildkite.community/u/son.propte)\
**Post date:** [June 26, 2024, 5:07am UTC](https://forum.buildkite.community/t/only-one-pipelines-are-triggered-after-pushing-commits-to-a-branch/3757/1 "2024-06-26T05:07:54Z")

</div>

Hi Buildkite Team,

We have an issue with triggering pipelines. There is only one pipeline triggered after pushing a commit to master branch.

We have 2 pipelines:

- Pipeline 1: This pipeline is triggered to deploy our app to dev environment when there are commits pushed to master branch
- Pipeline 2: This pipeline is triggered to run lint and build checks when there is a PR targeting into staging branch opened/synchronized

I created 2 PRs:

- PR 1: This PR is targeted from a feature branch into the master branch
- PR 2: This PR is targeted from the master branch into the staging branch

When I merge the PR 1, it only triggers Pipeline 2 without triggering the Pipeline 1.  
The Pipeline 1 will be triggered if I close the PR 2.

Could you please let me know if there is a way for us to trigger both Pipeline 1 and Pipeline 2 after merging a PR into master branch?

Thanks.

---

<div class="post-metadata">

**Author:** ![Priya](https://avatars.discourse-cdn.com/v4/letter/p/eada6e/32.png) [@Priya](https://forum.buildkite.community/u/Priya)\
**Post date:** [June 26, 2024, 5:20am UTC](https://forum.buildkite.community/t/only-one-pipelines-are-triggered-after-pushing-commits-to-a-branch/3757/2 "2024-06-26T05:20:27Z")

</div>

Hey son.propte 👋

Welcome back to Buildkite community!

To trigger both Pipeline 1 and Pipeline 2 after merging PR into master branch, we will need to ensure “Build Pull Requests” is enabled in your pipeline settings.

Could you confirm if it is enabled or give it a try by enabling it?

Also share pipeline links to assist further.

Cheers,  
Priya

---

<div class="post-metadata">

**Author:** ![son.propte](https://avatars.discourse-cdn.com/v4/letter/s/a88e57/32.png) [@son.propte](https://forum.buildkite.community/u/son.propte)\
**Post date:** [June 26, 2024, 7:04am UTC](https://forum.buildkite.community/t/only-one-pipelines-are-triggered-after-pushing-commits-to-a-branch/3757/3 "2024-06-26T07:04:16Z")

</div>

Hi @Priya,

This is the pipeline 1: [https://buildkite.com/propte/dev-deployment-pipelines](https://buildkite.com/propte/dev-deployment-pipelines)  
This is the pipeline 2: [https://buildkite.com/propte/staging-building-pipeline](https://buildkite.com/propte/staging-building-pipeline)

When a release staging pull request is opened, if there is a new commit pushed to master branch, only pipeline 2 is triggered.

Please help me check that.

Thanks.

---

<div class="post-metadata">

**Author:** ![Priya](https://avatars.discourse-cdn.com/v4/letter/p/eada6e/32.png) [@Priya](https://forum.buildkite.community/u/Priya)\
**Post date:** [June 26, 2024, 7:13am UTC](https://forum.buildkite.community/t/only-one-pipelines-are-triggered-after-pushing-commits-to-a-branch/3757/4 "2024-06-26T07:13:30Z")

</div>

Hi @son.propte,

I see below condition is being added to your pipeline 1

```
    build.branch == "master" && build.env("BUILDKITE_PULL_REQUEST") == "false"

```

Which means it is targeted for builds with commits to Master branch at the same time it shouldn’t be a PR.

Could you try removing that condition and give it a try.

Cheers,  
Priya

---

<div class="post-metadata">

**Author:** ![son.propte](https://avatars.discourse-cdn.com/v4/letter/s/a88e57/32.png) [@son.propte](https://forum.buildkite.community/u/son.propte)\
**Post date:** [June 26, 2024, 7:45am UTC](https://forum.buildkite.community/t/only-one-pipelines-are-triggered-after-pushing-commits-to-a-branch/3757/5 "2024-06-26T07:45:39Z")

</div>

Hi @Priya ,

I have just removed the condition. It triggered both Pipeline 1 and Pipeline 2.

There is a new issue, both Pipeline 1 and Pipeline 2 are triggered with the same event - Staging Release pull request triggers a synchronized event.

Is there a way to trigger the Pipeline 2 by synchronized pull request event and trigger Pipeline 1 by push event?

Thanks.

---

<div class="post-metadata">

**Author:** ![ivanna](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.buildkite.community/ivanna/32/1410_2.png) [@ivanna](https://forum.buildkite.community/u/ivanna)\
**Post date:** [June 26, 2024, 11:17pm UTC](https://forum.buildkite.community/t/only-one-pipelines-are-triggered-after-pushing-commits-to-a-branch/3757/6 "2024-06-26T23:17:38Z")

</div>

Hey @son.propte

Yes, you can configured your Buildkite pipelines to be triggered by different events and branch conditions to achieve the requested behaviour.

Here is the settings in your pipelines to achieve that:

**1. Pipeline 1**

- Disable Build Pull Request

- Enable Filter builds using a conditional: build.pull\_request.base\_branch !=“staging”

- Enable Builds branches (That would creates builds when branches are pushed)

**2. Pipeline2**

- Enable Filter builds using a conditional: build.pull\_request.base\_branch ==“staging”

- Enable Build Pull Request (Skip pull request builds for existing commits)

- Enable Update Commit Statuses

By following these settings, Pipeline 1 will be triggered only by pushes to the branch, while Pipeline 2 will be triggered only by Pull Request, filtered by the target branch.

---

<div class="post-metadata">

**Author:** ![son.propte](https://avatars.discourse-cdn.com/v4/letter/s/a88e57/32.png) [@son.propte](https://forum.buildkite.community/u/son.propte)\
**Post date:** [June 27, 2024, 2:18am UTC](https://forum.buildkite.community/t/only-one-pipelines-are-triggered-after-pushing-commits-to-a-branch/3757/7 "2024-06-27T02:18:27Z")

</div>

Hi @ivanna ,

I have updated my pipelines’ configuration following your direction, but it seems like it doesn’t work.

It just triggers only [Pipeline 2](https://buildkite.com/propte/staging-building-pipeline) when I push a new commit to master branch

Could you please help me check that?

Thanks.

---

<div class="post-metadata">

**Author:** ![ivanna](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.buildkite.community/ivanna/32/1410_2.png) [@ivanna](https://forum.buildkite.community/u/ivanna)\
**Post date:** [June 27, 2024, 3:48am UTC](https://forum.buildkite.community/t/only-one-pipelines-are-triggered-after-pushing-commits-to-a-branch/3757/8 "2024-06-27T03:48:01Z")

</div>

Sure, delete please your **Branch Filter Pattern** in Pipeline 1. Currently you have “master” if you leave it empty, it should work.

Thanks,

---

<div class="post-metadata">

**Author:** ![son.propte](https://avatars.discourse-cdn.com/v4/letter/s/a88e57/32.png) [@son.propte](https://forum.buildkite.community/u/son.propte)\
**Post date:** [June 27, 2024, 3:55am UTC](https://forum.buildkite.community/t/only-one-pipelines-are-triggered-after-pushing-commits-to-a-branch/3757/9 "2024-06-27T03:55:46Z")

</div>

Hi @ivanna , the pipeline should only be triggered when pushing commits to master branch. It shouldn’t be triggered when pushing commits to other branches

Should we leave the **Branch Filter Pattern** in Pipeline 1 empty?

---

<div class="post-metadata">

**Author:** ![son.propte](https://avatars.discourse-cdn.com/v4/letter/s/a88e57/32.png) [@son.propte](https://forum.buildkite.community/u/son.propte)\
**Post date:** [June 27, 2024, 3:58am UTC](https://forum.buildkite.community/t/only-one-pipelines-are-triggered-after-pushing-commits-to-a-branch/3757/10 "2024-06-27T03:58:26Z")

</div>

Hi @ivanna , I have just removed **Branch Filter Pattern** in Pipeline 1, but it doesn’t work

I pushed a commit to master branch, but only Pipeline 2 is triggered

---

<div class="post-metadata">

**Author:** ![benmc](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.buildkite.community/benmc/32/1159_2.png) [@benmc](https://forum.buildkite.community/u/benmc)\
**Post date:** [June 27, 2024, 5:59am UTC](https://forum.buildkite.community/t/only-one-pipelines-are-triggered-after-pushing-commits-to-a-branch/3757/11 "2024-06-27T05:59:37Z")

</div>

Hey @son.propte 👋

At the risk of adding even more input to this, I’m wondering if these require the same webhook.

Currently the two pipelines use different webhooks (found in the Settings for the pipelines). Using the same webhook would allow single events to push to both pipelines and you could then use the settings for the individual pipelines to filter builds accordingly.

Cheers!

---

<div class="post-metadata">

**Author:** ![son.propte](https://avatars.discourse-cdn.com/v4/letter/s/a88e57/32.png) [@son.propte](https://forum.buildkite.community/u/son.propte)\
**Post date:** [June 27, 2024, 7:00am UTC](https://forum.buildkite.community/t/only-one-pipelines-are-triggered-after-pushing-commits-to-a-branch/3757/12 "2024-06-27T07:00:39Z")

</div>

Hi @benmc , could you please guide me how to configure that? What I have to do to configure for the two pipelines?

---

<div class="post-metadata">

**Author:** ![karen.sawrey](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.buildkite.community/karen.sawrey/32/1188_2.png) [@karen.sawrey](https://forum.buildkite.community/u/karen.sawrey)\
**Post date:** [June 27, 2024, 1:43pm UTC](https://forum.buildkite.community/t/only-one-pipelines-are-triggered-after-pushing-commits-to-a-branch/3757/13 "2024-06-27T13:43:28Z")

</div>

Hello, @son.propte !  
We have discussed your issue internally and at the moment, we need more information from you.

For the events like the one you’ve mentioned - “pushed a commit to master branch, but only Pipeline 2 is triggered” - could you please send us the commit SHA for the events that didn’t trigger the expected builds on Buildlkite’s side to [support@buildkite.com](mailto:support@buildkite.com)? That would help us with troubleshooting.

Many thanks in advance!
