Uploaded image for project: 'Bitbucket Data Center'
  1. Bitbucket Data Center
  2. BSERV-19721

API Docs for /rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/builds, don't include PARENT as a required field

XMLWordPrintable

      Issue Summary

      Using the below API to manually post the build status:

      http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/builds'

      without the PARENT parameter gives the warning on the Bitbucket UI "Successful build of testFolder for the latest commit is required before this pull request can be merged".
      We need to update the REST API documentation to make this a required parameter.

      Steps to Reproduce

      1. In the request body of the API
        http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/builds'
        

        don't include the parent parameter:

        {
            "key": "TEST-REP123",
            "state": "SUCCESSFUL",
            "url": "https://bamboo.url/browse/TEST-REP1-3",
            "buildNumber": "3",
            "description": "Unit test build",
            "duration": 1500000,
            "lastUpdated": 1359075920,
            "name": "Database Matrix Tests",
            "ref": "refs/heads/master",
            "testResults": {
                "failed": 1,
                "skipped": 8,
                "successful": 0
            }
        }
        
      2. Manually try to run this API query to POST the build status.

      Expected Results

      The API should be able to add/update the Build status to Bitbucket

      Actual Results

      The warning "Successful build of testFolder for the latest commit is required before this pull request can be merged" can be seen on the Bitbucket UI.
      For the Required builds feature to work, we look for the Parent parameter and check if it has successful builds attached to it

      Workaround

      The parent parameter is the one we check to determine if the build is successful or not, here's an example:

      {
          "key": "TEST-REP123",
          "state": "SUCCESSFUL",
          "url": "https://bamboo.url/browse/TEST-REP1-3",
          "buildNumber": "3",
          "description": "Unit test build",
          "duration": 1500000,
          "lastUpdated": 1359075920,
          "name": "Database Matrix Tests",
          "parent": "TEST-REP",
          "ref": "refs/heads/master",
          "testResults": {
              "failed": 1,
              "skipped": 8,
              "successful": 0
          }
      }

      Please make sure to include that in the request body for the POST query.
      Relevant API links for example:

              95e5dd71de92 David Zhu (Inactive)
              04f11a9d4cc8 Apoorva
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: