Extract Bitbucket client into gitlab-bitbucket gem

What does this MR do?

Extracts the Bitbucket:: namespace (lib/bitbucket, the Bitbucket Cloud REST API client) and the OmniAuth Bitbucket strategy into a new standalone gem at gems/gitlab-bitbucket. Constant names are unchanged; only the file location moves, so the Gitlab::BitbucketImport importer keeps referencing Bitbucket::Client etc. as before. No EE overrides (EE only extends the importer, a consumer).

All Rails/monolith couplings are removed so the gem is Rails-free:

  • a required injected http_client: keyword argument on Bitbucket::Client (mirroring refresh_strategy:). The monolith passes Import::Clients::HTTP, which already applies the response parser (Gitlab::HttpResponseParser), the SSRF settings and the default response-size limit. The gem no longer references Gitlab::HTTP_V2 nor depends on gitlab-http.
  • an injected logger: defaulting to a null logger (fixes a would-be NoMethodError on the controller retry path)
  • injected OAuth credentials (app_id: / app_secret: / oauth_options:)

The importer injects these at the client-construction sites and keeps DI config out of the persisted import_data.credentials.

Repository visibility mapping stays in the monolith: the gem exposes a Rails-free Bitbucket::Representation::Repo#private? predicate, and Gitlab::BitbucketImport::ProjectCreator maps it to Gitlab::VisibilityLevel::PRIVATE / PUBLIC — the gem carries no GitLab visibility constants.

Gem

  • gems/gitlab-bitbucket — runtime deps: activesupport, httparty, oauth2, omniauth-oauth2, rack
  • Defines Bitbucket::VERSION; the gemspec loads only the dependency-free version.rb
  • Wired into the root Gemfile with require: 'bitbucket'
  • Gem specs: 205 examples, 0 failures (Rails-free), incl. an OmniAuth strategy smoke test
  • httparty is the only remaining HTTP coupling (the gem rescues HTTParty::ResponseError for retry classification). Follow-up to remove it now that the client is injected: #604233

Relationship to BitbucketServer

Independent — the two namespaces share zero code and diverge in pagination/auth. Extracted as a separate gem (see the sibling MR for gitlab-bitbucket-server).

Implements #603745 (closed)

🤖 Generated with Claude Code

Edited by Fabio Pitino

Merge request reports

Loading
Loading