Hi,
I am using the gitlab-plugin v.1.2.1 with Jenkins 1.646 and Gitlab 8.6.5 (CE).
I have a proper connection to gitlab and wanted to use the publisher functionality to get back the status from the job for a merge request.
If I do not add the publish post-build action, everything works fine, except that I do not get the build status in Gitlab.
If I now add the publisher post-buil action, I get an error when the build is executed:
> git rev-list 035fea1192d1533fcbf8cee8dc769c695df8ebeb # timeout=10
FATAL: null
java.lang.NullPointerException
at org.jboss.resteasy.util.ReadFromStream.readFromStream(ReadFromStream.java:30)
at org.jboss.resteasy.client.jaxrs.internal.ClientResponse.bufferEntity(ClientResponse.java:307)
at org.jboss.resteasy.client.jaxrs.internal.proxy.extractors.DefaultEntityExtractorFactory$3.extractEntity(DefaultEntityExtractorFactory.java:48)
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.$Proxy94.headCommit(Unknown Source)
at com.dabsquared.gitlabjenkins.publisher.GitLabCommitStatusPublisher.existsCommit(GitLabCommitStatusPublisher.java:93)
at com.dabsquared.gitlabjenkins.publisher.GitLabCommitStatusPublisher.updateCommitStatus(GitLabCommitStatusPublisher.java:78)
at com.dabsquared.gitlabjenkins.publisher.GitLabCommitStatusPublisher.prebuild(GitLabCommitStatusPublisher.java:48)
at hudson.model.AbstractBuild$AbstractBuildExecution.preBuild(AbstractBuild.java:837)
at hudson.model.AbstractBuild$AbstractBuildExecution.preBuild(AbstractBuild.java:832)
at hudson.model.Build$BuildExecution.doRun(Build.java:144)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
at hudson.model.Run.execute(Run.java:1738)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410)
ERROR: Build step failed with exception
java.lang.NullPointerException
at org.jboss.resteasy.util.ReadFromStream.readFromStream(ReadFromStream.java:30)
at org.jboss.resteasy.client.jaxrs.internal.ClientResponse.bufferEntity(ClientResponse.java:307)
at org.jboss.resteasy.client.jaxrs.internal.proxy.extractors.DefaultEntityExtractorFactory$3.extractEntity(DefaultEntityExtractorFactory.java:48)
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.$Proxy94.headCommit(Unknown Source)
at com.dabsquared.gitlabjenkins.publisher.GitLabCommitStatusPublisher.existsCommit(GitLabCommitStatusPublisher.java:93)
at com.dabsquared.gitlabjenkins.publisher.GitLabCommitStatusPublisher.updateCommitStatus(GitLabCommitStatusPublisher.java:78)
at com.dabsquared.gitlabjenkins.publisher.GitLabCommitStatusPublisher.perform(GitLabCommitStatusPublisher.java:62)
at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:782)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:723)
at hudson.model.Build$BuildExecution.post2(Build.java:185)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:668)
at hudson.model.Run.execute(Run.java:1763)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410)
Build step 'Publish build status to GitLab commit (GitLab 8.1+ required)' marked build as failure
Finished: FAILURE
The job does not have any build action except a simple echo "foo". But this happens even before any build-action, during git checkout. I configured my job as explained in your documentation, and the job is a freestyle job.
Can you help me ?
Thanks!
+1 Same issue.
My stacktrace:
First time build. Skipping changelog.
FATAL: null
java.lang.NullPointerException
at org.jboss.resteasy.util.ReadFromStream.readFromStream(ReadFromStream.java:30)
at org.jboss.resteasy.client.jaxrs.internal.ClientResponse.bufferEntity(ClientResponse.java:307)
at org.jboss.resteasy.client.jaxrs.internal.proxy.extractors.DefaultEntityExtractorFactory$3.extractEntity(DefaultEntityExtractorFactory.java:48)
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.$Proxy91.headCommit(Unknown Source)
at com.dabsquared.gitlabjenkins.publisher.GitLabCommitStatusPublisher.existsCommit(GitLabCommitStatusPublisher.java:93)
at com.dabsquared.gitlabjenkins.publisher.GitLabCommitStatusPublisher.updateCommitStatus(GitLabCommitStatusPublisher.java:78)
at com.dabsquared.gitlabjenkins.publisher.GitLabCommitStatusPublisher.prebuild(GitLabCommitStatusPublisher.java:48)
at hudson.model.AbstractBuild$AbstractBuildExecution.preBuild(AbstractBuild.java:837)
at hudson.model.AbstractBuild$AbstractBuildExecution.preBuild(AbstractBuild.java:832)
at hudson.model.Build$BuildExecution.doRun(Build.java:144)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
at hudson.model.Run.execute(Run.java:1738)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410)
ERROR: Build step failed with exception
java.lang.NullPointerException
at org.jboss.resteasy.util.ReadFromStream.readFromStream(ReadFromStream.java:30)
at org.jboss.resteasy.client.jaxrs.internal.ClientResponse.bufferEntity(ClientResponse.java:307)
at org.jboss.resteasy.client.jaxrs.internal.proxy.extractors.DefaultEntityExtractorFactory$3.extractEntity(DefaultEntityExtractorFactory.java:48)
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.$Proxy91.headCommit(Unknown Source)
at com.dabsquared.gitlabjenkins.publisher.GitLabCommitStatusPublisher.existsCommit(GitLabCommitStatusPublisher.java:93)
at com.dabsquared.gitlabjenkins.publisher.GitLabCommitStatusPublisher.updateCommitStatus(GitLabCommitStatusPublisher.java:78)
at com.dabsquared.gitlabjenkins.publisher.GitLabCommitStatusPublisher.perform(GitLabCommitStatusPublisher.java:62)
at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:782)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:723)
at hudson.model.Build$BuildExecution.post2(Build.java:185)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:668)
at hudson.model.Run.execute(Run.java:1763)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410)
Build step 'Publish build status to GitLab commit (GitLab 8.1+ required)' marked build as failure
Finished: FAILURE
Jenkins 2.0
GitLab 8.7.1
Funny thing: this results in a GitLab comment from Jenkins on the merge request, with a thumbs up and "Jenkins Build Failed" message... Jenkins seems confused after the update ;-)
Btw: worked fine with Jenkins 1.6 (latest) and Gitlab 8.7.0
I have another similar one, seems connections are not closed properly.
FATAL: RESTEASY004655: Unable to invoke request
javax.ws.rs.ProcessingException: RESTEASY004655: Unable to invoke request
at org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine.invoke(ApacheHttpClient4Engine.java:287)
at org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.invoke(ClientInvocation.java:436)
at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientInvoker.invoke(ClientInvoker.java:102)
at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientProxy.invoke(ClientProxy.java:64)
at com.sun.proxy.$Proxy91.headCommit(Unknown Source)
at com.dabsquared.gitlabjenkins.publisher.GitLabCommitStatusPublisher.existsCommit(GitLabCommitStatusPublisher.java:93)
at com.dabsquared.gitlabjenkins.publisher.GitLabCommitStatusPublisher.updateCommitStatus(GitLabCommitStatusPublisher.java:78)
at com.dabsquared.gitlabjenkins.publisher.GitLabCommitStatusPublisher.prebuild(GitLabCommitStatusPublisher.java:48)
at hudson.model.AbstractBuild$AbstractBuildExecution.preBuild(AbstractBuild.java:837)
at hudson.model.AbstractBuild$AbstractBuildExecution.preBuild(AbstractBuild.java:832)
at hudson.model.Build$BuildExecution.doRun(Build.java:144)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
at hudson.model.Run.execute(Run.java:1738)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410)
Caused by: java.lang.IllegalStateException: Invalid use of BasicClientConnManager: connection still allocated.
Make sure to release the connection before allocating another one.
@tnsasse I assume that resteasy doesn't close the connection properly due to these NullPointerExceptions above.
Can you add a Logger for "com.dabsquared.gitlabjenkins" to your Jenkins (see) and paste its output here. Otherwise I can't find the reason for the NullPointerExceptions.
Here is the log you requested. There are indeed a few null pointers.
May 03, 2016 2:39:50 PM INFO com.dabsquared.gitlabjenkins.webhook.GitLabWebHook getDynamic
WebHook called with url: /project/test_plugin
May 03, 2016 2:39:50 PM FINE com.dabsquared.gitlabjenkins.webhook.build.MergeRequestBuildAction
MergeRequest: {
"object_kind" : "merge_request",
"user" : {
"name" : "Matthieu <sourceUser>",
"username" : "<sourceUser>",
"avatar_url" : "http://<IP>/image.jpg"
},
"project" : {
"name" : "<repoName>",
"description" : "",
"web_url" : "http://<IP>/<destUser>/<repoName>",
"avatar_url" : null,
"git_ssh_url" : "git@<IP>:<destUser>/<repoName>.git",
"git_http_url" : "http://<IP>/<destUser>/<repoName>.git",
"namespace" : "<destUser>",
"visibility_level" : 0,
"path_with_namespace" : "<destUser>/<repoName>",
"default_branch" : "master",
"homepage" : "http://<IP>/<destUser>/<repoName>",
"url" : "git@<IP>:<destUser>/<repoName>.git",
"ssh_url" : "git@<IP>:<destUser>/<repoName>.git",
"http_url" : "http://<IP>/<destUser>/<repoName>.git"
},
"object_attributes" : {
"id" : 42,
"target_branch" : "master",
"source_branch" : "master",
"source_project_id" : 12,
"author_id" : 14,
"assignee_id" : 14,
"title" : "dummy",
"created_at" : "2016-05-03 12:39:50 UTC",
"updated_at" : "2016-05-03 12:39:50 UTC",
"milestone_id" : null,
"state" : "opened",
"merge_status" : "unchecked",
"target_project_id" : 2,
"iid" : 42,
"description" : "",
"position" : 0,
"locked_at" : null,
"updated_by_id" : null,
"merge_error" : null,
"merge_params" : { },
"merge_when_build_succeeds" : false,
"merge_user_id" : null,
"merge_commit_sha" : null,
"deleted_at" : null,
"source" : {
"name" : "<repoName>",
"description" : "",
"web_url" : "http://<IP>/<sourceUser>/<repoName>",
"avatar_url" : null,
"git_ssh_url" : "git@<IP>:<sourceUser>/<repoName>.git",
"git_http_url" : "http://<IP>/<sourceUser>/<repoName>.git",
"namespace" : "<sourceUser>",
"visibility_level" : 0,
"path_with_namespace" : "<sourceUser>/<repoName>",
"default_branch" : "master",
"homepage" : "http://<IP>/<sourceUser>/<repoName>",
"url" : "git@<IP>:<sourceUser>/<repoName>.git",
"ssh_url" : "git@<IP>:<sourceUser>/<repoName>.git",
"http_url" : "http://<IP>/<sourceUser>/<repoName>.git"
},
"target" : {
"name" : "<repoName>",
"description" : "",
"web_url" : "http://<IP>/<destUser>/<repoName>",
"avatar_url" : null,
"git_ssh_url" : "git@<IP>:<destUser>/<repoName>.git",
"git_http_url" : "http://<IP>/<destUser>/<repoName>.git",
"namespace" : "<destUser>",
"visibility_level" : 0,
"path_with_namespace" : "<destUser>/<repoName>",
"default_branch" : "master",
"homepage" : "http://<IP>/<destUser>/<repoName>",
"url" : "git@<IP>:<destUser>/<repoName>.git",
"ssh_url" : "git@<IP>:<destUser>/<repoName>.git",
"http_url" : "http://<IP>/<destUser>/<repoName>.git"
},
"last_commit" : {
"id" : "18b45b6c4013dfdehded1d5b078c1311bde1ad9b",
"message" : "dummy\n",
"timestamp" : "2016-05-03T14:39:22+02:00",
"url" : "http://<IP>/<sourceUser>/<repoName>/commit/18b45b6c4013dfdehded1d5b078c1311bde1ad9b",
"author" : {
"name" : "Matthieu <sourceUser>",
"email" : "matthieu.<sourceUser>@<name>.com"
}
},
"work_in_progress" : false,
"url" : "http://<IP>/<destUser>/<repoName>/merge_requests/42",
"action" : "open"
},
"repository" : {
"name" : "<repoName>",
"url" : "git@<IP>:<destUser>/<repoName>.git",
"description" : "",
"homepage" : "http://<IP>/<destUser>/<repoName>"
},
"assignee" : {
"name" : "Matthieu <sourceUser>",
"username" : "<sourceUser>",
"avatar_url" : "http://<IP>/image.jpg"
}
}
May 03, 2016 2:39:50 PM INFO com.dabsquared.gitlabjenkins.trigger.handler.AbstractWebHookTriggerHandler handle
test_plugin triggered for merge request.
@ooxaaxoo There should be even more log output. The NPE happens when the GitLab client sends an HTTP HEAD request to gitlab to find the correct projectId. The log line should contain this: "FINEST com.dabsquared.gitlabjenkins.gitlab.GitLabClientBuilder"
@coder-hugo I just updated the plugin to v1.2.2, and I still have the problem. Here is the finest log output I get:
May 04, 2016 11:38:49 AM INFO com.dabsquared.gitlabjenkins.webhook.GitLabWebHook getDynamic
WebHook called with url: /project/test_plugin
May 04, 2016 11:38:49 AM FINE com.dabsquared.gitlabjenkins.webhook.build.MergeRequestBuildAction
MergeRequest: {
"object_kind" : "merge_request",
"user" : {
"name" : "Matthieu <srcUser>",
"username" : "<srcUser>",
"avatar_url" : "http://<IP>/image.jpg"
},
"project" : {
"name" : "<repoName>",
"description" : "",
"web_url" : "http://<IP>/<destUser>/<repoName>",
"avatar_url" : null,
"git_ssh_url" : "git@<IP>:<destUser>/<repoName>.git",
"git_http_url" : "http://<IP>/<destUser>/<repoName>.git",
"namespace" : "<destUser>",
"visibility_level" : 0,
"path_with_namespace" : "<destUser>/<repoName>",
"default_branch" : "master",
"homepage" : "http://<IP>/<destUser>/<repoName>",
"url" : "git@<IP>:<destUser>/<repoName>.git",
"ssh_url" : "git@<IP>:<destUser>/<repoName>.git",
"http_url" : "http://<IP>/<destUser>/<repoName>.git"
},
"object_attributes" : {
"id" : 42,
"target_branch" : "master",
"source_branch" : "master",
"source_project_id" : 12,
"author_id" : 14,
"assignee_id" : 14,
"title" : "dummy",
"created_at" : "2016-05-03 12:39:50 UTC",
"updated_at" : "2016-05-04 09:38:49 UTC",
"milestone_id" : null,
"state" : "opened",
"merge_status" : "unchecked",
"target_project_id" : 2,
"iid" : 42,
"description" : "",
"position" : 0,
"locked_at" : null,
"updated_by_id" : null,
"merge_error" : null,
"merge_params" : { },
"merge_when_build_succeeds" : false,
"merge_user_id" : null,
"merge_commit_sha" : null,
"deleted_at" : null,
"source" : {
"name" : "<repoName>",
"description" : "",
"web_url" : "http://<IP>/<srcUser>/<repoName>",
"avatar_url" : null,
"git_ssh_url" : "git@<IP>:<srcUser>/<repoName>.git",
"git_http_url" : "http://<IP>/<srcUser>/<repoName>.git",
"namespace" : "<srcUser>",
"visibility_level" : 0,
"path_with_namespace" : "<srcUser>/<repoName>",
"default_branch" : "master",
"homepage" : "http://<IP>/<srcUser>/<repoName>",
"url" : "git@<IP>:<srcUser>/<repoName>.git",
"ssh_url" : "git@<IP>:<srcUser>/<repoName>.git",
"http_url" : "http://<IP>/<srcUser>/<repoName>.git"
},
"target" : {
"name" : "<repoName>",
"description" : "",
"web_url" : "http://<IP>/<destUser>/<repoName>",
"avatar_url" : null,
"git_ssh_url" : "git@<IP>:<destUser>/<repoName>.git",
"git_http_url" : "http://<IP>/<destUser>/<repoName>.git",
"namespace" : "<destUser>",
"visibility_level" : 0,
"path_with_namespace" : "<destUser>/<repoName>",
"default_branch" : "master",
"homepage" : "http://<IP>/<destUser>/<repoName>",
"url" : "git@<IP>:<destUser>/<repoName>.git",
"ssh_url" : "git@<IP>:<destUser>/<repoName>.git",
"http_url" : "http://<IP>/<destUser>/<repoName>.git"
},
"last_commit" : {
"id" : "b641836c47ef3d3847ed615c4e6eaab639e561ac",
"message" : "dummy commit message\n",
"timestamp" : "2016-05-04T11:38:44+02:00",
"url" : "http://<IP>/<srcUser>/<repoName>/commit/b641836c47ef3d3847ed615c4e6eaab639e561ac",
"author" : {
"name" : "Matthieu <srcUser>",
"email" : "matthieu.<srcUser>@dummy.com"
}
},
"work_in_progress" : false,
"url" : "http://<IP>/<destUser>/<repoName>/merge_requests/42",
"action" : "update"
},
"repository" : {
"name" : "<repoName>",
"url" : "git@<IP>:<destUser>/<repoName>.git",
"description" : "",
"homepage" : "http://<IP>/<destUser>/<repoName>"
},
"assignee" : {
"name" : "Matthieu <srcUser>",
"username" : "<srcUser>",
"avatar_url" : "http://<IP>/image.jpg"
}
}
May 04, 2016 11:38:49 AM INFO com.dabsquared.gitlabjenkins.trigger.handler.AbstractWebHookTriggerHandler handle
test_plugin triggered for merge request.
May 04, 2016 11:38:58 AM FINEST com.dabsquared.gitlabjenkins.gitlab.GitLabClientBuilder
Call GitLab:
HTTP method: HEAD
URL: http://<IP>/api/v3/projects/<destUser>%2F<repoName>/repository/commits/0ece01f669dc2167b30db9666fbb75809452babf
Request headers: [
Accept = [application/json],
PRIVATE-TOKEN = [****FILTERED****]
]
May 04, 2016 11:38:58 AM FINEST com.dabsquared.gitlabjenkins.gitlab.GitLabClientBuilder
Got response from GitLab:
URL: http://<IP>/api/v3/projects/<destUser>%2F<repoName>/repository/commits/0ece01f669dc2167b30db9666fbb75809452babf
Status: 404 Not Found
Response headers: [
Cache-Control = [no-cache],
Connection = [keep-alive],
Content-Length = [34],
Content-Type = [application/json],
Date = [Wed, 04 May 2016 09:38:58 GMT],
Server = [nginx],
Status = [404 Not Found],
Vary = [Origin],
X-Request-Id = [08482e6c-4d8f-425b-9b9a-3639906f92c5],
X-Runtime = [0.042452]
]
Response body:
May 04, 2016 11:38:58 AM FINEST com.dabsquared.gitlabjenkins.gitlab.GitLabClientBuilder
Call GitLab:
HTTP method: HEAD
URL: http://<IP>/api/v3/projects/<destUser>%2F<repoName>/repository/commits/0ece01f669dc2167b30db9666fbb75809452babf
Request headers: [
Accept = [application/json],
PRIVATE-TOKEN = [****FILTERED****]
]
May 04, 2016 11:38:58 AM FINEST com.dabsquared.gitlabjenkins.gitlab.GitLabClientBuilder
Got response from GitLab:
URL: http://<IP>/api/v3/projects/<destUser>%2F<repoName>/repository/commits/0ece01f669dc2167b30db9666fbb75809452babf
Status: 404 Not Found
Response headers: [
Cache-Control = [no-cache],
Connection = [keep-alive],
Content-Length = [34],
Content-Type = [application/json],
Date = [Wed, 04 May 2016 09:38:58 GMT],
Server = [nginx],
Status = [404 Not Found],
Vary = [Origin],
X-Request-Id = [90ef397c-1ae9-4756-98fd-07a83484f636],
X-Runtime = [0.034808]
]
Response body:
May 04, 2016 11:38:58 AM FINEST com.dabsquared.gitlabjenkins.gitlab.GitLabClientBuilder
Call GitLab:
HTTP method: POST
URL: http://<IP>/api/v3/projects/2/merge_requests/42/notes?body=%3A-1%3A+Jenkins+Build+Failed%0A%0AResults+available+at%3A+%5BJenkins+%5Btest_plugin+%239%5D%5D%28http%3A%2F%2F<IP>%3A8080%2Fjob%2Ftest_plugin%2F9%2F%29
Request headers: [
Accept = [application/json],
PRIVATE-TOKEN = [****FILTERED****]
]
May 04, 2016 11:38:58 AM FINEST com.dabsquared.gitlabjenkins.gitlab.GitLabClientBuilder
Got response from GitLab:
URL: http://<IP>/api/v3/projects/2/merge_requests/42/notes?body=%3A-1%3A+Jenkins+Build+Failed%0A%0AResults+available+at%3A+%5BJenkins+%5Btest_plugin+%239%5D%5D%28http%3A%2F%2F<IP>%3A8080%2Fjob%2Ftest_plugin%2F9%2F%29
Status: 201 Created
Response headers: [
Cache-Control = [max-age=0, private, must-revalidate],
Connection = [keep-alive],
Content-Length = [490],
Content-Type = [application/json],
Date = [Wed, 04 May 2016 09:38:58 GMT],
Etag = [W/"f3b9875c3f22d5828e836c8aafc6308b"],
Server = [nginx],
Status = [201 Created],
Vary = [Origin],
X-Request-Id = [3bb91e31-2e5a-4ed0-a2c9-5c2626704dd3],
X-Runtime = [0.132976]
]
Response body: {
"id" : 2360,
"body" : ":-1: Jenkins Build Failed\n\nResults available at: [Jenkins [test_plugin #9]](http://<IP>:<port>/job/test_plugin/9/)",
"attachment" : null,
"author" : {
"name" : "Build Bot",
"username" : "buildbot",
"id" : 15,
"state" : "active",
"avatar_url" : "http://<IP>/image1.png",
"web_url" : "http://<IP>/u/buildbot"
},
"created_at" : "2016-05-04T09:38:58.386Z",
"system" : false,
"noteable_id" : 42,
"noteable_type" : "MergeRequest",
"upvote" : false,
"downvote" : false
}
Here is the log output of the job
FATAL: null
java.lang.NullPointerException
at org.jboss.resteasy.util.ReadFromStream.readFromStream(ReadFromStream.java:30)
at org.jboss.resteasy.client.jaxrs.internal.ClientResponse.bufferEntity(ClientResponse.java:307)
at org.jboss.resteasy.client.jaxrs.internal.proxy.extractors.DefaultEntityExtractorFactory$3.extractEntity(DefaultEntityExtractorFactory.java:48)
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.$Proxy95.headCommit(Unknown Source)
at com.dabsquared.gitlabjenkins.util.CommitStatusUpdater.existsCommit(CommitStatusUpdater.java:72)
at com.dabsquared.gitlabjenkins.util.CommitStatusUpdater.updateCommitStatus(CommitStatusUpdater.java:37)
at com.dabsquared.gitlabjenkins.publisher.GitLabCommitStatusPublisher.prebuild(GitLabCommitStatusPublisher.java:33)
at hudson.model.AbstractBuild$AbstractBuildExecution.preBuild(AbstractBuild.java:837)
at hudson.model.AbstractBuild$AbstractBuildExecution.preBuild(AbstractBuild.java:832)
at hudson.model.Build$BuildExecution.doRun(Build.java:144)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
at hudson.model.Run.execute(Run.java:1738)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410)
ERROR: Build step failed with exception
java.lang.NullPointerException
at org.jboss.resteasy.util.ReadFromStream.readFromStream(ReadFromStream.java:30)
at org.jboss.resteasy.client.jaxrs.internal.ClientResponse.bufferEntity(ClientResponse.java:307)
at org.jboss.resteasy.client.jaxrs.internal.proxy.extractors.DefaultEntityExtractorFactory$3.extractEntity(DefaultEntityExtractorFactory.java:48)
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.$Proxy95.headCommit(Unknown Source)
at com.dabsquared.gitlabjenkins.util.CommitStatusUpdater.existsCommit(CommitStatusUpdater.java:72)
at com.dabsquared.gitlabjenkins.util.CommitStatusUpdater.updateCommitStatus(CommitStatusUpdater.java:37)
at com.dabsquared.gitlabjenkins.publisher.GitLabCommitStatusPublisher.perform(GitLabCommitStatusPublisher.java:45)
at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:782)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:723)
at hudson.model.Build$BuildExecution.post2(Build.java:185)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:668)
at hudson.model.Run.execute(Run.java:1763)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410)
Build step 'Publish build status to GitLab commit (GitLab 8.1+ required)' marked build as failure
Finished: FAILURE
Now the difference compared to before is that jenkins posts the right comment in the merge request on gitlab (Failed or Aborted) with the right thumb down. But the job still fails and the status of the merge request is still "Skipped" ...
I hope these new logs help :)
@ooxaaxoo can you provide some details about your job configuration. Additionally you could check if the commit 0ece01f669dc2167b30db9666fbb75809452babf exists in the target repository and if it's the one that should be built.
@coder-hugo
Hi :) The job configuration is really simple. It is a freestyle project, git is configured as described here: https://github.com/jenkinsci/gitlab-plugin#git-configuration-for-freestyle-jobs (forked repository setup)
Additionally, I just have a echo "foo" as build action, and the "publish build status" as post-build action.
For the hash, you are right, the commit hash does not exist in the target repository. It is probably the problem then. When I compare with the same job that does not have the publisher enabled,
after git merge, I get something like that:
(...)
Checking out Revision <hash1> (origin/master)
> git config core.sparsecheckout # timeout=10
> git checkout -f <hash1>
> git rev-list <hash2> # timeout=10
> git rev-list <hash2> # timeout=10
(...)
where hash1 exists in the target repo, but hash2 not. Everything is fine and the job continues.
BUT For the job that has the publisher activated, hash1 and hash2 both don't exist in the target repo and then I get the nullptr exception after the first git rev-list.
@coder-hugo Hey maybe it can help you but I am actually not sure what is going on. I got a new message for a new merge request now, and this time did not get a nullptr
Failed to update Gitlab commit status for project '<project>': HTTP 403 Forbidden
So there I don't get the nullptr anymore, but the status is still not updating. The fact that now I get this 403 is kind of weird, since the comment on the merge request has the correct status. Can it be because I am using the Community Edition and not the Enterprise Edition ? or is it just that the jenkins user must have admin rights ?
In parallel I keep getting a nullptr exception in most of the cases, and I noticed that the difference between the nulltpr cases and the cases where I just get this 403 error is in the Git Build Data (From the git plugin) Just below the Revision, I either get source and destination branches (403 error case) or only source branche (nullpointer exception). I have no idea why I get only 1 in the majority of the jobs. Can it come from the git configuration ?
@ooxaaxoo The NPEs occur because of another bug in resteasy (RESTEASY-1347). The 403 should be raised because your jenkins "tool-user" has insufficient privileges for updating the commit status. The user should have at least the role Developer for the projects for which the commit status shall be updated.
@coder-hugo Great! Thanks a lot for your help, the 403 is indeed just a matter of right. And for the Resteasy bug its good to know, I'll wait for the fix :)
Fix was released in version 1.2.2 of the plugin, out now.
@omehegan Not as I know of, @coder-hugo fix (85f415) should be out in the next release (1.2.3)
@omehegan Will we get an new release for 85f415fe1f65282d9f0101e01fd414acb2a22bdc which is the RESTEASY-1347 workaround as mentioned by @coder-hugo ?
Most helpful comment
@omehegan Will we get an new release for 85f415fe1f65282d9f0101e01fd414acb2a22bdc which is the RESTEASY-1347 workaround as mentioned by @coder-hugo ?