Only one pipelines are triggered after pushing commits to a branch

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.

Hey son.propte :wave:

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

Hi @Priya,

This is the pipeline 1: https://buildkite.com/propte/dev-deployment-pipelines
This is the pipeline 2: 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.

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

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.

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.

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 when I push a new commit to master branch

Could you please help me check that?

Thanks.

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

Thanks,

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?

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

Hey @son.propte :wave:

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!

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

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? That would help us with troubleshooting.

Many thanks in advance!

What steps do I need to take to set up for the two pipelines?

Hey @jamesbasej19!

Welcome to the Community!

Are you looking to trigger 2 pipelines from the same GitHub repo?

Cheers