# SVN Webhook
# 事件的内容组成
# Pre-Commit 事件
触发时间:事务将被提交生成一个新的版本之前
触发条件:Webhook中配置的路径包含本次提交变更的文件或目录
超时说明:Webhook的超时时间为
5秒,如果5秒内未能收到接收端的返回信息,则会断开请求。超时则允许将事务提交成版本
请求头:
X-Gitlab-Event: Svn Pre Commit
X-Event: Svn Pre Commit
X-Event-Type: svn_pre_commit
X-Token: 添加 Hook 时配置的 Token
X-Send-Timestamp: 发送的时间戳
X-TRACE-ID: 链路追踪ID
X-Gitlab-Token: Hook 配置添加的令牌
请求体:
{
"object_kind": "pre_commit",
"operation_kind": "update",
"action_kind": "svn client commit",
"revision": "19-v1",
"user_name": "svn_user",
"user_id": 10000,
"user_email": "svn_user@example.com",
"project_id": 10000,
"repository": {
"name": "example",
"description": "",
"homepage": "https://example.com/example_project",
"svn_http_url": "https://example.com/example_project",
"svn_ssh_url": "svn+ssh://example.com/example_project",
"url": "svn+ssh://example.com/example_project ",
"visibility_level": 0
},
"timestamp": "2023-04-12T19:04:21+0000",
"message": "update readme",
"files": [
"trunk/example.txt"
],
"paths": [
"trunk/"
],
"push_options": {},
"push_timestamp": "2023-04-12T11:04:22+0000",
"total_files_count": 1,
"create_and_update": null
}
请求字段说明:
files: 本次提交变更的文件列表,超过1000个将会被截断
paths: 本次提交变更的目录列表,超过1000个将会被截断
revision: 本次提交的对应的事务号
响应体:
响应体格式为一个简单的JSON字符串,格式如下
{
"status": 200,
"message": "allow commit"
}
响应字段说明:
status:
- 200: 允许提交
- 500: 不允许提交
- 其他:允许提交
message: 简单的说明信息
# Post-Commit 事件
触发时间:事务成功提交成一个新版本后
触发条件:Webhook中配置的路径包含本次提交变更的文件或目录
超时说明:Webhook的超时时间为
5秒,如果5秒内未能收到接收端的返回信息,则会断开请求。Post-Commit超时与否不影响本次提交
请求头:
X-Gitlab-Event: Svn Post Commit
X-Event: Svn Post Commit
X-Event-Type: svn_post_commit
X-Token: 添加 Hook 时配置的 Token
X-Send-Timestamp: 发送的时间戳
X-TRACE-ID: 链路追踪ID
X-Gitlab-Token: Hook 配置添加的令牌
请求体:
{
"object_kind": "post_commit",
"operation_kind": "update",
"action_kind": "svn client commit",
"revision": 20,
"user_name": "svn_user",
"user_id": 10000,
"user_email": "svn_user@example.com",
"project_id": 10000,
"repository": {
"name": "example",
"description": "",
"homepage": "https://example.com/example_project",
"svn_http_url": "https://example.com/example_project",
"svn_ssh_url": "svn+ssh://example.com/example_project",
"url": "svn+ssh://example.com/example_project",
"visibility_level": 0
},
"timestamp": "2023-04-12T19:04:23+0000",
"message": "update readme",
"files": [
{
"type": "U",
"file": "trunk/example.txt",
"directory": false,
"size": -1,
"insertions": 0,
"deletions": 0
}
],
"paths": [
"trunk/"
],
"push_options": {},
"push_timestamp": "2023-04-12T11:04:23+0000",
"total_files_count": 1,
"create_and_update": null
}
请求字段说明:
files: 本次提交变更的文件列表,超过1000个将会被截断
paths: 本次提交变更的目录列表,超过1000个将会被截断
revision: 本次提交版本号
响应体说明:
Post-Commit不关注响应体内容和格式,建议按照以下JSON格式返回
{
"status": 200,
"message": "The request has been successfully received"
}
# Pre-Lock 事件
触发时间:加锁或者解锁完成前,若Webhook成功返回且要求明确拒绝,则终止本次锁的变更
触发条件:本次锁变更的文件被Webhook配置的路径包含
超时说明:Webhook的超时时间为
5秒,如果5秒内未能收到接收端的返回信息,则会断开请求。超时允许本次加锁或解锁操作
请求头:
X-Gitlab-Event: Path Lock Hook
X-Event: Path Lock Hook
X-Event-Type: path_lock_pre_lock
X-Token: 添加 Hook 时配置的 Token
X-Send-Timestamp: 发送的时间戳
X-TRACE-ID: 链路追踪ID
X-Gitlab-Token: Hook 配置添加的令牌
请求体:
{
"object_kind": "pre_lock",
"operation_kind": "update",
"action_kind": "svn client lock",
"user_name": "svn_user",
"user_id": 10000,
"user_email": "svn_user@example.com",
"project_id": 10000,
"repository": {
"name": "example",
"description": "",
"homepage": "https://example.com/example_project",
"svn_http_url": "https://example.com/example_project",
"svn_ssh_url": "svn+ssh://example.com/example_project",
"url": "svn+ssh://example.com/example_project ",
"visibility_level": 0
},
"timestamp": "2023-04-12T19:04:21+0000",
"path": "/trunk/test.txt",
"object_attributes": {
"message": "lock or unlock file message",
"steal": "1"
}
}
请求字段说明:
object_kind:
- pre_lock:加锁
- pre_unlock:解锁
steal: 本次锁变更变更的目录列表,超过1000个将会被截断
- 0:非强制加解锁
- 1:强制加解锁
响应体:
响应体格式为一个简单的JSON字符串,格式如下
{
"status": 200,
"message": "allow commit"
}
响应字段说明:
status:
- 200: 允许本次加锁或解锁操作
- 500: 不允许本次加锁或解锁操作
- 其他:允许本次加锁或解锁操作
message: 简单的说明信息
# Pre-Shelve 事件
触发时间:shelve生成/更新之前
触发条件:Webhook中配置的路径包含本次shelve变更的文件或目录
超时说明:Webhook的超时时间为
5秒,如果5秒内未能收到接收端的返回信息,则会断开请求。超时则允许shelve
请求头:
X-Gitlab-Event: Svn Pre Shelve
X-Event: Svn Pre Shelve
X-Event-Type: svn_pre_shelve
X-Token: 添加 Hook 时配置的 Token
X-Send-Timestamp: 发送的时间戳
X-TRACE-ID: 链路追踪ID
X-Gitlab-Token: Hook 配置添加的令牌
请求体:
{
"user_name": "svn_user",
"operation_kind": "update",
"event_type": "svn_pre_shelve",
"user_id": 10000,
"user_email": "svn_user@example.com",
"project_id": 10000,
"repository": {
"name": "example",
"description": "",
"homepage": "https://example.com/example_project",
"svn_http_url": "https://example.com/example_project",
"svn_ssh_url": "svn+ssh://example.com/example_project"
},
"timestamp": "2025-04-15T10:46:40+0000",
"object_kind": "pre-update-shelve",
"action_kind": "svn client shelve",
"shelve_id": "20-df",
"message": "shelf1",
"files": [
"M:trunk/1",
"M:trunk/2",
"M:trunk/a/1"
],
"paths": [
"trunk/a/",
"trunk/"
],
"total_files_count": 3,
"options": {},
"created_at": "2025-04-21T03:00:26+0000"
}
请求字段说明:
files: 本次shelve变更的文件列表,超过1000个将会被截断
paths: 本次shelve变更的目录列表,超过1000个将会被截断
shelve_id: 本次shelve的对应的事务号
object_kind: pre-shelve/pre-update-shelve
operation_kind: create/update
响应体:
响应体格式为一个简单的JSON字符串,格式如下
{
"status": 200,
"message": "allow shelve"
}
响应字段说明:
status:
- 200: 允许shelve
- 500: 不允许shelve
- 其他:允许shelve
message: 简单的说明信息
# Post-Shelve 事件
触发时间:shelve创建或更新之后
触发条件:Webhook中配置的路径包含本次shelve变更的文件或目录
超时说明:Webhook的超时时间为
5秒,如果5秒内未能收到接收端的返回信息,则会断开请求。Post-Shelve超时与否不影响本次shelve
请求头:
X-Gitlab-Event: Svn Post Shelve
X-Event: Svn Post Shelve
X-Event-Type: svn_post_shelve
X-Token: 添加 Hook 时配置的 Token
X-Send-Timestamp: 发送的时间戳
X-TRACE-ID: 链路追踪ID
X-Gitlab-Token: Hook 配置添加的令牌
请求体:
{
"object_kind": "post-shelve",
"operation_kind": "create",
"action_kind": "svn client shelve",
"user_name": "svn_user",
"user_id": 10000,
"user_email": "svn_user@example.com",
"project_id": 10000,
"repository": {
"name": "example",
"description": "",
"homepage": "http://example.com/example_project",
"svn_http_url": "https://example.com/example_project",
"svn_ssh_url": "svn+ssh://example.com/example_project",
"url": "svn+ssh://example.com/example_project",
"visibility_level": 0
},
"timestamp": "2025-04-15T10:46:40+0000",
"shelve_id": "20",
"message": "shelf1",
"files": [
"M:trunk/1",
"M:trunk/2",
"M:trunk/a/1"
],
"paths": [
"trunk/",
"trunk/a/"
],
"total_files_count": 3,
"options": {},
"created_at": "2025-04-18T07:31:35+0000"
}
请求字段说明:
files: 本次shelve变更的文件列表,超过1000个将会被截断
paths: 本次shelve变更的目录列表,超过1000个将会被截断
shelve_id: 本次shelve版本号
object_kind: post-shelve/post-update-shelve
operation_kind: create/update
响应体说明:
Post-Shelve不关注响应体内容和格式,建议按照以下JSON格式返回
{
"status": 200,
"message": "The request has been successfully received"
}