Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Required build checks with build statuses published from TeamCity

8170605 November 4, 2021

Hi,

We've been testing the new required builds functionality and found out that it seemingly doesn't work out of the box in Bitbucket Data Center for build statuses published from TeamCity's Commit Status Publisher build feature.

To configure the required build check in Bitbucket, a user is asked for a build key. We assumed that this is the value that is passed in the "key" field when commit statuses are published to Bitbucket. Yet it is seemingly not the case. At least the add required build form doesn't find any such keys (despite some statuses already published to various commits in our test repo) and if they key is added manually, Bitbucket claims that the merge operation is not allowed, even if a success status is published to the top commit in the respective branch. 

Could it be the case that some add-on on Bitbucket Data Center side is required? Or are these different kind of keys?

1 answer

0 votes
Ulrich Kuhnhardt _IzymesCo_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
November 5, 2021

The build result API for a certain commit as per REST API spec [1] can have the following payload:

Example
{
    "key": "TEST-REP123",
    "state": "SUCCESSFUL",
    "url": "https://bamboo.url/browse/TEST-REP1-3",
    "buildNumber": "3",

The required build form lets you configure a merge-check based on successful build results for

  • a specific target branch (or pattern)
  • only consider build results with a certain 'key'

At runtime the build result will be recorded by Bitbucket and if there is a pull request with a source-ref hash identical to the the {commitId} and a matching build key the build result will be considered when checking if the PR can be merged, or should be blocked because of a failing build.

We at Izymes have made an add-on called Workzone that lets you specify the number of successful builds (usually 1) for a protected target branch and also triggers an automatic merge if the build was successful. We have found that for most teams a successful build is the last step in their PR merge process, and it's easy to automate. Trigger build, build pass, automatic merge, done.

I hope this helps your integration. Best, Ulrich

Izymes - Remove boring from work

[1] https://docs.atlassian.com/bitbucket-server/rest/7.17.0/bitbucket-rest.html#idp228

Ulrich Kuhnhardt _IzymesCo_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
November 5, 2021

... forgot to mention, Workzone does not require a 'build key' in its configuration for build result merge-checks and auto-merge.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events