[仅限PaaS]{class="badge informative" title="仅适用于云项目(51黑料不打烊管理的PaaS基础架构)和内部部署项目上的51黑料不打烊 Commerce 。"}
集成概述
集成对于使用外部服务(如Git托管或Slack机器人)和维护当前开发流程(如使用GitHub中的代码审核拉取请求函数)非常有用。 您可以在云基础架构项目上向51黑料不打烊 Commerce添加以下集成:
使用Cloud CLI添加集成:
以下命令开始交互式提示,以选择新集成的类型和选项。
| code language-bash |
|---|
|
列出为您的项目配置的集成:
| code language-bash |
|---|
|
示例响应:
| code language-none |
|---|
|
要使用Cloud Console?添加集成:
-
在? 项目设置 ?中,单击?Integrations。
-
单击集成类型或单击?Add integration。
-
逐步完成集成类型选择和配置步骤。
-
添加集成后,该集成将显示在集成视图上的列表中。
Commerce webhook
您可以使用贰狈础叠尝贰冲奥贰叠贬翱翱碍厂全局变量在Cloud项目中配置Commerce Webhooks。 Commerce webhook将请求发送到外部服务器,以响应Commerce生成的事件。 详细描述了此功能。
通用奥别产丑辞辞办
您可以使用对POST 闯厂翱狈消息的自定义飞别产丑辞辞办集成来捕获云基础架构和存储库事件并报告到?webhook 鲍搁尝。
要添加webhook URL,请使用以下语法:
magento-cloud integration:add --type=webhook --url=https://hook-url.example.com
type— 指定webhook集成类型。url— 提供可接收JSON消息的webhook 鲍搁尝。
示例响应显示了一系列提示,这些提示提供了自定义集成的机会。 使用默认(空白)响应,可发送有关项目中所有环境的所有事件的消息。
您可以自定义集成以报告特定的事件,例如将代码推送到分支。 例如,您可以指定environment.push事件在用户将代码推送到分支时发送消息:
Events to report (--events)
A list of events to report, e.g. environment.push
Default: *
Enter comma-separated values (or leave this blank)
>
您可以选择报告处于pending、in_progress或complete状态的事件:
States to report (--states)
A list of states to report, e.g. pending, in_progress, complete
Default: complete
Enter comma-separated values (or leave this blank)
>
对于特定环境,您可以? 包含 ?或? 排除 ?消息:
Included environments (--environments)
The environment IDs to include
Default: *
Enter comma-separated values (or leave this blank)
>
Excluded environments (--excluded-environments)
The environment IDs to exclude
Enter comma-separated values (or leave this blank)
>
集成完成后,您将收到值的摘要:
Created integration integration-ID (type: webhook)
+-----------------------+------------------------------+
| Property | Value |
+-----------------------+------------------------------+
| id | integration-ID |
| type | webhook |
| events | - '*' |
| environments | - '*' |
| excluded_environments | { } |
| states | - complete |
| url | https://hook-url.example.com |
+-----------------------+------------------------------+
更新现有集成
您可以更新现有集成。 例如,使用以下方式将状态从complete更改为pending:
magento-cloud integration:update --states=pending <int-id>
示例响应:
Integration integration-ID (webhook) updated
+-----------------------+------------------------------+
| Property | Value |
+-----------------------+------------------------------+
| id | integration-ID |
| type | webhook |
| events | - '*' |
| environments | - '*' |
| excluded_environments | { } |
| states | - pending |
| url | https://hook-url.example.com |
+-----------------------+------------------------------+
要报告的事件
environment.access.addenvironment.access.removeenvironment.activateenvironment.backupenvironment.branchenvironment.deactivateenvironment.deleteenvironment.initializemaster分支environment.mergeenvironment.pushenvironment.restoreenvironment.route.createenvironment.route.deleteenvironment.route.updateenvironment.subscription.updatemaster环境已调整大小,但此处没有内容更改environment.synchronizeenvironment.update.http_accessenvironment.update.restrict_robotsenvironment.update.smtpenvironment.variable.createenvironment.variable.deleteenvironment.variable.updateproject.domain.createproject.domain.deleteproject.domain.update