jenkins-gitlab-merge-request-builder-plugin icon indicating copy to clipboard operation
jenkins-gitlab-merge-request-builder-plugin copied to clipboard

GitLab API access error (status: 403) in 1.2.1

Open seratch opened this issue 11 years ago • 2 comments

When upgrading gitlab-merge-request-builder-plugin to 1.2.1, /api/v3/projects/all?private_token=xxx requests failed and all the merge-request driven jobs were disappeared. After that, we downgraded to 1.2.0 and everything works fine now.

  • GitLab: 6.7
  • Jenkins: 1.565
java.lang.Error: java.io.IOException: {"message":"403 Forbidden"}
  at org.gitlab.api.http.GitlabHTTPRequestor$1.fetch(GitlabHTTPRequestor.java:218)
  at org.gitlab.api.http.GitlabHTTPRequestor$1.hasNext(GitlabHTTPRequestor.java:174)
  at org.gitlab.api.http.GitlabHTTPRequestor.getAll(GitlabHTTPRequestor.java:143)
  at org.gitlab.api.GitlabAPI.getAllProjects(GitlabAPI.java:173)
  at org.jenkinsci.plugins.gitlab.GitlabRepository.getProjectForPath(GitlabRepository.java:98)
  at org.jenkinsci.plugins.gitlab.GitlabRepository.checkState(GitlabRepository.java:39)
  at org.jenkinsci.plugins.gitlab.GitlabRepository.init(GitlabRepository.java:30)
  at org.jenkinsci.plugins.gitlab.GitlabMergeRequestBuilder.build(GitlabMergeRequestBuilder.java:52)
  at org.jenkinsci.plugins.gitlab.GitlabBuildTrigger.start(GitlabBuildTrigger.java:44)
  at org.jenkinsci.plugins.gitlab.GitlabBuildTrigger.start(GitlabBuildTrigger.java:27)
  at hudson.model.AbstractProject.onLoad(AbstractProject.java:326)
  at hudson.model.Project.onLoad(Project.java:90)
  at hudson.model.Items.load(Items.java:273)
  at jenkins.model.Jenkins$18.run(Jenkins.java:2591)
  at org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run(TaskGraphBuilder.java:169)
  at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:282)
  at jenkins.model.Jenkins$7.runTask(Jenkins.java:904)
  at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:210)
  at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117)
  at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
  at java.lang.Thread.run(Thread.java:662)
Caused by: java.io.IOException: {"message":"403 Forbidden"}
  at org.gitlab.api.http.GitlabHTTPRequestor.handleAPIError(GitlabHTTPRequestor.java:320)
  at org.gitlab.api.http.GitlabHTTPRequestor.access$300(GitlabHTTPRequestor.java:39)
  at org.gitlab.api.http.GitlabHTTPRequestor$1.fetch(GitlabHTTPRequestor.java:215)
  ... 21 more
Caused by: java.io.IOException: Server returned HTTP response code: 403 for URL: [FILTERED]
  at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1459)
  at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:234)
  at org.gitlab.api.http.GitlabHTTPRequestor.parse(GitlabHTTPRequestor.java:283)
  at org.gitlab.api.http.GitlabHTTPRequestor.access$200(GitlabHTTPRequestor.java:39)
  at org.gitlab.api.http.GitlabHTTPRequestor$1.fetch(GitlabHTTPRequestor.java:211)
  ... 21 more

seratch avatar May 28 '14 07:05 seratch

I encountered the same problem, it's being addressed in #61 - in the meantime, you can work around this by elevating the user that Jenkins authenticates as in Gitlab to admin. Of course, it's a bad idea in general, but possibly an acceptable temporary solution.

jzi avatar May 28 '14 08:05 jzi

This should now be fixed in the latest version of the plugin (1.2.2)

timols avatar Jun 11 '14 16:06 timols