Introducing the build status API for Bitbucket Cloud

By on November 18, 2015

Many of you have been asking for better support for continuous integration in Bitbucket Cloud. Every time you trigger a build,  whether by pushing commits or creating a pull request, you have to log in to your build server to see if it passed or failed. For many of you, we know it’s been a major hassle that you’ve had no way to see the build status right within the UI  – until now.

Starting today, the build status API is available with updates to the UI providing at-a-glance feedback on commits, branches, and pull requests in Bitbucket Cloud. Now, you’ll be able to know when your build is passing and when it’s safe to merge changes saving you precious time to do what you do best: coding.

Commits
When viewing the commits in your repository, you can clearly see which of those commits have been checked out and tested by your CI tool of choice. If the tests all pass, you see a green checkmark, or else we display a red warning indicator.

For a more detailed view about the status of a commit, the commit view provides a listing of the passed or failed builds (if you have multiple builds), and passed or failed tests for each build. This saves you precious time as you don’t have to browse through log files of your CI tool trying to find why the build failed.

Pull Requests
An arguably even more useful application of the Bitbucket’s build status API is for pull requests. If you use pull requests to do code reviews (like we do), you know that one of the first questions you always ask as a reviewer is “Do the tests still pass?” This question is now easily answered by looking for a successful build status indicator in the pull request view.

Branches
You can also see the build status at a branch level which is great for distributed teams. Make sure your builds have passed before you merge your changes to the master branch.

Next Steps
We’re working on integrating with other CI tools using the build status API. In the meantime, if you want to use build status now, the best way is to write a simple script to post the results of your builds to the Bitbucket API. Most importantly, if you want to build an integration for Bitbucket Cloud with the CI tool of your choice, get started by taking a look at our documentation. We’re excited to see all the integrations you build in the next few weeks.

Happy coding and shipping!

  • Stefan Frehse

    That sounds very great. Do you plan to support automerges for pull-request considering the build status? Moreover, do you plan to support those build status features in bitbucket server as well?

    • Raj Sarkar

      Hi Stefan,
      Build Status is already supported in Bitbucket Server.
      – Raj

  • Scott Carpenter

    Nice. When do you expect to Bamboo Cloud integration released?

  • kiiu
  • Masaru Furuya

    cool!! Thank you for developer team.

  • ThallisPHP

    It’s great !!!!!!

  • Raffi Enficiaud

    This feature is wonderful!

    I can see everywhere on the Internet the Travis / Appveyor quality report, but nothing for being able to programmatically post bamboo build updates.

    Do you plan to provide a bamboo(server) plugin for that? How would that work with pull requests?

    • Arthur Tagirov

      Appveyor already deployed future for this.

      • Raffi Enficiaud

        This is not exactly what I am asking for…

  • naabster

    I cant seem to get it working – are there any not outdated documents on the integration between Bitbucket Cloud and Bamboo Server?

    The Build Column in Bitbucket stays empty…

  • diogogmt

    Anybody is aware of any Jenkins plugins connecting to the new BitBucket build API?

  • Lars Steenhoff

    Does this work with Unity cloud builds?

    https://build.cloud.unity3d.com/landing/

  • arrubiu

    I’m trying to use these API, but I’ve a problem. Authentication through OAuth is ok, I obtain an access token, but if I try to post, I obtain always a “Forbidden” response, even if permissions for consumer are ok. Any idea?

  • Thomas Van Sundert

    Any plans to visualize this in SourceTree?

    • Daniel Jimenez

      Good idea.

    • ItaiSanders

      exactly what I was looking for!

  • samlev

    So when are we expecting to see this integration between BitBucket Server and Bamboo Server? It’s the final blocker for my company to move across.

  • Artur Edamov

    Is there any integration with TeamCity ?

    • Daniel Jimenez

      Not an official one I don’t think, I built something very simple using a metarunner and Python Requests library.

    • Daniel Jimenez

      There is a TeamCity plugin I’ve been using with great success.

  • Jelle DL

    Anyone that got this working with Jenkins already? Seeing some HTTP Post plugins, but not really working in this combination :/

  • Dylan Nelson

    Does the URL link actually work? For me, clicking on any build name in the modal drops me at https://api.bitbucket.org/2.0/repositories/{owner}/{repo}/commit/{revision}/statuses/build ignoring whatever URL has been previously included when setting the status.

  • Juan Reyes

    This looks great! Any integrations with Bamboo Server?

  • Antonio Mansilla

    Anyone interested in using this feature in jenkins take a look to this plugin https://wiki.jenkins-ci.org/display/JENKINS/Bitbucket+Build+Status+Notifier+Plugin.

    • http://memoryboxes.github.io/ Memory Box

      Hi, Antonio
      Thank you very much!
      You save me much time.

  • Antonio Mansilla

    I’m experiencing issues with the build status in the pull requests view, the user case is the following:

    You have a repository and a fork of this one.You create a pull request from the fork to the canonical repo.

    You publish the build status as SUCCESSFULL on the pull requested commit on the forked repo.

    The problem in fact is that the forked repo properly shows the build status but it’s not gonna be shown in the pull request page of the canonical repository (https://bitbucket.org/username/reponame/pull-requests/).

    Can anyone tell me if this is still not supported, not desired or I misunderstood something?

  • PhilS

    This is great. Finally got it working with TeamCity and BitBucket 2FA. Next, would be great to see an option to restrict the Pull Request if the build hasn’t passed. (still running or failed)

    • AndrewB

      What did you have to do to get it working @disqus_z2m7peQoqp:disqus?

  • http://www.marko.anastasov.name Marko Anastasov

    We just shipped a highly anticipated UX upgrade to Semaphore CI based on this (https://semaphoreci.com/blog/2016/02/26/improved-bitbucket-continuous-integration-support.html). Thanks so much Dan & crew.

  • Christoph Schwarz

    Some CI solutions know not only red and green or “success” and “failure” but might also know a yellow state. Jenkins CI for example has an “unstable” state, typically visualized by a yellow ball. Projects enter this state if they build successful but have failed test cases.
    Your API only knows “success” and “failure”. Would you consider adding a third state like “warning”? This could be used for mapping Jenkins’s “unstable” state.

    • Dan Tao

      Short answer: yes, we would certainly consider it. We’ll probably offer something like that in the future.

      Slightly longer answer: originally we considered allowing any arbitrary state to be posted to the API. Obviously there are UX complications with that (what icon do we display for “foo”?), but more importantly we decided it would be better to take a slightly more prescriptive approach and encourage teams to configure their builds so that results are always actionable (the difference between “SUCCESSFUL” and “FAILED” can ultimately be reduced to the question: is some action required?).

      That said we do recognize that there may be 1 or 2 more statuses we should support to provide slightly more detail, for teams to adopt to their processes as they see fit. We started out with a small set, though, since it’s always easier to add options than it is to remove them.