Gitlab-plugin: addGitLabMRComment fails on GitLab 9.2.5

Created on 13 Jul 2017  路  5Comments  路  Source: jenkinsci/gitlab-plugin

Issue

Context

  • Gitlab plugin version: 1.4.5
  • Gitlab version: 9.2.5
  • Jenkins version: 2.46.3
  • Job type: Pipeline

Logs & Traces

Jenkins log

Jul 13, 2017 10:21:14 AM SEVERE com.dabsquared.gitlabjenkins.workflow.AddGitLabMergeRequestCommentStep$Execution run
Failed to add comment on Merge Request for project '152'
javax.ws.rs.NotFoundException: HTTP 404 Not Found
    at org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.handleErrorStatus(ClientInvocation.java:201)
    at org.jboss.resteasy.client.jaxrs.internal.proxy.extractors.DefaultEntityExtractorFactory$3.extractEntity(DefaultEntityExtractorFactory.java:50)
    at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientInvoker.invoke(ClientInvoker.java:104)
    at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientProxy.invoke(ClientProxy.java:64)
    at com.sun.proxy.$Proxy187.createMergeRequestNote(Unknown Source)
    at com.dabsquared.gitlabjenkins.workflow.AddGitLabMergeRequestCommentStep$Execution.run(AddGitLabMergeRequestCommentStep.java:71)
    at com.dabsquared.gitlabjenkins.workflow.AddGitLabMergeRequestCommentStep$Execution.run(AddGitLabMergeRequestCommentStep.java:50)
    at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousStepExecution.start(AbstractSynchronousStepExecution.java:42)
    at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:224)
    at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:150)
    at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:108)
    at sun.reflect.GeneratedMethodAccessor803.invoke(Unknown Source)

Problem description

Once you try to send addGitLabMRComment gitlab plugin fails with Failed to add comment on Merge Request for project '...': HTTP 404 Not Found

Seems like starting from GitLab 9.0 we should use MR's iid instead of id

Most helpful comment

Switching API-Level from autodetect to V3 solves it all.

All 5 comments

@r00ger I don't think that's the issue, because the plugin is still using API v3 right now (others are working on a patch to add v4 support). Can you enable the additional logging as described in the User Support section of the README, so I can see what URL the plugin is trying to hit?

any news

@tchernogod It seems that I have problems only in certain scenarios (in others it works). Closing since I can't give you a repro. Will reopen If I confirm that the problem is not on my side

I believe I have the same issue. This is the output I get in the logs:

Nov 23, 2017 2:23:03 PM FINEST com.dabsquared.gitlabjenkins.gitlab.api.impl.ResteasyGitLabClientBuilder
Call GitLab:
HTTP method: POST
URL: http://git.smarteye.se/api/v4/projects/300/merge_requests/33/notes
Request headers: [
Accept = [application/json],
Content-Type = [application/x-www-form-urlencoded],
PRIVATE-TOKEN = [****FILTERED****]
]

Nov 23, 2017 2:23:03 PM FINEST com.dabsquared.gitlabjenkins.gitlab.api.impl.ResteasyGitLabClientBuilder
Got response from GitLab:
URL: http://git.smarteye.se/api/v4/projects/300/merge_requests/33/notes
Status: 404 Not Found
Response headers: [
Cache-Control = [no-cache],
Connection = [keep-alive],
Content-Length = [27],
Content-Type = [application/json],
Date = [Thu, 23 Nov 2017 13:23:03 GMT],
Server = [nginx],
Vary = [Origin],
X-Request-Id = [99ec541e-0c34-4958-93f1-518eac45f5da],
X-Runtime = [0.067162]
]
Response body: {
  "message" : "404 Not found"
}

This is what I get in the pipeline log:

Failed to add comment on Merge Request for project '300': HTTP 404 Not Found

Some relevant info:

  • Gitlab plugin version: 1.5.1
  • Gitlab version: CE 9.0.1
  • Jenkins version: 2.77
  • Job type: Pipeline
  • API-level: autodetect

Switching API-Level from autodetect to V3 solves it all.

Was this page helpful?
0 / 5 - 0 ratings