Skip to content

Bitbucket Server import - bubble up 404 errors to importing UI

Summary

Discovered from this support ticket - ZD (internal use only)

We had a case where a user was importing a Bitbucket Server repository into GitLab.

During the import, it failed due to a error 404 on Bitbucket's end.

While this error was logged in exceptions_json.log, this was not bubbled up to the UI and the user simply sees Failed.

At the very least, GitLab should bubble up the error into the UI so users can easily take action on the error rather than be puzzled by a generic Failed message.

Steps to reproduce

In this case, one of the Bitbucket PRs had a problem with it and generated a 404 error when you tried to view it in Bitbucket Server. It isn't known how this specific problem happens though as a full investigation wasn't done.

See below for general steps:

  1. Import a Bitbucket Server repository into GitLab.
  2. Wait until GitLab encounters a 404 error from a Bitbucket Server PR (unsure how to create a PR that generates a 404)
  3. The GitLab importer UI shows a Failed message.

Untitled

  1. The exceptions_json.log showed something like the below:
Error 404: The branch '<SANITIZED>/<SANITIZED>' does not exist. The effective diff cannot be displayed until '<SANITIZED>/<SANITIZED>' is pushed and the pull request reopened.
Error importing repository https://*****:*****@<BITBUCKET_SERVER_DOMAIN>/<SANITIZED>/<SANITIZED>/<SANITIZED>.git into <SANITIZED>/<SANITIZED> - undefined local variable or method `backtrace' for #\u003cGitlab::BitbucketServerImport::Importer:0x00007f469b147ab0\u003e

A full GitLabSOS report can be found in the support ticket (internal use only)

Example Project

(If possible, please create an example project here on GitLab.com that exhibits the problematic behavior, and link to it here in the bug report)

(If you are using an older version of GitLab, this will also determine whether the bug is fixed in a more recent version)

What is the current bug behavior?

If the Bitbucket Server importer encounters a 404 error on Bitbucket's end, GitLab does not report the error in the UI.

What is the expected correct behavior?

If the Bitbucket Server importer encounters a 404 error on Bitbucket's end, GitLab should display the error in the UI.

Output of checks

(If you are reporting a bug on GitLab.com, write: This bug happens on GitLab.com)

Results of GitLab environment info

Expand for output related to GitLab environment info

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:env:info)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production)

Results of GitLab application Check

Expand for output related to the GitLab application check

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:check SANITIZE=true)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)

(we will only investigate if the tests are passing)

Possible fixes

(If you can, link to the line of code that might be responsible for the problem)

Edited by 🤖 GitLab Bot 🤖