简体   繁体   English

如何使云构建触发器仅在推送命令时触发?

[英]How to make Cloud build Trigger to trigger only on push command?

I'm using REST API to create triggers in Cloud build.我正在使用 REST API 在云构建中创建触发器。

Issue 1) I created a trigger for branch push, as soon as it got created, it triggers for all the branch and started building.问题 1)我为分支推送创建了一个触发器,一旦它被创建,它就会触发所有分支并开始构建。 (more than 300 branch all started once). (300多家分店全部开工一次)。

2) As soon as I created a new branch it automatically got triggered. 2)一旦我创建了一个新分支,它就会自动被触发。

3) If I want to specifies only 2-3 branches. 3)如果我只想指定2-3个分支。 how to do it?怎么做?

can anyone suggest me the solution for all the above issues?谁能建议我解决上述所有问题?

Thanks in advance!提前致谢!

I think that issues 1 & 3 are solved by adding the correct branch whenever you are doing a post to create a new trigger.我认为问题 1 和 3 可以通过在创建新触发器时添加正确的分支来解决。 You can specify a list of branches to match in order for them to trigger your build, and you can use regex to match only some branches, not all of them.您可以指定要匹配的分支列表,以便它们触发您的构建,并且您可以使用正则表达式仅匹配部分分支,而不是所有分支。

In order to create the trigger, you can follow the official documentation on how to create it using the REST API.要创建触发器,您可以按照有关如何使用 REST API 创建它的官方文档进行操作。 All the information regarding triggers and its usage through the REST API can be found in this link .有关触发器及其通过 REST API 的使用的所有信息都可以在此链接中找到。

As for your issue number 2, Cloud Build will trigger as soon as the associated branch it's created as it counts as a push.至于您的问题编号 2,Cloud Build 将在创建关联分支后立即触发,因为它被视为推送。 This is easily avoidable if your regex rules that apply to certain trigger do not match your newly created branch or either you specify a trigger for your new branch.如果您的适用于特定触发器的正则表达式规则与您新创建的分支不匹配,或者您为新分支指定了触发器,那么这很容易避免。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 GCP 中增加云构建中的触发限制 - how to Increase trigger limit in Cloud build in GCP Google Cloud Builder - 如何触发子目录中的构建配置? - Google Cloud Builder - how to trigger build configuration in a subdirectory? 如何完全自动化 Google Cloud Build 触发器的创建 - How to fully automate the Google Cloud Build trigger creation 从 github 检查中删除云构建触发器 - Remove cloud build trigger from github checks 通过触发器进行 GCP 云构建:Dockerfile 未找到 - GCP Cloud Build via trigger: Dockerfile not found 如何通过 cli / rest api / 云功能运行 Google Cloud Build 触发器? - How to run a Google Cloud Build trigger via cli / rest api / cloud functions? 使用 Github 触发器的 Cloud Build 无法正常工作:在服务器上找不到 testIamPermissions - Cloud Build with Github trigger not working: testIamPermissions not found on server 如何为 HTTP 触发器验证谷歌云 function? - How to authenticate google cloud function for HTTP trigger? 默认情况下,Google Cloud Build 标签触发器是否适用于所有分支? - Does Google Cloud Build tag trigger apply to all branches by default? 在推送到子模块时触发 Azure 管道构建? - Trigger an Azure Pipeline Build on push to a sub-module?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM