CodeHub给你发送的 POST 请求将包含如下信息:headers:
Content-Length: 2294
Connection: keep-alive
Host: your.host.com
X-Devcloud-Event: Push Hook
Content-Type: application/json
X-Devcloud-Token: xxxxxxx (如果配置了的话)
body:(推送的具体信息)
{
"object_kind": "push",
"event_name": "push", //事件类型,此例中为推送事件
"before": "0101010101010101010101010101010101010101", //before、after分别记录了此次动作前后的commitID
"after": "0123456789012345678901234567890123456789",
"ref": "refs/heads/master", //触发的分支
"checkout_sha": "0123456789012345678901234567890123456789", //触发事件时被检出的版本
"message": "",
"user_id": 1234, //以下为操作者的信息
"user_name": "example_user",
"user_username": "example_user",
"user_email": "example@huawei.com",
"user_avatar": null,
"project_id": 123456, //以下为触发事件的项目的信息
"project": {
"id": 123456,
"name": "ExampleRepository",
"description": "This is an example repository",
"web_url": "https://codehub.devcloud.huaweicloud.com/ExampleNamespace/ExampleRepository",
"avatar_url": null,
"git_ssh_url": "git@codehub.devcloud.huaweicloud.com:ExampleNamespace/ExampleRepository.git",
"git_http_url": "https://codehub.devcloud.huaweicloud.com/ExampleNamespace/ExampleRepository.git",
"namespace": "ExampleNamespace",
"visibility_level": 0,
"path_with_namespace": "ExampleNamespace/ExampleRepository",
"default_branch": "master",
"ci_config_path": null,
"homepage": "https://codehub.devcloud.huaweicloud.com/ExampleNamespace/ExampleRepository",
"url": "git@codehub.devcloud.huaweicloud.com:ExampleNamespace/ExampleRepository.git",
"ssh_url": "git@codehub.devcloud.huaweicloud.com:ExampleNamespace/ExampleRepository.git",
"http_url": "https://codehub.devcloud.huaweicloud.com/ExampleNamespace/ExampleRepository.git"
},
"commits": { //触发事件的提交的信息
"id": "0123456789012345678901234567890123456789",
"message": "This is an example message",
"timestamp": "2019-05-30T08:50:37Z",
"url": "https://codehub.devcloud.huaweicloud.com/ExampleNamespace/ExampleRepository/commit/0123456789012345678901234567890123456789",
"author": {
"name": "example_user",
"email": "example@huawei.com"
}"added": [
"src/main/java/HelloWorld.java"
],
"modified": [],
"removed": []
},
"total_commits_count": 1,
"repository": { //仓库信息
"name": "ExampleRepository",
"url": "git@codehub.devcloud.huaweicloud.com:ExampleNamespace/ExampleRepository.git",
"description": "This is an example repository",
"homepage": "https://codehub.devcloud.huaweicloud.com/ExampleNamespace/ExampleRepository",
"git_http_url": "https://codehub.devcloud.huaweicloud.com/ExampleNamespace/ExampleRepository.git",
"git_ssh_url": "git@codehub.devcloud.huaweicloud.com:ExampleNamespace/ExampleRepository.git",
"visibility_level": 0
}
}