Stop importing issues from Bitbucket Cloud

What does this MR do and why?

Atlassian shut down the Bitbucket Cloud Issues API on 2026-08-20, so the importer has nothing left to import issues from. This MR stops it from trying.

  • Pull request notes now hand off to the LFS objects stage. The chain is repository, users, pull_requests, pull_requests_notes, lfs_objects, finish.
  • The four issue importers (IssuesImporter, IssueImporter, IssuesNotesImporter, IssueNotesImporter) and their specs are deleted.
  • Stage::ImportRepositoryWorker no longer pre-allocates issue IIDs. Merge request IIDs are still pre-allocated.
  • RepositoryImporter no longer creates the bug, enhancement, proposal and task labels. Only imported issues used them.
  • RefConverter leaves Bitbucket issue links alone. Other links in the same note are still converted.

Local testing

I ran real imports against Bitbucket Cloud on my GDK, and they finished without import failures. The Bitbucket importer specs pass too.

Details

I used POST /import/bitbucket with a read-only API token (read:repository, read:pullrequest). The gem cleanup branch, which is a separate MR, was checked out on top of this one.

  1. a-test-workspace-1/gkoltsov-repo-1 has no pull requests. The repository was imported, with no issues, no default issue labels and no import failures.
  2. a-test-workspace-2/sometestrepo has one open pull request with four comments. The import created merge request !1 with all four notes. Markdown and image markup came through unchanged. A comment that links to src/main/README.md became a link to the blob in the imported project, and the {: data-inline-card='' } markup was dropped.

log/importer.log shows the stages running in the order above, with no issue stages and nothing about issues.

To check an import that was in flight during a deploy, I put a finished project back in started. Then I enqueued two jobs for the no-op per-issue workers with a real JobWaiter key, plus an AdvanceStageWorker job for :issues that waited on them. Both workers finished in about 0.02 seconds. The import then went issues, lfs_objects, finish in roughly five seconds, with no errors and without waiting for the advance stage timeout.

I couldn't test issue links on real data, because Bitbucket now answers 410 Gone for the Issues API. I also didn't test diff comments or LFS objects, since neither repository has any.

Notes for reviewers

I kept the four issue workers. An import that is in flight during the deploy can already have :issues or :issues_notes queued, and per-issue jobs can sit in Sidekiq. Removing worker classes takes three releases, so for now:

  • Stage::ImportIssuesWorker and Stage::ImportIssuesNotesWorker only enqueue AdvanceStageWorker for :lfs_objects, with no waiter. Their STAGES entries stay.
  • ImportIssueWorker and ImportIssueNotesWorker only notify the JobWaiter. Without that, an in-flight import would wait out the 2-hour advance stage timeout and then fail.
  • The migration that removes queued jobs and the final class deletion are tracked in #634446 (closed) and #634447.

Other things worth knowing:

  • RefConverter now converts each Bitbucket link on its own and skips only issue links. A converted issue link would point at /-/issues/N in a project with no imported issues, or at an unrelated issue with the same number. The path conversions apply to the link path instead of the whole note, so a project path like my-src-project is no longer rewritten.
  • The Bitbucket::Client issue methods and Representation::Issue in gems/gitlab-bitbucket stay for now. They go in a separate MR after this one merges, because this MR is what stops calling them. The documentation changes are separate too.
  • .labkit_logging_todo.yml gets two entries for Stage::ImportRepositoryWorker. The offenses are in the existing log_iid_fetch_error warning. The LabKit check flagged them because this MR edits the file. Fixing them properly means renaming log fields for every Bitbucket stage worker.
  • The two no-op workers use data_consistency :delayed instead of :always. They don't read the database, and the SidekiqLoadBalancing/WorkerDataConsistency cop rejects :always.

References

Screenshots or screen recordings

No UI changes.

How to set up and validate locally

  1. Run the importer specs:

    bin/rspec spec/lib/gitlab/bitbucket_import spec/workers/gitlab/bitbucket_import spec/workers/every_sidekiq_worker_spec.rb
  2. To check that an in-flight import still finishes, start a Bitbucket Cloud import in a GDK with Sidekiq running. Then run this in the Rails console for the importing project:

    Gitlab::BitbucketImport::AdvanceStageWorker.perform_async(project.id, {}, :issues)

    The import moves to the LFS objects stage and then finishes.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Thiago Figueiró

Merge request reports

Loading
Loading