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!

46 Comments

  • Stefan Frehse
    Posted November 18, 2015 at 1:58 pm | Permalink

    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
      Posted November 18, 2015 at 2:11 pm | Permalink

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

      • DuckieHo
        Posted September 7, 2016 at 2:05 pm | Permalink

        Hi, where is the documentation for this feature? I want to display Jenkins build status in Bitbucket Server.

  • Scott Carpenter
    Posted November 18, 2015 at 3:26 pm | Permalink

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

  • kiiu
    Posted November 18, 2015 at 5:00 pm | Permalink
  • Masaru Furuya
    Posted November 18, 2015 at 5:20 pm | Permalink

    cool!! Thank you for developer team.

  • ThallisPHP
    Posted November 19, 2015 at 6:53 pm | Permalink

    It’s great !!!!!!

  • Raffi Enficiaud
    Posted November 24, 2015 at 1:54 pm | Permalink

    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
      Posted November 29, 2015 at 11:48 pm | Permalink

      Appveyor already deployed future for this.

      • Raffi Enficiaud
        Posted November 30, 2015 at 6:54 am | Permalink

        This is not exactly what I am asking for…

  • naabster
    Posted November 27, 2015 at 7:35 am | Permalink

    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
    Posted November 29, 2015 at 7:57 pm | Permalink

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

  • Lars Steenhoff
    Posted December 9, 2015 at 7:33 am | Permalink

    Does this work with Unity cloud builds?

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

  • arrubiu
    Posted December 16, 2015 at 9:23 am | Permalink

    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
    Posted December 17, 2015 at 4:46 am | Permalink

    Any plans to visualize this in SourceTree?

    • Daniel Jimenez
      Posted December 29, 2015 at 8:11 am | Permalink

      Good idea.

    • ItaiSanders
      Posted July 18, 2016 at 10:52 pm | Permalink

      exactly what I was looking for!

  • samlev
    Posted December 23, 2015 at 1:47 pm | Permalink

    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
    Posted December 26, 2015 at 8:35 am | Permalink

    Is there any integration with TeamCity ?

    • Daniel Jimenez
      Posted December 29, 2015 at 8:11 am | Permalink

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

    • Daniel Jimenez
      Posted January 6, 2016 at 12:32 pm | Permalink

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

  • Jelle DL
    Posted December 30, 2015 at 11:04 am | Permalink

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

  • Dylan Nelson
    Posted January 7, 2016 at 6:00 am | Permalink

    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
    Posted January 14, 2016 at 4:13 pm | Permalink

    This looks great! Any integrations with Bamboo Server?

  • Antonio Mansilla
    Posted January 18, 2016 at 3:03 am | Permalink

    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.

    • Posted March 28, 2016 at 6:48 pm | Permalink

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

  • Antonio Mansilla
    Posted January 22, 2016 at 6:07 am | Permalink

    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
    Posted January 28, 2016 at 1:45 am | Permalink

    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
      Posted March 28, 2016 at 6:13 pm | Permalink

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

  • Posted February 26, 2016 at 8:06 am | Permalink

    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
    Posted April 28, 2016 at 11:41 am | Permalink

    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
      Posted April 28, 2016 at 1:00 pm | Permalink

      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.