Skip to content

BitBucket Server Importer - pagination not functional

Summary

Recently, the repository list pagination of BitBucket Server Importer tool stopped working. GitLab UI only shows one page without displaying the [Previous] and/or [Next] buttons.

The filter field is operational and allows to search for repositories which are not on the first page.

This functionality stopped working between v13.1.2 and v13.2.0.

Steps to reproduce

  • Spin up a BitBucket (BB) server.
  • Generate 25+ repositories in that BB instance.
  • In GitLab WebUI, create new project -> import project -> BitBucket Server (import tool) -> connect to the BB instance
  • In the UI it is impossible to go to the next page of repositories.

Shell script to generate 20 BitBucket projects, each containing 2 repositories.

#!/bint/bash

bb_user=<BITBUCKET_USER>
bb_pswd=<BB_PASSWORD/ACCESS_TOKEN>
bb_host=<BB_HOSTNAME> #e.g. http://bitbucket.example.com:7990
bb_projects_count=20 #number of generated BB projects
bb_repos_count=2 #number of generated repositoris per BB project

for project in `cat /dev/urandom | tr -dc 'A-Z' | fold -w 5 | head -n $bb_projects_count`; do 
  echo -e "* creating project $project \n"
  curl -s -u $bb_user:$bb_pswd -X POST   -H "Content-Type: application/json" $bb_host/rest/api/latest/projects -d '{"key": "'$project'", "name": "my project '$project'", "description": "API generated project '$project'"}' 
  for slug in `cat /dev/urandom | tr -dc 'a-z' | fold -w 10 | head -n $bb_repos_count`; do 
    echo -e " * creating repo $slug under the project $project \n"
    curl -s -u $bb_user:$bb_pswd  -X POST -H "Content-Type: application/json" -d '{"name": "'$slug'", "scmID": "git", "forkable":false}' $bb_host/rest/api/latest/projects/$project/repos
  done
done

Example Project

Importing projects from BitBucket server into GitLab.com shows this faulty behaviour as well.

What is the current bug behavior?

No more than one page of BitBucket repositories is shown in the GitLab WebUI.

What is the expected correct behavior?

The Pagination should be working and in case there are more pages of repositories available in the source BitBucket instance.

Relevant logs and/or screenshots

This behaviour is observed in gitlab.com as well in self-managed instances (v13.2.0 as well as v13.2.1)

13.2.0.gl

13.2.0

This has to be a recently introduced bug as the pagination IS working on an SM instance v13.1.2.

13.1.2.gl

13.1.2

Output of checks

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`)

```
sudo gitlab-rake gitlab:env:info

System information
System:		Ubuntu 18.04
Proxy:		no
Current User:	git
Using RVM:	no
Ruby Version:	2.6.6p146
Gem Version:	2.7.10
Bundler Version:1.17.3
Rake Version:	12.3.3
Redis Version:	5.0.9
Git Version:	2.27.0
Sidekiq Version:5.2.9
Go Version:	unknown

GitLab information
Version:	13.2.1-ee
Revision:	447f057d946
Directory:	/opt/gitlab/embedded/service/gitlab-rails
DB Adapter:	PostgreSQL
DB Version:	11.7
URL:		http://vbrodsky-docker-host.sr.gitlab.support
HTTP Clone URL:	http://vbrodsky-docker-host.sr.gitlab.support/some-group/some-project.git
SSH Clone URL:	git@vbrodsky-docker-host.sr.gitlab.support:some-group/some-project.git
Elasticsearch:	no
Geo:		no
Using LDAP:	no
Using Omniauth:	yes
Omniauth Providers: 

GitLab Shell
Version:	13.3.0
Repository storage paths:
- default: 	/var/opt/gitlab/git-data/repositories
GitLab Shell path:		/opt/gitlab/embedded/service/gitlab-shell
Git:		/opt/gitlab/embedded/bin/git
```
(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)

 sudo gitlab-rake gitlab:check SANITIZE=true
Checking GitLab subtasks ...

Checking GitLab Shell ...

GitLab Shell: ... GitLab Shell version >= 13.3.0 ? ... OK (13.3.0)
Running /opt/gitlab/embedded/service/gitlab-shell/bin/check
Internal API available: OK
Redis available via internal API: OK
gitlab-shell self-check successful

Checking GitLab Shell ... Finished

Checking Gitaly ...

Gitaly: ... default ... OK

Checking Gitaly ... Finished

Checking Sidekiq ...

Sidekiq: ... Running? ... yes
Number of Sidekiq processes ... 1

Checking Sidekiq ... Finished

Checking Incoming Email ...

Incoming Email: ... Reply by email is disabled in config/gitlab.yml

Checking Incoming Email ... Finished

Checking LDAP ...

LDAP: ... LDAP is disabled in config/gitlab.yml

Checking LDAP ... Finished

Checking GitLab App ...

Git configured correctly? ... yes
Database config exists? ... yes
All migrations up? ... yes
Database contains orphaned GroupMembers? ... no
GitLab config exists? ... yes
GitLab config up to date? ... yes
Log directory writable? ... yes
Tmp directory writable? ... yes
Uploads directory exists? ... yes
Uploads directory has correct permissions? ... yes
Uploads directory tmp has correct permissions? ... skipped (no tmp uploads folder yet)
Init script exists? ... skipped (omnibus-gitlab has no init script)
Init script up-to-date? ... skipped (omnibus-gitlab has no init script)
Projects have namespace: ... 
2/1 ... yes
Redis version >= 4.0.0? ... yes
Ruby version >= 2.5.3 ? ... yes (2.6.6)
Git version >= 2.22.0 ? ... yes (2.27.0)
Git user has default SSH configuration? ... yes
Active users: ... 1
Is authorized keys file accessible? ... yes
GitLab configured to store new projects in hashed storage? ... yes
All projects are in hashed storage? ... yes
Elasticsearch version 6.x - 7.x? ... skipped (elasticsearch is disabled)

Checking GitLab App ... Finished


Checking GitLab subtasks ... Finished

(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)

Unfortunately, I haven't been able to identify the particular code change that started causing this.

Edited by Vladimír Brodský