Gitlab API,构建成功时合并

Gitlab API,构建成功时合并,gitlab,gitlab-ci,Gitlab,Gitlab Ci,我想用Gitlab API设置合并请求的merge_when_build_successed属性。当可选的merged\u when\u build\u successed参数为true时,只有在构建成功后才会接受MR 当_build_成功参数时,我应该如何向API提供这个merged_?我尝试了以下curl命令,但没有成功: # In the request's body vilmosnagy@vnagy-dell:~$ curl -X PUT --header "PRIVATE-TOKEN:

我想用Gitlab API设置合并请求的merge_when_build_successed属性。当可选的
merged\u when\u build\u successed
参数为
true
时,只有在构建成功后才会接受MR

当_build_成功参数时,我应该如何向API提供这个
merged_?我尝试了以下
curl
命令,但没有成功:

# In the request's body
vilmosnagy@vnagy-dell:~$ curl -X PUT --header "PRIVATE-TOKEN: zvzK7CNzx9WviV5iChyg" -d merged_when_build_succeeds=true "http://localhost:8080/api/v3/projects/1/merge_requests/9/merge"
{"message":"405 Method Not Allowed"}

# In the URL
vilmosnagy@vnagy-dell:~$ curl -X PUT --header "PRIVATE-TOKEN: zvzK7CNzx9WviV5iChyg" "http://localhost:8080/api/v3/projects/1/merge_requests/9/merge?merged_when_build_succeeds=true"
{"message":"405 Method Not Allowed"}

# I tried this also, maybe the __merged__ is a mistake in the docs
vilmosnagy@vnagy-dell:~$ curl -X PUT --header "PRIVATE-TOKEN: zvzK7CNzx9WviV5iChyg" -d merge_when_build_succeeds=true "http://localhost:8080/api/v3/projects/1/merge_requests/9/merge"
{"message":"405 Method Not Allowed"}

# In the URL
vilmosnagy@vnagy-dell:~$ curl -X PUT --header "PRIVATE-TOKEN: zvzK7CNzx9WviV5iChyg" "http://localhost:8080/api/v3/projects/1/merge_requests/9/merge?merge_when_build_succeeds=true"
{"message":"405 Method Not Allowed"}

# Some other CURL parameters
vilmosnagy@vnagy-dell:~$ curl -X PUT --header "PRIVATE-TOKEN: zvzK7CNzx9WviV5iChyg" -H "Content-Type: multipart/form-data;" -F "merge_when_build_succeeds=true" "http://localhost:8080/api/v3/projects/1/merge_requests/9/merge"
{"message":"405 Method Not Allowed"}

# Some other CURL parameters
vilmosnagy@vnagy-dell:~$ curl -X PUT --header "PRIVATE-TOKEN: zvzK7CNzx9WviV5iChyg" -H "Content-Type: multipart/form-data;" -F "merged_when_build_succeeds=true" "http://localhost:8080/api/v3/projects/1/merge_requests/9/merge"
{"message":"405 Method Not Allowed"}
新功能“仅允许在生成成功时合并请求”已启用。当我关闭此功能时,以前的任何调用都会在生成完成之前合并MR,请参见:

私有令牌,并且URL是正确的。我可以查询先生的信息:

vilmosnagy@vnagy-dell:~$ curl -X GET --header "PRIVATE-TOKEN: zvzK7CNzx9WviV5iChyg" "http://localhost:8080/api/v3/projects/1/merge_requests/9"
{"id":9,"iid":9,"project_id":1,"title":"enters","description":"","state":"opened","created_at":"2016-06-29T15:36:15.235Z","updated_at":"2016-06-29T15:36:15.235Z","target_branch":"master","source_branch":"features/long_build_05","upvotes":0,"downvotes":0,"author":{"name":"Vilmos Nagy","username":"vilmos.nagy","id":2,"state":"active","avatar_url":"http://www.gravatar.com/avatar/4f94d9571ec83f42a85651291296f503?s=80\u0026d=identicon","web_url":"http://172.21.0.3/u/vilmos.nagy"},"assignee":null,"source_project_id":2,"target_project_id":1,"labels":[],"work_in_progress":false,"milestone":null,"merge_when_build_succeeds":false,"merge_status":"can_be_merged","subscribed":false,"user_notes_count":0}
在构建成功后,我可以接受MR:

vilmosnagy@vnagy-dell:~$ curl -X PUT --header "PRIVATE-TOKEN: zvzK7CNzx9WviV5iChyg" "http://localhost:8080/api/v3/projects/1/merge_requests/9/merge"
{"id":9,"iid":9,"project_id":1,"title":"enters","description":"","state":"merged","created_at":"2016-06-29T15:36:15.235Z","updated_at":"2016-06-29T16:13:41.242Z","target_branch":"master","source_branch":"features/long_build_05","upvotes":0,"downvotes":0,"author":{"name":"Vilmos Nagy","username":"vilmos.nagy","id":2,"state":"active","avatar_url":"http://www.gravatar.com/avatar/4f94d9571ec83f42a85651291296f503?s=80\u0026d=identicon","web_url":"http://172.21.0.3/u/vilmos.nagy"},"assignee":null,"source_project_id":2,"target_project_id":1,"labels":[],"work_in_progress":false,"milestone":null,"merge_when_build_succeeds":false,"merge_status":"can_be_merged","subscribed":true,"user_notes_count":0}
你能帮助我,并给我正确的调用给定的API吗

谢谢


Vilmos

文档似乎有误,当构建成功时,该参数实际上被称为
merge\u(在“merge”中没有“d”)

curl-X PUT--header“PRIVATE-TOKEN:zvzK7CNzx9WviV5iChyg”-d merge_when_build_successed=truehttp://localhost:8080/api/v3/projects/1/merge_requests/9/merge“
应该有效(“不允许使用405方法”可能是因为其他原因,例如MR已经合并或存在冲突)


我创建了一个问题,如果您想知道文档何时修复,您可以关注它:

谢谢!在接下来的几天里,我会再看一遍(
-d merge\u when\u build\u successful=true
),我会回答一些更有用的问题。:-)@NagyVilmos-当使用Giltb API在常规存储库配置(而非MR级别)中成功时,是否可以选中/取消选中此合并?