简体   繁体   English

默认情况下,Google Cloud Build 标签触发器是否适用于所有分支?

[英]Does Google Cloud Build tag trigger apply to all branches by default?

When choosing Tag based trigger in Google Cloud Build, does that mean that any branch with that tag pushed will trigger the pipeline?在 Google Cloud Build 中选择基于标签的触发器时,这是否意味着推送该标签的任何分支都会触发管道? How can we restrict it to a specific branch, ie only tags pushed to a specific branch will trigger the pipeline (tags pushed to develop branch for example)?我们如何将其限制在特定分支,即只有推送到特定分支的标签才会触发管道(例如推送到开发分支的标签)?

As of Feb. 2022, I believe the answer to your question is (unfortunately) yes , any time you push a commit with the given tag, regardless of the branch, the build will run.截至 2022 年 2 月,我相信您的问题的答案是(不幸的是)的,只要您使用给定标签推送提交,无论分支如何,构建都会运行。

As to your second question, it doesn't appear that there are any built-in filtering options for both branches and tags.至于你的第二个问题,似乎没有针对分支标签的任何内置过滤选项。 (There is no mention of this ability in the documentation for creating triggers .) There is a way to skip builds by including [skip ci] in your commit message, but that's not ideal for automation. (在创建触发器的文档中没有提到这种能力。)有一种方法可以通过在提交消息中包含[skip ci]跳过构建,但这对于自动化来说并不理想。 Depending on the constraints you have on your branch structure or tagging scheme;取决于您对分支结构或标记方案的限制; if those are flexible, you might be able to use a different set of tags on your develop branch.如果这些是灵活的,您可以在开发分支上使用一组不同的标签。

One last option would be to add a bash build step at the start of the build to check the name of the branch (built-in substitution BRANCH_NAME ) and kill it if it doesn't match some criteria.最后一个选项是在构建开始时添加bash构建步骤以检查分支的名称(内置替换BRANCH_NAME )并在不符合某些条件时将其终止。 It's a bit hacky, but that's sometimes necessary with Cloud Build.这有点 hacky,但对于 Cloud Build 来说,这有时是必需的。

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

相关问题 默认情况下,Google Cloud Build 是否在步骤之间保留 docker 张图像? - Does Google Cloud Build keep docker images between steps by default? 列出 Google Cloud Source Repository 中的所有分支 - List all branches from Google Cloud Source Repository 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 如何通过 cli / rest api / 云功能运行 Google Cloud Build 触发器? - How to run a Google Cloud Build trigger via cli / rest api / cloud functions? Google Cloud Build/Run 触发合并特定分支的拉取请求 - Google Cloud Build/Run trigger upon Pull Request on merge with specific branch google cloud app engine 是否支持 tomcats 默认 200 个线程? - Does google cloud app engine support tomcats default 200 threads? Google Cloud Build 在使用 Github App 时不会忽略文件 - Google Cloud Build does not ignore file when using Github App 从 github 检查中删除云构建触发器 - Remove cloud build trigger from github checks 谷歌云容器注册表错误:“无法触发构建:请求包含无效参数。” - google cloud container registry error: "Failed to trigger build: Request contains an invalid argument."
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM