api¶
hook¶
基本:
post http://<host>:<port>/hook
Request headers:
Content-Type: application/json
X-Gitlab-Event: Push Hook
X-Gitlab-Token: DvNWngbe7SBujanLqd2KtTs3d6hYDOBu
Request body:
{
"object_kind": "push",
"event_name": "push",
"before": "a0e89d2de2b85134cef69fe6aa84b952d053051c",
"after": "426463f21a30e9c5cb2da2aff0987a13213e090c",
"ref": "refs/heads/master",
"checkout_sha": "426463f21a30e9c5cb2da2aff0987a13213e090c",
"message": null,
"user_id": 5,
"user_name": "zhaoweiguo",
"user_username": "zhaoweiguo",
"user_email": "",
"user_avatar": "https://www.gravatar.com/avatar/a11d9508187d0744109511002c5dfd26?s=80\u0026d=identicon",
"project_id": 117,
"project": {
"id": 117,
"name": "test-drone",
"description": "",
"web_url": "http://gitlab.com/zhaoweiguo/test-drone",
"avatar_url": null,
"git_ssh_url": "git@gitlab.com:zhaoweiguo/test-drone.git",
"git_http_url": "http://gitlab.com/zhaoweiguo/test-drone.git",
"namespace": "zhaoweiguo",
"visibility_level": 0,
"path_with_namespace": "zhaoweiguo/test-drone",
"default_branch": "master",
"ci_config_path": null,
"homepage": "http://gitlab.com/zhaoweiguo/test-drone",
"url": "git@gitlab.com:zhaoweiguo/test-drone.git",
"ssh_url": "git@gitlab.com:zhaoweiguo/test-drone.git",
"http_url": "http://gitlab.com/zhaoweiguo/test-drone.git"
},
"commits": [{
"id": "426463f21a30e9c5cb2da2aff0987a13213e090c",
"message": "update\n",
"timestamp": "2019-11-21T09:54:56Z",
"url": "http://gitlab.com/zhaoweiguo/test-drone/commit/426463f21a30e9c5cb2da2aff0987a13213e090c",
"author": {
"name": "赵 卫国",
"email": "programfan.info@gmail.com"
},
"added": [],
"modified": [".drone.yml"],
"removed": []
}, {
"id": "b64c5011760f62e7b0f91ac3c3b6601ba71855ff",
"message": "update\n",
"timestamp": "2019-11-21T08:52:29Z",
"url": "http://gitlab.com/zhaoweiguo/test-drone/commit/b64c5011760f62e7b0f91ac3c3b6601ba71855ff",
"author": {
"name": "赵 卫国",
"email": "programfan.info@gmail.com"
},
"added": [],
"modified": [".drone.yml"],
"removed": []
}, {
"id": "a0e89d2de2b85134cef69fe6aa84b952d053051c",
"message": "update\n",
"timestamp": "2019-11-21T08:48:48Z",
"url": "http://gitlab.com/zhaoweiguo/test-drone/commit/a0e89d2de2b85134cef69fe6aa84b952d053051c",
"author": {
"name": "赵 卫国",
"email": "programfan.info@gmail.com"
},
"added": [],
"modified": [".drone.yml"],
"removed": []
}],
"total_commits_count": 3,
"push_options": {},
"repository": {
"name": "test-drone",
"url": "git@gitlab.com:zhaoweiguo/test-drone.git",
"description": "",
"homepage": "http://gitlab.com/zhaoweiguo/test-drone",
"git_http_url": "http://gitlab.com/zhaoweiguo/test-drone.git",
"git_ssh_url": "git@gitlab.com:zhaoweiguo/test-drone.git",
"visibility_level": 0
}
}
Response headers:
Date: Tue, 26 Nov 2019 08:05:12 GMT
Content-Type: application/json
Content-Length: 657
Connection: close
Cache-Control: no-cache, no-store, must-revalidate, private, max-age=0
Expires: Thu, 01 Jan 1970 00:00:00 UTC
Pragma: no-cache
X-Frame-Options: DENY
X-Xss-Protection: 1; mode=block
Response body:
{
"id": 67,
"repo_id": 117,
"trigger": "@hook",
"number": 5,
"status": "pending",
"event": "push",
"action": "",
"link": "http://gitlab.com/zhaoweiguo/test-drone2/commit/b64c5011760f62e7b0f91ac3c3b6601ba71855ff",
"timestamp": 0,
"message": "update\n",
"before": "",
"after": "426463f21a30e9c5cb2da2aff0987a13213e090c",
"ref": "refs/heads/master",
"source_repo": "",
"source": "master",
"target": "master",
"author_login": "zhaoweiguo",
"author_name": "zhaoweiguo",
"author_email": "",
"author_avatar": "https://www.gravatar.com/avatar/a11d9508187d0744109511002c5dfd26?s=80\u0026d=identicon",
"sender": "zhaoweiguo",
"started": 0,
"finished": 0,
"created": 1574755512,
"updated": 1574755512,
"version": 1
}