Provide a useful error when failing to perform post-commit with GitLab.

Review Request #11053 — Created June 23, 2020 and submitted — Latest diff uploaded

Information

Review Board
release-3.0.x

Reviewers

GitLab doesn't have a suitable API for accessing diff contents, so our
only option is to access a non-API URL for fetching diff contents. While
this used to work with private repositories via a Personal Access Token,
it hasn't worked for about a year now, as they've removed that
functionality from all public URLs to address a security issue.

This does still work on older versions or for public repositories,
though, so we want to keep the capability around. To do this, we're now
explicitly checking for a HTTP 404, and if we find it, we provide a
useful blurb of text explaining the situation and linking to a KB
article for more details.

As part of this, review request creation and updating now handles
HostingServiceError responses gracefully.

Unit tests pass.

Manually tested this error condition and saw a useful error message.

Manually tested against a public repository and saw the commit go
through.

Diff Revision 2 (Latest)

orig
1
2

Commits

First Last Summary ID Author
Provide a useful error when failing to perform post-commit with GitLab.
GitLab doesn't have a suitable API for accessing diff contents, so our only option is to access a non-API URL for fetching diff contents. While this used to work with private repositories via a Personal Access Token, it hasn't worked for about a year now, as they've removed that functionality from all public URLs to address a security issue. This does still work on older versions or for public repositories, though, so we want to keep the capability around. To do this, we're now explicitly checking for a HTTP 404, and if we find it, we provide a useful blurb of text explaining the situation and linking to a KB article for more details. As part of this, review request creation and updating now handles `HostingServiceError` responses gracefully.
7cb46884bf9a573fe3a4a5e4ef00d393e90e1fd8 Christian Hammond
reviewboard/admin/support.py
reviewboard/hostingsvcs/gitlab.py
reviewboard/webapi/resources/review_request.py
reviewboard/webapi/resources/review_request_draft.py
Loading...