CircleCI Ideas

Trigger new build when a Pull Request is opened

Circle CI should generate a new build when a pull request is opened on github. The current implementation uses the branch's most recent commit result, instead of generating a brand new build.

Consider the following situation.

1) An engineer creates a branch within github, and pushes code up at their leisure. Circle CI builds the project on each commit.
2) When it comes time to make a pull request, the engineer opens up a PR on github, without creating a new git commit.
 
This workflow does not seem to trigger a new build of the branch on Circle CI, and instead Circle CI uses the build result of the most recent commit as the build status of the Pull Request. This seems to be an obvious workflow flaw given that I may have additional logic to build a PR artifact for testing purposes, vs the normal branch commit process. This has been discussed both here and here on your forums as well.

I have found 2 additional configurations under "advanced settings" that compliment this idea, but do not do what I intend.
• Build forked pull requests
• Only build pull requests

As a counterpoint, you can configure both Jenkins and Travis CI to do this, so this seems like a pretty straightforward use case of the platform. Obviously, if you if you push an additional commit to the branch that already has an existing PR, the additional variables or logic within Circle CI will be present.

  • Avatar32.5fb70cce7410889e661286fd7f1897de Guest
  • Mar 21 2018
  • Taking votes
  • Attach files
  • Avatar40.8f183f721a2c86cd98fddbbe6dc46ec9
    Guest commented
    November 08, 2018 21:26

    Heroku CI also does this. I'm pretty surprised circleCI does not. It's a pretty basic scenario for CI tools isnt it? I'd like to build on commits AND on PR's, not either/or. 

  • Avatar40.8f183f721a2c86cd98fddbbe6dc46ec9
    Guest commented
    28 Feb 04:31

    Yeah, this is pretty critical for open source projects

  • Avatar40.8f183f721a2c86cd98fddbbe6dc46ec9
    Guest commented
    05 Mar 11:59

    I'm amazed that this isn't the number one feature request (It should have been implemented before launch). Right now, CircleCI simply doesn't test pull requests properly.

    This old thread provides some more details. The requirement is to listen to the webhooks for pull request opened/updated and trigger a build of the merge_commit_sha as specified in the docs. Each time a commit is pushed to the root branch or the PR the build has to be redone. This is then fed back as a second status to GitHub. See also the Travis docs for details of what needs implementing.

    Travis, Shippable and no doubt many other CI systems support this. And it really is basic CI functionality. Please prioritise this!

  • Avatar40.8f183f721a2c86cd98fddbbe6dc46ec9
    Guest commented
    07 May 06:32

    Hi, Can someone @CircleCI comment on this? This is a critical feature for us.

  • Avatar40.8f183f721a2c86cd98fddbbe6dc46ec9
    Guest commented
    13 Jun 12:32

    There are so many requests for this and no response from CircleCI as to where it is in priority. If you are researching CI systems to use, I would avoid CircleCI for this reason, and for the lack of support for this feature.

  • Avatar40.8f183f721a2c86cd98fddbbe6dc46ec9
    Guest commented
    08 Jul 11:49

    Yeah, currently to get SonarCloud checks to show up on a PR we have to remember to re-run the build after we open the PR. Either this idea or CCI-I-315 would address that.

  • Avatar40.8f183f721a2c86cd98fddbbe6dc46ec9
    Guest commented
    24 Jul 15:27

    Unfortunately we had to go back to Travis CI because of this issue. This workflow is critical to us

  • Avatar40.8f183f721a2c86cd98fddbbe6dc46ec9
    Guest commented
    04 Aug 17:12

    Hey guys, I found a solution to this problem and posted it here: https://discuss.circleci.com/t/how-to-trigger-pr-pipelines-in-circleci-for-bitbucket/31715 

     

    Cheers,

    derbenoo 

  • Avatar40.8f183f721a2c86cd98fddbbe6dc46ec9
    Guest commented
    12 Sep 16:42

    Conversely, it would be quite nice to trigger a job when a PR is closed/merged.

     

    This is shamelessly cribbing from GitlabCI's dynamic environments and review apps: https://docs.gitlab.com/ee/ci/review_apps/index.html#configuring-review-apps

     

    I would love it if CircleCI ran a job I defined (which would `terraform destroy`) when the branch was deleted / PR was closed.

  • Avatar40.8f183f721a2c86cd98fddbbe6dc46ec9
    Guest commented
    26 Sep 21:43

    Any timeframe on when this capability will be added? It’s such an important feature. 

  • Avatar40.8f183f721a2c86cd98fddbbe6dc46ec9
    Guest commented
    10 Oct 01:58

    I will add that I am part of a medium sized company that just made the decision to NOT use CircleCI due to this very issue, combined with the alarming amount of CircleCI reps in the forums giving generic responses to these huge issues ("we're working on it" - 2 years later: ...). Come on guys this is literally the most fundamental Continuous Integration function there is, how can you be this far along and not have proper handling of PRs.

    I switched to a competitor (not going to name) and this is super simple to accomplish, like ridiculously so in comparison...