当我在GitLab中提交合并请求时,我遇到了问题。当我提交合并请求时,我不会构建一个作业,尽管我有一个web钩子来侦听合并请求或推送。每次我被推一推,它就会造出来。
下面是我从web钩子获得的推送请求的一个例子:
{"before":"bf12dc027feacfb99cd8e24b1be0993d29652e3d","after":"3ec0e32587f999f4edcb7085859a1af94f62c7ad","ref":"refs/heads/DUMMY_foo_bar_test","user_id":14,"user_name":"adam","project_id":9,"repository":{"name":"exchange-api","url":"git@gitlab01.localhost.com:exchange/exchange-api.git","description":"","homepage":"http://gitlab01.localhost.com/exchange/exchange-api"},"commits":[{"id":"3ec0e32587f999f4edcb7085859a1af94f62c7ad","message":"Fooo bar","timestamp":"2014-10-22T16:14:50-06:00","url":"http://gitlab01.localhost.com/exchange/exchange-api/commit/3ec0e32587f999f4edcb7085859a1af94f62c7ad","author":{"name":"Adam","email":"Adam@localhost.com"}}],"total_commits_count":1}下面是Gitlab向merge_request发送的内容:
{"object_kind":"merge_request","object_attributes":{"id":117,"target_branch":"US4395_safenet","source_branch":"DUMMY_foo_bar_test","source_project_id":9,"author_id":14,"assignee_id":null,"title":"Dummy foo bar test","created_at":"2014-10-22 21:52:35 UTC","updated_at":"2014-10-22 21:52:35 UTC","milestone_id":null,"state":"opened","merge_status":"unchecked","target_project_id":9,"iid":9,"description":"","position":0}}当您为合并请求按下"Test“时,该作业成功地生成,没有任何问题,下面是发送的数据:
{"before":"2ba2af40719a0b14661b5078d2c709fb7814f16f","after":"d27f6559cc4c4a0b4e76a00c21f6848169e1d5ab","ref":"refs/heads/dev_cloud","user_id":14,"user_name":"adam bourg","project_id":9,"repository":{"name":"exchange-api","url":"git@gitlab01.localhost.com:exchange/exchange-api.git","description":"","homepage":"http://gitlab01.localhost.com/exchange/exchange-api"},"commits":[{"id":"d27f6559cc4c4a0b4e76a00c21f6848169e1d5ab","message":"Merge branch 'dev_cloud' of localhost.com:exchange-api into dev_cloud","timestamp":"2014-10-14T15:53:34-06:00","url":"http://gitlab01.localhost.com/exchange/exchange-api/commit/d27f6559cc4c4a0b4e76a00c21f6848169e1d5ab","author":{"name":"Adam","email":"Adam@localhost.com"}},{"id":"ef9eba1cc80b1ca7c9178ee2e6c35908a459b5ea","message":"Merge branch 'qa' into dev_cloud","timestamp":"2014-10-14T15:53:26-06:00","url":"http://gitlab01.localhost.com/exchange/exchange-api/commit/ef9eba1cc80b1ca7c9178ee2e6c35908a459b5ea","author":{"name":"Adam","email":"Adam@localhost.com"}},{"id":"2ba2af40719a0b14661b5078d2c709fb7814f16f","message":"US3425: recommender_drug needs plan_id in calculate_listed_pharmacy_cost","timestamp":"2014-10-14T15:53:12-06:00","url":"http://gitlab01.localhost.com/exchange/exchange-api/commit/2ba2af40719a0b14661b5078d2c709fb7814f16f","author":{"name":"Adam","email":"Adam@localhost.com"}}],"total_commits_count":3}为什么真正的合并请求触发发送这么少的数据?我怎样才能修复这个问题,让詹金斯为这个工作建立正确的程序呢?
詹金斯版本: 1.584
Gitlab Hook插件版本: 1.1.0
链接:https://wiki.jenkins-ci.org/display/JENKINS/Gitlab+Hook+Plugin
发布于 2014-10-30 23:21:18
还有,我只是玩了一下这个主意。
我使用的场景是:
在创建合并请求时,gitlab在“未检查”状态下发送了merge_request JSON,并提供了有关源(特性分支)、目的地(主)和最新提交功能分支的详细信息:
{
"object_kind": "merge_request",
"object_attributes":
{
"id": 1,
"target_branch": "master",
"source_branch": "develop",
"source_project_id": 1,
"author_id": 1,
"assignee_id": 1,
"title": "Merge test",
"created_at": "2014-10-26 19:27:54 UTC",
"updated_at": "2014-10-26 19:27:54 UTC",
"milestone_id": null,
"state": "opened",
"merge_status": "unchecked",
"target_project_id": 1,
"iid": 1,
"description": "",
"position": 0,
"source": {
"name": "jenkins-hooks-test",
"ssh_url": "git@gitlab.local:root/jenkins-hooks-test.git",
"http_url": "http://gitlab.local/root/jenkins-hooks-test.git",
"namespace": "root",
"visibility_level": 10
},
"target": {
"name": "jenkins-hooks-test",
"ssh_url": "git@gitlab.local:root/jenkins-hooks-test.git",
"http_url": "http://gitlab.local/root/jenkins-hooks-test.git",
"namespace": "root",
"visibility_level": 10
},
"last_commit": {
"id": "8e71eab5362ef1165b6e233c97f7e9afcdba6485",
"message": "change\n",
"timestamp": "2014-10-26T12:11:21-07:00",
"url": "http://gitlab.local/root/jenkins-hooks-test/commit/8e71eab5362ef1165b6e233c97f7e9afcdba6485",
"author": {
"name": "Vanja Radovanovic",
"email": "some@email.com"
}
}
}
}没有工作触发,但在这种情况下,似乎是好的。原因是,在进行合并请求之前,我从特性分支中推动了更改,并且这些更改已经构建在Jenkins上。当发出合并请求时,不需要对此情况进行构建。
然后,在接受请求后,它被合并到gitlab中。因此,发生了一个新的提交(主分支上的合并提交),这触发了在Jenkins上的构建:
{
"before": "62823aa9df67e76c97a22a7229495db51abd6c7f",
"after": "2edb684defde57dce8344ed5800b5e90e4e18a5d",
"ref": "refs/heads/master",
"user_id": 1,
"user_name": "Administrator",
"project_id": 1,
"repository": {
"name": "jenkins-hooks-test",
"url": "git@gitlab.local:root/jenkins-hooks-test.git",
"description": "",
"homepage": "http://gitlab.local/root/jenkins-hooks-test"
},
"commits": [
{
"id": "23cb86268570fcf53b59870fb7f4bc2fc5bf1f16",
"message": "change\n",
"timestamp": "2014-10-26T01:34:57+02:00",
"url": "http://gitlab.local/root/jenkins-hooks-test/commit/23cb86268570fcf53b59870fb7f4bc2fc5bf1f16",
"author": {
"name": "Vanja Radovanović",
"email": "some@email.com"
}
},
{
"id": "8e71eab5362ef1165b6e233c97f7e9afcdba6485",
"message": "change\n",
"timestamp": "2014-10-26T20:11:21+01:00",
"url": "http://gitlab.local/root/jenkins-hooks-test/commit/8e71eab5362ef1165b6e233c97f7e9afcdba6485",
"author": {
"name": "Vanja Radovanović",
"email": "some@email.com"
}
},
{
"id": "2edb684defde57dce8344ed5800b5e90e4e18a5d",
"message": "Merge branch 'develop' into 'master'\nMerge test\nSee merge request !1\n",
"timestamp": "2014-10-26T12:32:00-07:00",
"url": "http://gitlab.local/root/jenkins-hooks-test/commit/2edb684defde57dce8344ed5800b5e90e4e18a5d",
"author": {
"name": "Administrator",
"email": "some@email.com"
}
}
],
"total_commits_count": 3
}在我看来,一切都是正常的。我知道,当合并请求在手时,Gitlab提供了将数据推送到钩子url上的功能,但我不明白为什么您需要这样做。
也许你能提供更多关于你的流程的细节?
https://stackoverflow.com/questions/26518251
复制相似问题