Skip to content

Fix Required Builds merge check by switching to repo-scoped Bitbucket…#460

Open
asmild wants to merge 2 commits intojenkinsci:release/1.xfrom
asmild:fix-send-status-payload
Open

Fix Required Builds merge check by switching to repo-scoped Bitbucket…#460
asmild wants to merge 2 commits intojenkinsci:release/1.xfrom
asmild:fix-send-status-payload

Conversation

@asmild
Copy link
Copy Markdown

@asmild asmild commented Apr 15, 2026

Use repo-scoped Bitbucket builds API to fix Required Builds merge check

The plugin currently uses the deprecated /rest/build-status/1.0/commits/{sha} endpoint,
which does not work with Bitbucket's "Required Builds" merge check — builds appear on
commits but are not recognized as satisfying merge requirements.

This PR switches to the repo-scoped /rest/api/latest/projects/{project}/repos/{repo}/commits/{sha}/builds
endpoint and adds the parent field to the payload.

Changes:

  • New BuildStatusUriFactory.create() overload for repo-scoped API
  • Auto-detect project key and repo slug from Git remote URL
  • Add parent field to notification payload (required for Required Builds matching)
  • Accept HTTP 200-299 responses (new API returns 200, not 204)
  • Fall back to legacy API when project/repo cannot be determined

Testing done

  • All existing 76 tests pass, new unit tests added for:
    • Repo-scoped URI construction
    • HTTP 200/201/204 success and 400/500 failure responses
    • Git remote URL parsing (HTTPS, SSH, SCP-style, personal repos)
  • Manual testing against Bitbucket Data Center with Required Builds merge check enabled

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira — Fixes Bitbucket 7.15 RestAPI update #290
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests that demonstrate the feature works or the issue is fixed

@asmild asmild requested a review from a team as a code owner April 15, 2026 07:33
@asmild asmild force-pushed the fix-send-status-payload branch from 1263a4d to 491e0df Compare April 15, 2026 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bitbucket 7.15 RestAPI update

1 participant