jenkinsci / jenkinsci/gitlab-plugin

GitLab Webhook JSON object has changed!!

Open
#1,059 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1.4k
Forks
615
Avg merge
4h 32m
Merged PRs (30d)
10

Description

## Issue

### Context
- **Gitlab plugin version**: 1.5.13
- **Gitlab version**: GitLab-CE Local Server 12.10.0 (869bc26464b)
- **Jenkins version**: 2.222.3
- **Job type**: Pipeline

### Problem description

Since November the `gitlabMergeAssignee` are returning an empty string.
This happens on any hook from merge request type.
I have gne through the JSON object for the hook (on GitLab), and it appears the variables being looked for in the JSON object have now drastically changed.

I am happy to test locally, if i can get some assitence to pin point what should be returned now.

JSON object now has the following (edited to remove names and email address')

`
"assignees": [
{
"name": "removed",
"username": "removed",
"avatar_url": "http://local-fit-ip/uploads/-/system/user/avatar/2/avatar.png",
"email": "removed@email.co.uk"
}
`

### Logs & Traces

Jenkins SysLog
`WebHook called with url: /project/GC_Testpipes/ci_pipe_test

May 04, 2020 10:36:17 AM FINE com.dabsquared.gitlabjenkins.webhook.build.NoteBuildAction

Note: {
"object_kind" : "note",
"event_type" : "note",
"user" : {
"name" : "Gavin",
"username" : "GavinC",
"avatar_url" : "http://address/uploads/-/system/user/avatar/23/avatar.png",
"email" : "gavinc@email.co.uk"
},
"project_id" : 275,
"project" : {
"id" : 275,
"name" : "ci_pipe_test",
"description" : "",
"web_url" : "http://address/GavinC/ci_pipe_test",
"avatar_url" : null,
"git_ssh_url" : "git@address:GavinC/ci_pipe_test.git",
"git_http_url" : "http://address/GavinC/ci_pipe_test.git",
"namespace" : "Gavin",
"visibility_level" : 10,
"path_with_namespace" : "GavinC/ci_pipe_test",
"default_branch" : "test",
"ci_config_path" : "",
"homepage" : "http://address/GavinC/ci_pipe_test",
"url" : "git@address:GavinC/ci_pipe_test.git",
"ssh_url" : "git@address:GavinC/ci_pipe_test.git",
"http_url" : "http://address/GavinC/ci_pipe_test.git"
},
"object_attributes" : {
"attachment" : null,
"author_id" : 23,
"change_position" : null,
"commit_id" : null,
"created_at" : "2020-05-04 09:36:17 UTC",
"discussion_id" : "a8a0d754bebfde22c0558ebeea9f1680e6d49e89",
"id" : 10233,
"line_code" : null,
"note" : "Jenkins rerun",
"noteable_id" : 2990,
"noteable_type" : "MergeRequest",
"original_position" : null,
"position" : null,
"project_id" : 275,
"resolved_at" : null,
"resolved_by_id" : null,
"resolved_by_push" : null,
"st_diff" : null,
"system" : false,
"type" : null,
"updated_at" : "2020-05-04 09:36:17 UTC",
"updated_by_id" : null,
"description" : "Jenkins rerun",
"url" : "http://address/GavinC/ci_pipe_test/-/merge_requests/1#note_10233"
},
"repository" : {
"name" : "ci_pipe_test",
"url" : "git@address:GavinC/ci_pipe_test.git",
"description" : "",
"homepage" : "http://address/GavinC/ci_pipe_test"
},
"merge_request" : {
"assignee_id" : 2,
"author_id" : 23,
"created_at" : "2020-05-04 08:25:12 UTC",
"description" : "",
"head_pipeline_id" : null,
"id" : 2990,
"iid" : 1,
"last_edited_at" : null,
"last_edited_by_id" : null,
"merge_commit_sha" : null,
"merge_error" : null,
"merge_params" : {
"force_remove_source_branch" : "1"
},
"merge_status" : "cannot_be_merged",
"merge_user_id" : null,
"merge_when_pipeline_succeeds" : false,
"milestone_id" : null,
"source_branch" : "dummy",
"source_project_id" : 275,
"state_id" : 1,
"target_branch" : "test",
"target_project_id" : 275,
"time_estimate" : 0,
"title" : "Dummy",
"updated_at" : "2020-05-04 09:35:33 UTC",
"updated_by_id" : 23,
"url" : "http://address/GavinC/ci_pipe_test/-/merge_requests/1",
"source" : {
"id" : 275,
"name" : "ci_pipe_test",
"description" : "",
"web_url" : "http://address/GavinC/ci_pipe_test",
"avatar_url" : null,
"git_ssh_url" : "git@address:GavinC/ci_pipe_test.git",
"git_http_url" : "http://address/GavinC/ci_pipe_test.git",
"namespace" : "Gavin",
"visibility_level" : 10,
"path_with_namespace" : "GavinC/ci_pipe_test",
"default_branch" : "test",
"ci_config_path" : "",
"homepage" : "http://address/GavinC/ci_pipe_test",
"url" : "git@address:GavinC/ci_pipe_test.git",
"ssh_url" : "git@address:GavinC/ci_pipe_test.git",
"http_url" : "http://address/GavinC/ci_pipe_test.git"
},
"target" : {
"id" : 275,
"name" : "ci_pipe_test",
"description" : "",
"web_url" : "http://address/GavinC/ci_pipe_test",
"avatar_url" : null,
"git_ssh_url" : "git@address:GavinC/ci_pipe_test.git",
"git_http_url" : "http://address/GavinC/ci_pipe_test.git",
"namespace" : "mynamespace",
"visibility_level" : 10,
"path_with_namespace" : "GavinC/ci_pipe_test",
"default_branch" : "test",
"ci_config_path" : "",
"homepage" : "http://address/GavinC/ci_pipe_test",
"url" : "git@address:GavinC/ci_pipe_test.git",
"ssh_url" : "git@address:GavinC/ci_pipe_test.git",
"http_url" : "http://address/GavinC/ci_pipe_test.git"
},
"last_commit" : {
"id" : "25899429e39884e9dfb44997082711ea1a5f8a65",
"message" : "Initial\n",
"title" : "Initial",
"timestamp" : "2020-05-04T09:23:31+01:00",
"url" : "http://address/GavinC/ci_pipe_test/-/commit/25899429e39884e9dfb44997082711ea1a5f8a65",
"author" : {
"name" : "gavinc",
"email" : "gavinc@email.co.uk"
}
},
"work_in_progress" : false,
"total_time_spent" : 0,
"human_total_time_spent" : null,
"human_time_estimate" : null,
"assignee_ids" : [ 2 ],
"state" : "opened"
}
}

May 04, 2020 10:36:17 AM INFO com.dabsquared.gitlabjenkins.trigger.handler.AbstractWebHookTriggerHandler handle

GC_Testpipes/ci_pipe_test triggered for note.
`

GitLab Hook JSON

`
{
"object_kind": "merge_request",
"event_type": "merge_request",
"user": {
"name": "Gavin",
"username": "GavinC",
"avatar_url": "http://local-fit-ip/uploads/-/system/user/avatar/23/avatar.png",
"email": "gavinc@email.co.uk"
},
"project": {
"id": 275,
"name": "ci_pipe_test",
"description": "",
"web_url": "http://local-fit-ip/GavinC/ci_pipe_test",
"avatar_url": null,
"git_ssh_url": "git@local-fit-ip:GavinC/ci_pipe_test.git",
"git_http_url": "http://local-fit-ip/GavinC/ci_pipe_test.git",
"namespace": "Gavin",
"visibility_level": 10,
"path_with_namespace": "GavinC/ci_pipe_test",
"default_branch": "test",
"ci_config_path": "",
"homepage": "http://local-fit-ip/GavinC/ci_pipe_test",
"url": "git@local-fit-ip:GavinC/ci_pipe_test.git",
"ssh_url": "git@local-fit-ip:GavinC/ci_pipe_test.git",
"http_url": "http://local-fit-ip/GavinC/ci_pipe_test.git"
},
"object_attributes": {
"assignee_id": 2,
"author_id": 23,
"created_at": "2020-05-04 08:25:12 UTC",
"description": "",
"head_pipeline_id": null,
"id": 2990,
"iid": 1,
"last_edited_at": null,
"last_edited_by_id": null,
"merge_commit_sha": null,
"merge_error": null,
"merge_params": {
"force_remove_source_branch": "1"
},
"merge_status": "cannot_be_merged",
"merge_user_id": null,
"merge_when_pipeline_succeeds": false,
"milestone_id": null,
"source_branch": "dummy",
"source_project_id": 275,
"state_id": 1,
"target_branch": "test",
"target_project_id": 275,
"time_estimate": 0,
"title": "Dummy",
"updated_at": "2020-05-04 09:09:37 UTC",
"updated_by_id": 23,
"url": "http://local-fit-ip/GavinC/ci_pipe_test/-/merge_requests/1",
"source": {
"id": 275,
"name": "ci_pipe_test",
"description": "",
"web_url": "http://local-fit-ip/GavinC/ci_pipe_test",
"avatar_url": null,
"git_ssh_url": "git@local-fit-ip:GavinC/ci_pipe_test.git",
"git_http_url": "http://local-fit-ip/GavinC/ci_pipe_test.git",
"namespace": "Gavin",
"visibility_level": 10,
"path_with_namespace": "GavinC/ci_pipe_test",
"default_branch": "test",
"ci_config_path": "",
"homepage": "http://local-fit-ip/GavinC/ci_pipe_test",
"url": "git@local-fit-ip:GavinC/ci_pipe_test.git",
"ssh_url": "git@local-fit-ip:GavinC/ci_pipe_test.git",
"http_url": "http://local-fit-ip/GavinC/ci_pipe_test.git"
},
"target": {
"id": 275,
"name": "ci_pipe_test",
"description": "",
"web_url": "http://local-fit-ip/GavinC/ci_pipe_test",
"avatar_url": null,
"git_ssh_url": "git@local-fit-ip:GavinC/ci_pipe_test.git",
"git_http_url": "http://local-fit-ip/GavinC/ci_pipe_test.git",
"namespace": "Gavin",
"visibility_level": 10,
"path_with_namespace": "GavinC/ci_pipe_test",
"default_branch": "test",
"ci_config_path": "",
"homepage": "http://local-fit-ip/GavinC/ci_pipe_test",
"url": "git@local-fit-ip:GavinC/ci_pipe_test.git",
"ssh_url": "git@local-fit-ip:GavinC/ci_pipe_test.git",
"http_url": "http://local-fit-ip/GavinC/ci_pipe_test.git"
},
"last_commit": {
"id": "25899429e39884e9dfb44997082711ea1a5f8a65",
"message": "Initial\n",
"title": "Initial",
"timestamp": "2020-05-04T09:23:31+01:00",
"url": "http://local-fit-ip/GavinC/ci_pipe_test/-/commit/25899429e39884e9dfb44997082711ea1a5f8a65",
"author": {
"name": "gavinc",
"email": "gavinc@email.co.uk"
}
},
"work_in_progress": false,
"total_time_spent": 0,
"human_total_time_spent": null,
"human_time_estimate": null,
"assignee_ids": [
2
],
"state": "opened",
"action": "update"
},
"labels": [

],
"changes": {
"updated_at": {
"previous": "2020-05-04 09:06:24 UTC",
"current": "2020-05-04 09:09:37 UTC"
},
"updated_by_id": {
"previous": null,
"current": 23
},
"assignees": {
"current": [
{
"name": "removed",
"username": "removed",
"avatar_url": "http://local-fit-ip/uploads/-/system/user/avatar/2/avatar.png",
"email": "removed@email.co.uk"
}
]
}
},
"repository": {
"name": "ci_pipe_test",
"url": "git@local-fit-ip:GavinC/ci_pipe_test.git",
"description": "",
"homepage": "http://local-fit-ip/GavinC/ci_pipe_test"
},
"assignees": [
{
"name": "removed",
"username": "removed",
"avatar_url": "http://local-fit-ip/uploads/-/system/user/avatar/2/avatar.png",
"email": "removed@email.co.uk"
}
]
}
`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.