云效通用Git写的是仅支持代码提交触发流水线,为啥在代码合并的时候也触发了?
Response body:
{"object":true,"successful":true}
Response headers:
Date: Sun, 08 Oct 2023 08:13:12 GMT
Content-Type: application/json;charset=UTF-8
Content-Length: 33
Connection: close
Server: Tengine
X-Application-Context: aone-flow-engine:cloudonline:7001
Eagleeye-Traceid-2nd: 0bc152af16967527920128313eae66
Eagleeye-Traceid: 0bc152af16967527920128313eae66
Timing-Allow-Origin: *
Request headers:
Content-Type: application/json
User-Agent: GitLab/13.7.3
X-Gitlab-Event: Merge Request Hook
Request body:
{
"object_kind": "merge_request",
"event_type": "merge_request",
"user": {
"name": "凡衣",
"username": "fanyi10",
"avatar_url": "https://profile-avatar.csdnimg.cn/893e1f38fb454a229b6b224ff3d7e015_fanyi10.jpg!1",
"email": "fanyi10@gitcode.net"
},
"project": {
"id": 401539,
"name": "demo",
"description": "",
"web_url": "https://gitcode.net/fanyi10/demo",
"avatar_url": null,
"git_ssh_url": "git@gitcode.net:fanyi10/demo.git",
"git_http_url": "https://gitcode.net/fanyi10/demo.git",
"namespace": "凡衣",
"visibility_level": 0,
"path_with_namespace": "fanyi10/demo",
"default_branch": "master",
"ci_config_path": ".codechina-ci.yml",
"homepage": "https://gitcode.net/fanyi10/demo",
"url": "git@gitcode.net:fanyi10/demo.git",
"ssh_url": "git@gitcode.net:fanyi10/demo.git",
"http_url": "https://gitcode.net/fanyi10/demo.git"
},
"object_attributes": {
"assignee_id": null,
"author_id": 2670498,
"created_at": "2023-10-08 16:13:11 +0800",
"description": "",
"head_pipeline_id": null,
"id": 76421,
"iid": 1,
"last_edited_at": null,
"last_edited_by_id": null,
"merge_commit_sha": null,
"merge_error": null,
"merge_params": {
"force_remove_source_branch": "1"
},
"merge_status": "unchecked",
"merge_user_id": null,
"merge_when_pipeline_succeeds": false,
"milestone_id": null,
"source_branch": "fanyi10-master-patch-79959",
"source_project_id": 401539,
"state_id": 1,
"target_branch": "master",
"target_project_id": 401539,
"time_estimate": 0,
"title": "更新111",
"updated_at": "2023-10-08 16:13:11 +0800",
"updated_by_id": null,
"url": "https://gitcode.net/fanyi10/demo/-/merge_requests/1",
"source": {
"id": 401539,
"name": "demo",
"description": "",
"web_url": "https://gitcode.net/fanyi10/demo",
"avatar_url": null,
"git_ssh_url": "git@gitcode.net:fanyi10/demo.git",
"git_http_url": "https://gitcode.net/fanyi10/demo.git",
"namespace": "凡衣",
"visibility_level": 0,
"path_with_namespace": "fanyi10/demo",
"default_branch": "master",
"ci_config_path": ".codechina-ci.yml",
"homepage": "https://gitcode.net/fanyi10/demo",
"url": "git@gitcode.net:fanyi10/demo.git",
"ssh_url": "git@gitcode.net:fanyi10/demo.git",
"http_url": "https://gitcode.net/fanyi10/demo.git"
},
"target": {
"id": 401539,
"name": "demo",
"description": "",
"web_url": "https://gitcode.net/fanyi10/demo",
"avatar_url": null,
"git_ssh_url": "git@gitcode.net:fanyi10/demo.git",
"git_http_url": "https://gitcode.net/fanyi10/demo.git",
"namespace": "凡衣",
"visibility_level": 0,
"path_with_namespace": "fanyi10/demo",
"default_branch": "master",
"ci_config_path": ".codechina-ci.yml",
"homepage": "https://gitcode.net/fanyi10/demo",
"url": "git@gitcode.net:fanyi10/demo.git",
"ssh_url": "git@gitcode.net:fanyi10/demo.git",
"http_url": "https://gitcode.net/fanyi10/demo.git"
},
"last_commit": {
"id": "f975869aef715011f9313e861889e110947464c3",
"message": "更新111",
"title": "更新111",
"timestamp": "2023-10-08T16:13:01+08:00",
"url": "https://gitcode.net/fanyi10/demo/-/commit/f975869aef715011f9313e861889e110947464c3",
"author": {
"name": "凡衣",
"email": "fanyi10@gitcode.net"
}
},
"work_in_progress": false,
"total_time_spent": 0,
"human_total_time_spent": null,
"human_time_estimate": null,
"assignee_ids": [
],
"state": "opened",
"action": "open"
},
"labels": [
],
"changes": {
"author_id": {
"previous": null,
"current": 2670498
},
"created_at": {
"previous": null,
"current": "2023-10-08 16:13:11 +0800"
},
"description": {
"previous": null,
"current": ""
},
"id": {
"previous": null,
"current": 76421
},
"iid": {
"previous": null,
"current": 1
},
"merge_params": {
"previous": {
},
"current": {
"force_remove_source_branch": "1"
}
},
"source_branch": {
"previous": null,
"current": "fanyi10-master-patch-79959"
},
"source_project_id": {
"previous": null,
"current": 401539
},
"target_branch": {
"previous": null,
"current": "master"
},
"target_project_id": {
"previous": null,
"current": 401539
},
"title": {
"previous": null,
"current": "更新111"
},
"updated_at": {
"previous": null,
"current": "2023-10-08 16:13:11 +0800"
}
},
"repository": {
"name": "demo",
"url": "git@gitcode.net:fanyi10/demo.git",
"description": "",
"homepage": "https://gitcode.net/fanyi10/demo"
}
}
在云效中,您可以通过代码提交、Tag 创建、合并请求等代码仓库事件触发流水线运行。如果您的代码合并事件被设置为触发流水线运行,那么当您合并代码时,流水线就会自动运行。请注意,如果您希望在合并代码时触发流水线运行,您需要确保您的代码合并事件已经被设置为触发流水线运行。
提交到test分支之后流水线触发:
之后将test分支合并到master gitcode创建合并请求之后会触发两个merge request hook和一个push hook,是这个往master的push hook触发的流水线流水线只要接收到push的事件的webhook请求就会触发的所以唯一解决的方法是让gitcode执行合并请求的时候不要触发push events。
此回答整理自钉群“云效API反馈(外部用户)”
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。
云效,企业级一站式研发协同平台,数十万企业都在用。支持公共云、专有云和混合云多种部署形态,通过云原生新技术和研发新模式,助力创新创业和数字化转型企业快速实现研发敏捷和组织敏捷,打造“双敏”组织,实现多倍效能提升。