Here is the log from gitlab plugin:
May 09, 2017 9:11:48 AM INFO com.dabsquared.gitlabjenkins.webhook.GitLabWebHook getDynamic
WebHook called with url: /project/test-project
May 09, 2017 9:11:48 AM FINE com.dabsquared.gitlabjenkins.webhook.build.MergeRequestBuildAction
MergeRequest: {
"object_kind" : "merge_request",
"user" : {
"name" : "Asier Marruedo",
"username" : "a.marruedo",
"avatar_url" : "http://www.gravatar.com/avatar/791387a4e77ee997193f1cef33ac19cf?s=80&d=identicon"
},
"project" : {
"name" : "test-project",
"description" : "",
"web_url" : "http://local.gitlab.com/test/test-project",
"avatar_url" : null,
"git_ssh_url" : "[email protected]:test/test-project.git",
"git_http_url" : "http://local.gitlab.com/test/test-project.git",
"namespace" : "test",
"visibility_level" : 10,
"path_with_namespace" : "test/test-project",
"default_branch" : "master",
"homepage" : "http://local.gitlab.com/test/test-project",
"url" : "[email protected]:test/test-project.git",
"ssh_url" : "[email protected]:test/test-project.git",
"http_url" : "http://local.gitlab.com/test/test-project.git"
},
"object_attributes" : {
"id" : 23,
"target_branch" : "master",
"source_branch" : "poc-gitlab",
"source_project_id" : 39,
"author_id" : 2,
"assignee_id" : null,
"title" : "a帽adir steps de gitlab",
"created_at" : "2017-05-09 09:11:45 UTC",
"updated_at" : "2017-05-09 09:11:45 UTC",
"milestone_id" : null,
"state" : "opened",
"merge_status" : "unchecked",
"target_project_id" : 38,
"iid" : 1,
"description" : "",
"position" : 0,
"locked_at" : null,
"updated_by_id" : null,
"merge_error" : null,
"merge_params" : {
"force_remove_source_branch" : "0"
},
"merge_when_pipeline_succeeds" : false,
"merge_user_id" : null,
"merge_commit_sha" : null,
"deleted_at" : null,
"approvals_before_merge" : null,
"rebase_commit_sha" : null,
"in_progress_merge_commit_sha" : null,
"lock_version" : null,
"time_estimate" : 0,
"squash" : false,
"source" : {
"name" : "test-project",
"description" : "",
"web_url" : "http://local.gitlab.com/a.marruedo/test-project",
"avatar_url" : null,
"git_ssh_url" : "[email protected]:a.marruedo/test-project.git",
"git_http_url" : "http://local.gitlab.com/a.marruedo/test-project.git",
"namespace" : "a.marruedo",
"visibility_level" : 10,
"path_with_namespace" : "a.marruedo/test-project",
"default_branch" : "master",
"homepage" : "http://local.gitlab.com/a.marruedo/test-project",
"url" : "[email protected]:a.marruedo/test-project.git",
"ssh_url" : "[email protected]:a.marruedo/test-project.git",
"http_url" : "http://local.gitlab.com/a.marruedo/test-project.git"
},
"target" : {
"name" : "test-project",
"description" : "",
"web_url" : "http://local.gitlab.com/test/test-project",
"avatar_url" : null,
"git_ssh_url" : "[email protected]:test/test-project.git",
"git_http_url" : "http://local.gitlab.com/test/test-project.git",
"namespace" : "test",
"visibility_level" : 10,
"path_with_namespace" : "test/test-project",
"default_branch" : "master",
"homepage" : "http://local.gitlab.com/test/test-project",
"url" : "[email protected]:test/test-project.git",
"ssh_url" : "[email protected]:test/test-project.git",
"http_url" : "http://local.gitlab.com/test/test-project.git"
},
"last_commit" : {
"id" : "e9373884d6157c6ffd0d8ded5931c4aba3c3fbae",
"message" : "a帽adir steps de gitlab\n",
"timestamp" : "2017-05-09T10:58:13+02:00",
"url" : "http://local.gitlab.com/test/test-project/commit/e9373884d6157c6ffd0d8ded5931c4aba3c3fbae",
"author" : {
"name" : "developer",
"email" : "[email protected]"
}
},
"work_in_progress" : false,
"url" : "http://local.gitlab.com/test/test-project/merge_requests/1",
"action" : "open"
},
"repository" : {
"name" : "test-project",
"url" : "[email protected]:test/test-project.git",
"description" : "",
"homepage" : "http://local.gitlab.com/test/test-project"
}
}
May 09, 2017 9:12:08 AM INFO com.dabsquared.gitlabjenkins.util.CommitStatusUpdater retrieveGitlabProjectIds
Retrieving gitlab project ids
May 09, 2017 9:12:08 AM INFO com.dabsquared.gitlabjenkins.util.CommitStatusUpdater retrieveGitlabProjectIds
Retrieving the gitlab project id from remote url http://local.gitlab.com/test/test-project.git
May 09, 2017 9:12:08 AM FINEST com.dabsquared.gitlabjenkins.gitlab.GitLabClientBuilder
Call GitLab:
HTTP method: GET
URL: http://local.gitlab.com/api/v3/projects/test%2Ftest-project/repository/commits/e9373884d6157c6ffd0d8ded5931c4aba3c3fbae
Request headers: [
Accept = [application/json],
PRIVATE-TOKEN = [****FILTERED****]
]
May 09, 2017 9:12:09 AM FINEST com.dabsquared.gitlabjenkins.gitlab.GitLabClientBuilder
Got response from GitLab:
URL: http://local.gitlab.com/api/v3/projects/test%2Ftest-project/repository/commits/e9373884d6157c6ffd0d8ded5931c4aba3c3fbae
Status: 200 OK
Response headers: [
Cache-Control = [max-age=0, private, must-revalidate],
Connection = [keep-alive],
Content-Length = [549],
Content-Type = [application/json],
Date = [Tue, 09 May 2017 09:12:09 GMT],
Etag = [W/"74a4d8616ce09f1122b2ff09d68e0df4"],
Server = [nginx/1.11.3],
Strict-Transport-Security = [max-age=31536000],
Vary = [Origin],
X-Request-Id = [88e3d199-85cd-494c-b390-87d79a107b5c],
X-Runtime = [0.064516]
]
Response body: {
"id" : "e9373884d6157c6ffd0d8ded5931c4aba3c3fbae",
"short_id" : "e9373884",
"title" : "a帽adir steps de gitlab",
"created_at" : "2017-05-09T10:58:13.000+02:00",
"parent_ids" : [ "2c402328d853a00c9d7e06f757820c77d10db513" ],
"message" : "a帽adir steps de gitlab\n",
"author_name" : "developer",
"author_email" : "[email protected]",
"authored_date" : "2017-05-09T10:58:13.000+02:00",
"committer_name" : "developer",
"committer_email" : "[email protected]",
"committed_date" : "2017-05-09T10:58:13.000+02:00",
"stats" : {
"additions" : 73,
"deletions" : 56,
"total" : 129
},
"status" : null
}
May 09, 2017 9:12:09 AM FINEST com.dabsquared.gitlabjenkins.gitlab.GitLabClientBuilder
Call GitLab:
HTTP method: POST
URL: http://local.gitlab.com/api/v3/projects/test%2Ftest-project/statuses/e9373884d6157c6ffd0d8ded5931c4aba3c3fbae
Request headers: [
Accept = [application/json],
Content-Type = [application/x-www-form-urlencoded],
PRIVATE-TOKEN = [****FILTERED****]
]
May 09, 2017 9:12:09 AM FINEST com.dabsquared.gitlabjenkins.gitlab.GitLabClientBuilder
Got response from GitLab:
URL: http://local.gitlab.com/api/v3/projects/test%2Ftest-project/statuses/e9373884d6157c6ffd0d8ded5931c4aba3c3fbae
Status: 404 Not Found
Response headers: [
Cache-Control = [no-cache],
Connection = [keep-alive],
Content-Length = [49],
Content-Type = [application/json],
Date = [Tue, 09 May 2017 09:12:09 GMT],
Server = [nginx/1.11.3],
Vary = [Origin],
X-Request-Id = [73a06230-72c7-486b-bbfc-ce024e206e4e],
X-Runtime = [0.072932]
]
Response body: {
"message" : "404 References for commit Not Found"
}
May 09, 2017 9:12:09 AM SEVERE com.dabsquared.gitlabjenkins.util.CommitStatusUpdater updateCommitStatus
Failed to update Gitlab commit status for project 'test/test-project'
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.$Proxy122.changeBuildStatus(Unknown Source)
at com.dabsquared.gitlabjenkins.util.CommitStatusUpdater.updateCommitStatus(CommitStatusUpdater.java:48)
at com.dabsquared.gitlabjenkins.workflow.GitLabBuildsStep$Execution$1.onStart(GitLabBuildsStep.java:72)
at org.jenkinsci.plugins.workflow.cps.CpsBodyExecution.launch(CpsBodyExecution.java:124)
at org.jenkinsci.plugins.workflow.cps.CpsBodyInvoker.launch(CpsBodyInvoker.java:170)
at org.jenkinsci.plugins.workflow.cps.DSL$ThreadTaskImpl.invokeBody(DSL.java:499)
at org.jenkinsci.plugins.workflow.cps.DSL$ThreadTaskImpl.eval(DSL.java:469)
at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:175)
at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:330)
at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$100(CpsThreadGroup.java:82)
at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:242)
at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:230)
at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:112)
at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
When the plugin tries to update the commit status it fails with "message" : "404 References for commit Not Found"
If I manually curl the gitlab API, setting in the URL state parameter, the it succeedes, and I am able to see the pipeline in the Gitlab UI.
Today I tryed the same setting BUT with a FreeStyle project. In this case everything works as expected
May 10, 2017 11:56:58 AM INFO com.dabsquared.gitlabjenkins.util.CommitStatusUpdater retrieveGitlabProjectIds
Retrieving gitlab project ids
May 10, 2017 11:56:58 AM FINEST com.dabsquared.gitlabjenkins.gitlab.GitLabClientBuilder
Call GitLab:
HTTP method: GET
URL: http://local.gitlab.com/api/v3/projects/41/repository/commits/3027218f0472a2bb441fea520cafdb5331ea8176
Request headers: [
Accept = [application/json],
PRIVATE-TOKEN = [****FILTERED****]
]
May 10, 2017 11:56:58 AM FINEST com.dabsquared.gitlabjenkins.gitlab.GitLabClientBuilder
Got response from GitLab:
URL: http://local.gitlab.com/api/v3/projects/41/repository/commits/3027218f0472a2bb441fea520cafdb5331ea8176
Status: 200 OK
Response headers: [
Cache-Control = [max-age=0, private, must-revalidate],
Connection = [keep-alive],
Content-Length = [534],
Content-Type = [application/json],
Date = [Wed, 10 May 2017 11:56:58 GMT],
Etag = [W/"74b1f6383ba00a2004dbd81620b50a6b"],
Server = [nginx/1.11.3],
Strict-Transport-Security = [max-age=31536000],
Vary = [Origin],
X-Request-Id = [6780857b-5c97-4555-a033-ae260b94b721],
X-Runtime = [0.109317]
]
Response body: {
"id" : "3027218f0472a2bb441fea520cafdb5331ea8176",
"short_id" : "3027218f",
"title" : "a帽adir cambios",
"created_at" : "2017-05-10T13:18:02.000+02:00",
"parent_ids" : [ "a0b759ceac093a2e5d97d1dfcb4090e31b35c031" ],
"message" : "a帽adir cambios\n",
"author_name" : "developer",
"author_email" : "[email protected]",
"authored_date" : "2017-05-10T13:18:02.000+02:00",
"committer_name" : "developer",
"committer_email" : "[email protected]",
"committed_date" : "2017-05-10T13:18:02.000+02:00",
"stats" : {
"additions" : 4,
"deletions" : 0,
"total" : 4
},
"status" : "pending"
}
May 10, 2017 11:56:58 AM FINEST com.dabsquared.gitlabjenkins.gitlab.GitLabClientBuilder
Call GitLab:
HTTP method: POST
URL: http://local.gitlab.com/api/v3/projects/41/statuses/3027218f0472a2bb441fea520cafdb5331ea8176
Request headers: [
Accept = [application/json],
Content-Type = [application/x-www-form-urlencoded],
PRIVATE-TOKEN = [****FILTERED****]
]
May 10, 2017 11:56:59 AM FINEST com.dabsquared.gitlabjenkins.gitlab.GitLabClientBuilder
Got response from GitLab:
URL: http://local.gitlab.com/api/v3/projects/41/statuses/3027218f0472a2bb441fea520cafdb5331ea8176
Status: 201 Created
Response headers: [
Cache-Control = [max-age=0, private, must-revalidate],
Connection = [keep-alive],
Content-Length = [554],
Content-Type = [application/json],
Date = [Wed, 10 May 2017 11:56:59 GMT],
Etag = [W/"f33edf16e561e9034d7768ac49120ca0"],
Server = [nginx/1.11.3],
Strict-Transport-Security = [max-age=31536000],
Vary = [Origin],
X-Request-Id = [c4f6b30d-37b8-40b8-abd4-66ed16b13abb],
X-Runtime = [0.068384]
]
Response body: {
"id" : 37,
"sha" : "3027218f0472a2bb441fea520cafdb5331ea8176",
"ref" : "poc-gitlab",
"status" : "running",
"name" : "jenkins",
"target_url" : "http://local.jenkins.com/job/free/2/",
"description" : null,
"created_at" : "2017-05-10T11:56:52.477Z",
"started_at" : "2017-05-10T11:56:58.993Z",
"finished_at" : null,
"allow_failure" : false,
"coverage" : null,
"author" : {
"name" : "Administrator",
"username" : "root",
"id" : 1,
"state" : "active",
"avatar_url" : "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
"web_url" : "http://local.gitlab.com/root"
}
}
May 10, 2017 11:56:59 AM INFO com.dabsquared.gitlabjenkins.util.CommitStatusUpdater retrieveGitlabProjectIds
Retrieving gitlab project ids
May 10, 2017 11:56:59 AM FINEST com.dabsquared.gitlabjenkins.gitlab.GitLabClientBuilder
Call GitLab:
HTTP method: GET
URL: http://local.gitlab.com/api/v3/projects/41/repository/commits/3027218f0472a2bb441fea520cafdb5331ea8176
Request headers: [
Accept = [application/json],
PRIVATE-TOKEN = [****FILTERED****]
]
May 10, 2017 11:56:59 AM FINEST com.dabsquared.gitlabjenkins.gitlab.GitLabClientBuilder
Got response from GitLab:
URL: http://local.gitlab.com/api/v3/projects/41/repository/commits/3027218f0472a2bb441fea520cafdb5331ea8176
Status: 200 OK
Response headers: [
Cache-Control = [max-age=0, private, must-revalidate],
Connection = [keep-alive],
Content-Length = [534],
Content-Type = [application/json],
Date = [Wed, 10 May 2017 11:56:59 GMT],
Etag = [W/"0dcc4835896b197f1576ee4d014246cc"],
Server = [nginx/1.11.3],
Strict-Transport-Security = [max-age=31536000],
Vary = [Origin],
X-Request-Id = [3884365a-f49a-479e-93a9-add058cb7775],
X-Runtime = [0.059421]
]
Response body: {
"id" : "3027218f0472a2bb441fea520cafdb5331ea8176",
"short_id" : "3027218f",
"title" : "a帽adir cambios",
"created_at" : "2017-05-10T13:18:02.000+02:00",
"parent_ids" : [ "a0b759ceac093a2e5d97d1dfcb4090e31b35c031" ],
"message" : "a帽adir cambios\n",
"author_name" : "developer",
"author_email" : "[email protected]",
"authored_date" : "2017-05-10T13:18:02.000+02:00",
"committer_name" : "developer",
"committer_email" : "[email protected]",
"committed_date" : "2017-05-10T13:18:02.000+02:00",
"stats" : {
"additions" : 4,
"deletions" : 0,
"total" : 4
},
"status" : "running"
}
May 10, 2017 11:56:59 AM FINEST com.dabsquared.gitlabjenkins.gitlab.GitLabClientBuilder
Call GitLab:
HTTP method: POST
URL: http://local.gitlab.com/api/v3/projects/41/statuses/3027218f0472a2bb441fea520cafdb5331ea8176
Request headers: [
Accept = [application/json],
Content-Type = [application/x-www-form-urlencoded],
PRIVATE-TOKEN = [****FILTERED****]
]
May 10, 2017 11:56:59 AM FINEST com.dabsquared.gitlabjenkins.gitlab.GitLabClientBuilder
Got response from GitLab:
URL: http://local.gitlab.com/api/v3/projects/41/statuses/3027218f0472a2bb441fea520cafdb5331ea8176
Status: 201 Created
Response headers: [
Cache-Control = [max-age=0, private, must-revalidate],
Connection = [keep-alive],
Content-Length = [576],
Content-Type = [application/json],
Date = [Wed, 10 May 2017 11:56:59 GMT],
Etag = [W/"7283db7555f40e45d069899b42e6c9ef"],
Server = [nginx/1.11.3],
Strict-Transport-Security = [max-age=31536000],
Vary = [Origin],
X-Request-Id = [4d50c62c-208c-489e-9404-6c3ab8fa2555],
X-Runtime = [0.063284]
]
Response body: {
"id" : 37,
"sha" : "3027218f0472a2bb441fea520cafdb5331ea8176",
"ref" : "poc-gitlab",
"status" : "success",
"name" : "jenkins",
"target_url" : "http://local.jenkins.com/job/free/2/",
"description" : null,
"created_at" : "2017-05-10T11:56:52.477Z",
"started_at" : "2017-05-10T11:56:58.993Z",
"finished_at" : "2017-05-10T11:56:59.403Z",
"allow_failure" : false,
"coverage" : null,
"author" : {
"name" : "Administrator",
"username" : "root",
"id" : 1,
"state" : "active",
"avatar_url" : "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
"web_url" : "http://local.gitlab.com/root"
}
}
I noticed that, whereas in the multibranch pipeline the plugin is using the project URL, in the freestyle job it uses the ID of the project to update commit status.
This might be due to #399. Can you see if that seems relevant to your install? I see the %2F strings in the URLs that are returning 404s.
Hi!
Sorry for the late reply. I also see those %2F strings on requests that are working fine on the same log:
May 09, 2017 9:12:08 AM INFO com.dabsquared.gitlabjenkins.util.CommitStatusUpdater retrieveGitlabProjectIds
Retrieving gitlab project ids
May 09, 2017 9:12:08 AM INFO com.dabsquared.gitlabjenkins.util.CommitStatusUpdater retrieveGitlabProjectIds
Retrieving the gitlab project id from remote url http://local.gitlab.com/test/test-project.git
May 09, 2017 9:12:08 AM FINEST com.dabsquared.gitlabjenkins.gitlab.GitLabClientBuilder
Call GitLab:
HTTP method: GET
URL: http://local.gitlab.com/api/v3/projects/test%2Ftest-project/repository/commits/e9373884d6157c6ffd0d8ded5931c4aba3c3fbae
Request headers: [
Accept = [application/json],
PRIVATE-TOKEN = [****FILTERED****]
]
May 09, 2017 9:12:09 AM FINEST com.dabsquared.gitlabjenkins.gitlab.GitLabClientBuilder
Got response from GitLab:
URL: http://local.gitlab.com/api/v3/projects/test%2Ftest-project/repository/commits/e9373884d6157c6ffd0d8ded5931c4aba3c3fbae
Status: 200 OK
Response headers: [
Cache-Control = [max-age=0, private, must-revalidate],
Connection = [keep-alive],
Content-Length = [549],
Content-Type = [application/json],
Date = [Tue, 09 May 2017 09:12:09 GMT],
Etag = [W/"74a4d8616ce09f1122b2ff09d68e0df4"],
Server = [nginx/1.11.3],
Strict-Transport-Security = [max-age=31536000],
Vary = [Origin],
X-Request-Id = [88e3d199-85cd-494c-b390-87d79a107b5c],
X-Runtime = [0.064516]
]
Response body: {
"id" : "e9373884d6157c6ffd0d8ded5931c4aba3c3fbae",
"short_id" : "e9373884",
"title" : "a帽adir steps de gitlab",
"created_at" : "2017-05-09T10:58:13.000+02:00",
"parent_ids" : [ "2c402328d853a00c9d7e06f757820c77d10db513" ],
"message" : "a帽adir steps de gitlab\n",
"author_name" : "developer",
"author_email" : "[email protected]",
"authored_date" : "2017-05-09T10:58:13.000+02:00",
"committer_name" : "developer",
"committer_email" : "[email protected]",
"committed_date" : "2017-05-09T10:58:13.000+02:00",
"stats" : {
"additions" : 73,
"deletions" : 56,
"total" : 129
},
"status" : null
}
If that %2F string was the problem I guess that all requests would have failed, but it only fails on the POST, trying to update the status of the commit.
Thanks for your help.
(we have refused to work with forks till this issue is solved, and are working with regular merges between branches on the same project. This set up works fine)
Problem here is in access rights.
Jenkins user must have access to both fork and target repository.
I'm having the same issue, and it's definitely not access rights.
Triple checked this, and the CI user that Jenkins is using is the Owner of both the source and fork repos.
Could maybe someone tell me how can I view gitlab-plugin logs and see what exactly is the request that is failing.
I tried this: https://github.com/jenkinsci/gitlab-plugin#getting-help but the logger is empty.
Most helpful comment
Problem here is in access rights.
Jenkins user must have access to both fork and target repository.