4626: Adding Gitlab Hosting account fails since Gitlab 10.2.0 (2017-11-22)

hboomsma
brennie
brennie

What version are you running?

3.0.1

What's the URL of the page containing the problem?

https://reviewboard.example.com/admin/db/scmtools/repository/add/

What steps will reproduce the problem?

  1. Login to reviewboard as an administrator
  2. Click your username in the upper right corner
  3. Click "Admin"
  4. Click "Add" on the repositories line on the left of the screen in the Manage block
  5. Fill in the name field
  6. Choose gitlab as Hosting service
  7. Select "<Link a new account>" for Account
  8. Put service URL on "https://gitlab.com"
  9. Fill in a username and password of a valid gitlab.com account
  10. Fill in a repository name in this gitlab account
  11. 11 Click save

What is the expected output? What do you see instead?

Have the page close and the repository be added. Now I get:

"Unknown error when linking the account: A GitLab server was not found at the provided URL.. The details of the failure are in the Review Board log file."

What operating system are you using? What browser?

Ubuntu 14.04 with Google Chrome 62

Please provide any additional information below.

Reviewboard makes use of a removed feature of Gitlab. The "/api/v4/session" endpoint is used in: https://github.com/reviewboard/reviewboard/blob/c3b5f2d2f94f72caad7f7d23646589aa8a140c1e/reviewboard/hostingsvcs/gitlab.py#L242 But it was removed in Gitlab version 10.2.0. See changelog https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG.md#1020-2017-11-22. If your gitlab instance was already connected the Hosting service will continue to operate. There also is a way around the problem by generating an access token by hand in gitlab interface (this is currently not possible through the API) and encypting it and adding the hosting account directly under "Hosting Accounts"

The code I used to encrypt my token and add it by hand is below. A screenshot with the apropiate json structure is attached. The secret can be found in your
settings.local.py file.

import sys
from reviewboard.scmtools.crypto_utils import (decrypt_password,
                                                       encrypt_password)
non_encrypt_token             = sys.argv[1]
first_16_characters_of_secret = sys.argv[2]

encrypted = encrypt_password(non_encrypt_token, first_16_characters_of_secret)

print encrypted

Since gitlab has no option to add "access tokens" using the API (at least at the time of writing), I think the best approach whould be te remove the username/password fields, and replace them with an "Access Token" field. If need more information, please feel free to contact me.

chipx86
#1 chipx86

We make use of /api/v3/session, not /api/v4/session. That URL, last we saw, should be there still. We are working on API v4 support, and have an initial change up for review at the moment that will conditionally use the API, but I want to figure out first what you're seeing exactly. Does /api/v3/session show anything on your install?

#2 hboomsma

Hi, thanx for the quick response. It looks like the /api/v3/session endpoint has also been removed. Quote from the changelog: "Remove Session API now that private tokens are removed from user API endpoints."

#3 hboomsma

On our setup we get

{"error":"404 Not Found"}
chipx86
#4 chipx86

Hrm, removing long-existing API without bumping the version number is pretty bad practice and makes things very difficult. APIs simply shouldn't do that.

We're pushing out Review Board 3.0.2 tonight, but the plan is to get the new GitLab API v4 support in for 3.0.3, which will resolve this.

chipx86
#5 chipx86
  • -New
    +Confirmed
  • +Release-2.5.x
    +Release-3.0.x
  • -Priority:Medium
    +Component:HostingServices
    +Priority:High
  • +brennie
#6 hboomsma

@chipx86 Thnx, since there is a workaround, I'll happily wait for 3.0.3

david
#7 david

Fixed in release-2.5.x (ab12a7e). This will ship in 2.5.18 and 3.0.4. Thanks!

  • -Confirmed
    +Fixed