Skip to content

feat: BB client gen (for cloud + server) + merge strategy support#6128

Draft
fuskovic wants to merge 16 commits intomainfrom
fuskovic/bb-client
Draft

feat: BB client gen (for cloud + server) + merge strategy support#6128
fuskovic wants to merge 16 commits intomainfrom
fuskovic/bb-client

Conversation

@fuskovic
Copy link
Copy Markdown
Member

@fuskovic fuskovic commented Apr 20, 2026

  • Replaces the hand-rolled bbClient HTTP client in the Bitbucket git provider with a typed client generated from the Bitbucket Cloud OpenAPI spec via oapi-codegen v2.
  • Removes the github.com/ktrysmt/go-bitbucket dependency.
  • Adds a trimmed Bitbucket OAS3 spec (spec/bitbucket.gen.json) containing only the 4 endpoints used by the provider
  • Adds acodegen-bitbucket-client Makefile target (backed by oapi-codegen pinned in hack/tools/) so the generated client can be regenerated in one command.
  • Adds BitBucket merge method support.
  • Updates git-merge-pr docs to list the supported Bitbucket merge methods now that the generated enum makes them explicit.

Closes: #6023
Closes: #6022
Closes: #6020

Signed-off-by: fuskovic <fhuskovic92@gmail.com>
Signed-off-by: fuskovic <fhuskovic92@gmail.com>
Signed-off-by: fuskovic <fhuskovic92@gmail.com>
Signed-off-by: fuskovic <fhuskovic92@gmail.com>
Signed-off-by: fuskovic <fhuskovic92@gmail.com>
Signed-off-by: fuskovic <fhuskovic92@gmail.com>
Signed-off-by: fuskovic <fhuskovic92@gmail.com>
Signed-off-by: fuskovic <fhuskovic92@gmail.com>
@fuskovic fuskovic self-assigned this Apr 20, 2026
@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 20, 2026

Deploy Preview for docs-kargo-io ready!

Name Link
🔨 Latest commit 4ae10c1
🔍 Latest deploy log https://app.netlify.com/projects/docs-kargo-io/deploys/69eb92ef10aeec000846a4f2
😎 Deploy Preview https://deploy-preview-6128.docs.kargo.io
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@fuskovic fuskovic added area/external-providers Related to external API providers kind/enhancement An entirely new feature priority/low Low commitment from maintainers; progress is likely to be community-driven labels Apr 20, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 20, 2026

Codecov Report

❌ Patch coverage is 90.63670% with 50 lines in your changes missing coverage. Please review.
✅ Project coverage is 57.91%. Comparing base (91a058b) to head (4ae10c1).

Files with missing lines Patch % Lines
pkg/gitprovider/bitbucket/cloud/provider.go 84.34% 30 Missing and 14 partials ⚠️
pkg/gitprovider/bitbucket/datacenter/provider.go 97.62% 4 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6128      +/-   ##
==========================================
+ Coverage   57.67%   57.91%   +0.23%     
==========================================
  Files         474      475       +1     
  Lines       40506    40822     +316     
==========================================
+ Hits        23362    23642     +280     
- Misses      15749    15775      +26     
- Partials     1395     1405      +10     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread Makefile Outdated
Comment thread Makefile
paths=./...

.PHONY: codegen-bitbucket-client
codegen-bitbucket-client: install-oapi-codegen
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We were already using go-swagger for generating the client for our own APIs. I'm open to using something else, such as this, but ideally we wouldn't use two different tools for the same purpose.

Did you happen to try either generating the BB client using go-swagger or, inversely, try generating our own client using oapi-codegen?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The two tools target different spec versions and are not interchangeable here.go-swagger only supports Swagger 2.0 (OAS2) specs. The Bitbucket Cloud API spec is OpenAPI 3.0 (OAS3),

Comment thread pkg/gitprovider/bitbucket/cloud/zz_bitbucket_cloud_client.gen.go
@krancour
Copy link
Copy Markdown
Member

I think there are some things to discuss here still, but I am really happy to see that generating a BB client and using that appears tenable.

@krancour krancour added this to the v1.11.0 milestone Apr 20, 2026
Signed-off-by: fuskovic <fhuskovic92@gmail.com>
Signed-off-by: fuskovic <fhuskovic92@gmail.com>
Signed-off-by: fuskovic <fhuskovic92@gmail.com>
Signed-off-by: fuskovic <fhuskovic92@gmail.com>
Signed-off-by: fuskovic <fhuskovic92@gmail.com>
@fuskovic fuskovic changed the title feat: BB merge strategies + OAPI client generation feat: BB client gen (for cloud + server) + merge strategy support Apr 24, 2026
Signed-off-by: fuskovic <fhuskovic92@gmail.com>
@fuskovic
Copy link
Copy Markdown
Member Author

@krancour so far we are able to:

  1. Remove github.com/ktrysmt/go-bitbucket
  2. Support Datacenter/Server
  3. Support alternative merge strategies for both

This obviously needs a lot of end-to-end testing.

Per our offline discussion I have sub-packages:

  • pkg/gitprovider/bitbucket/cloud
  • pkg/gitprovider/bitbucket/datacenter

Implemented each with their own individual registration predicate.

@fuskovic
Copy link
Copy Markdown
Member Author

I can take this out of draft and start end-to-end testing unless there's something else we still want to discuss?

@fuskovic fuskovic requested a review from krancour April 24, 2026 15:55
Signed-off-by: fuskovic <fhuskovic92@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/external-providers Related to external API providers kind/enhancement An entirely new feature priority/low Low commitment from maintainers; progress is likely to be community-driven

Projects

None yet

2 participants