<p>One could <a href="https://developer.atlassian.com/bitbucket/server/docs/latest/how-tos/updating-build-status-for-commits.html" rel="nofollow noreferrer">update the build status in bitbucket</a> as follows:</p>

<blockquote>
  <p>Adding a build result to a commit</p>
  
  <p>To associate a build result with a particular commit, you need to POST
  a JSON object to the build status REST resource at:</p>
  
  <p><code>https://&lt;bitbucket-base-url&gt;/rest/build-status/1.0/commits/&lt;commit-hash&gt;</code></p>
  
  <p>The format of the JSON object that should be used as the request body
  is:</p>

<pre><code>{
    "state": "&lt;INPROGRESS|SUCCESSFUL|FAILED&gt;",
    "key": "&lt;build-key&gt;",
    "name": "&lt;build-name&gt;",
    "url": "&lt;build-url&gt;",
    "description": "&lt;build-description&gt;"
}
</code></pre>
</blockquote>

<p>One could run such a snippet by codefresh at the end of the build using a script to notify bitbucket regarding the build status of a commit.</p>

<blockquote>
  <p>One green build</p>
  
  <p>The following curl command will add a build to the commit
  9e72f04322c4a1f240e0b3158c67c3c19cdd16e7:</p>

<pre><code>curl -u username:password -H "Content-Type: application/json" -X POST
http://localhost:7990/bitbucket/rest/build-status/1.0/commits/9e72f04322c4a1f240e0b3158c67c3c19cdd16e7
-d @build0.json
</code></pre>
  
  <p>Where build0.json contains:</p>

<pre><code>{
    "state": "SUCCESSFUL",
    "key": "REPO-MASTER",
    "name": "REPO-MASTER-42",
    "url": "https://bamboo.example.com/browse/REPO-MASTER-42",
    "description": "Changes by John Doe"
}
</code></pre>
</blockquote>

CC BY-SA 3.0
2017-11-23T23:47:46.347Z
2017-11-23T23:52:52.817Z
2017-11-23T23:52:52.817Z
030
<p>I have a BitBucket Cloud repository with a WebHook to trigger <a href="https://codefresh.io/" rel="nofollow noreferrer">Codefresh</a> builds on Pull Requests.  I would like the build results to appear as comments on the PRs, similar to the way Travis integration works for GitHub.</p>

<p>I couldn't find any settings for this in my BitBucket repository or in Codefresh, but Codefresh's documentation seems to suggest that this happens automatically when you setup integration with GitHub.</p>

<p>I can't find any examples of BitBucket repository with automatic comments. Is it supported?</p>

CC BY-SA 3.0
2017-04-28T02:24:11.033Z
it may not matter, and may not exist for either, but are you using bitbucket cloud or bitbucket server?
burnettk
CC BY-SA 3.0
2017-04-28T15:36:56.260Z
@KevinBurnett Bitbucket Cloud
aebabis
<continuous-integration><bitbucket><bcbsn><codefresh>
How can I automatically post Codefresh build results to pull requests in Bitbucket?
aebabis
# How can I automatically post Codefresh build results to pull requests in Bitbucket?

(Asked by: username_0 on 2017-04-27)

I have a BitBucket Cloud repository with a WebHook to trigger [Codefresh](https://codefresh.io/) builds on Pull Requests. I would like the build results to appear as comments on the PRs, similar to the way Travis integration works for GitHub.

I couldn't find any settings for this in my BitBucket repository or in Codefresh, but Codefresh's documentation seems to suggest that this happens automatically when you setup integration with GitHub.

I can't find any examples of BitBucket repository with automatic comments. Is it supported?

**Tags:** continuous-integration, bitbucket, bcbsn, codefresh

> **Comments:**
> **username_1**: it may not matter, and may not exist for either, but are you using bitbucket cloud or bitbucket server?  
> **username_0**: @KevinBurnett Bitbucket Cloud  

---

## 1 answers

### Answer by username_2 on 2017-11-23. Score: 3

One could update the build status in bitbucket as follows:

Adding a build result to a commit
To associate a build result with a particular commit, you need to POST
  a JSON object to the build status REST resource at:
https:///rest/build-status/1.0/commits/
The format of the JSON object that should be used as the request body
  is:
{
    "state": "",
    "key": "",
    "name": "",
    "url": "",
    "description": ""
}


One could run such a snippet by codefresh at the end of the build using a script to notify bitbucket regarding the build status of a commit.

One green build
The following curl command will add a build to the commit
  9e72f04322c4a1f240e0b3158c67c3c19cdd16e7:
curl -u username:password -H "Content-Type: application/json" -X POST
http://localhost:7990/bitbucket/rest/build-status/1.0/commits/9e72f04322c4a1f240e0b3158c67c3c19cdd16e7
-d @build0.json

Where build0.json contains:
{
    "state": "SUCCESSFUL",
    "key": "REPO-MASTER",
    "name": "REPO-MASTER-42",
    "url": "https://bamboo.example.com/browse/REPO-MASTER-42",
    "description": "Changes by John Doe"
}


---

