Skip to content

batches: add Bitbucket Cloud support

Warren Gifford requested to merge aharvey/bb-cloud-source into main

Created by: LawnGnome

This PR implements the ChangesetSource and ForkableChangesetSource interfaces for Bitbucket Cloud.

In terms of functionality, there aren't any terribly unusual quirks here. The only really interesting one is that you can't reopen PRs on Bitbucket Cloud, but you can create multiple PRs for the same (source, target) combination, so the reopen operation is implemented as a wrapper for the create operation. It works out about the same in practice; the fact that the PR ID and other metadata changes is handled by SetMetadata anyway. 🤷

In terms of the review, here are the things I'm going to call out as looking a little weird:

  1. I converted bitbucketcloud.Client into an interface so it could be mocked in the source tests. There's a little noise associated with that.
  2. Just over half the PR size is actually the generated mock. You can obviously ignore that. (Unless you don't want to, in which case… uh, thanks?)
  3. There's a TODO in the event handling code, because we don't actually handle any events yet for Bitbucket Cloud. That's coming Real Soon Now™️ with webhook support, but isn't in this PR.
  4. To support the reopen functionality described above, the executor now has to fill out the Changeset properly when invoking ReopenChangeset. That was probably a bug anyway.

Test plan

A mixture of unit test coverage (which, if I do say so myself, is excellent), and actual, real world testing of the array of publication and bulk action scenarios that we support.

Merge request reports

Loading