Gitlab-plugin: Silently failing on "301 Moved Permanently" returned from GitLab on status update

Created on 9 Nov 2017  路  3Comments  路  Source: jenkinsci/gitlab-plugin

Issue

Context

  • Gitlab plugin version: 1.5.1
  • Gitlab version: 9.4.4
  • Jenkins version: 2.60
  • Job type: Freestyle

Logs & Traces

Request:

Call GitLab:
HTTP method: POST
URL: http://gitlab.example.com/api/v4/projects/1/merge_requests/2/notes

Response:

Got response from GitLab:
URL: http://gitlab.example.com/api/v4/projects/1/merge_requests/2/notes
Status: 301 Moved Permanently
Response headers: [
(...)
Location = [http://gitlab2.example.com/api/v4/projects/1/merge_requests/2/notes],
]

Problem description

The GitLab plugin doesn't follow 301 Moved Permanently responses from the server. Usually defining the new URL is enough, but there is no error (warning) in the console (that commit status update failed and why) and only browsing logs gives a clue.

The GitLab plugin should print at least a warning on non 20x responses.

bug

Most helpful comment

I was having a similar problem with http -> https redirects.

Thanks to your issue I was able to fix it, but I wasted a lot of time trying to track it down because the console output wouldn't say anything about it.

Thanks. I hope this gets fixed, or at least a warning gets printed in the console.

All 3 comments

I was having a similar problem with http -> https redirects.

Thanks to your issue I was able to fix it, but I wasted a lot of time trying to track it down because the console output wouldn't say anything about it.

Thanks. I hope this gets fixed, or at least a warning gets printed in the console.

Upon further investigation, I found that this redirect issue was resolved in a Resteasy's pull request resteasy/Resteasy#1305 and merged into their master on Nov 6, 2017. But I couldn't find a "Final" tagged release with this feature. To my (limited) knowledge the problem could be simply addressed by using the latest version of Resteasy and calling the httpClient.setFollowRedirects(true) in the ResteasyGitlabClientBuilder.RestEasyClientBuilder.initDefaultEngine. I could, of course, be 100% wrong on this as I have little to no experience with Maven/Java development.

I hope that my investigation can be of use to enable a solution to this problem.

@omehegan
hi, is this patch released?
I still found the same issues in version 1.5.13

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Kiran-B picture Kiran-B  路  6Comments

omehegan picture omehegan  路  3Comments

nussera picture nussera  路  5Comments

SunBlack picture SunBlack  路  6Comments

ffrddrll picture ffrddrll  路  6Comments