如何使Coogle Cloud Build Build触发触发触发器的变化
当我们推开分支时,我们使用Google Cloud Build为GitHub存储库运行不同的测试。我们的问题是,只有分支机构中的最后一个提交似乎会影响哪些触发器的运行。
例如,说我们的存储库看起来像这样:
./client/<client code>
./server/<server code>
在我们的两个触发器中,我们指定随附的文件过滤器这样:
- 触发器1:包含文件:
client/**
- 触发器2:随附文件:
server/**
问题是只有在分支中的最后一个提交才能触发构建会影响触发运行的行为。
为了说明问题:说我们将分支推出以下提交:
- 提交1:&lt;更改客户/foo.js&gt;
- 提交2:&lt;更改服务器/bar.scala&gt;
仅运行“触发2”。我们想要的是,这两个触发因素都是运行的,因为我们想对分支机构引入的所有更改进行测试。
确定要运行哪些触发器时,有什么方法可以让GCB“查看”分支推动的所有更改?显而易见的快速修复是用单个提交创建分支,这使所有触发器都运行,但是从我们的GIT工作流程的角度来看,这并不是理想的。
We use Google Cloud Build to run different tests for our Github repository when we push a branch. Our problem is that only the last commit in the branch seems to affect which triggers are run.
E.g. say our repository looks like this:
./client/<client code>
./server/<server code>
and in our two triggers we specify the Included files filter like this:
- trigger 1: Included files:
client/**
- trigger 2: Included files:
server/**
the problem is that only the last commit in the branch that should trigger builds affects which triggers to run.
To illustrate the problem: say we push a branch with the following commits:
- Commit 1: <Changes to client/foo.js>
- Commit 2: <Changes to server/bar.scala>
only "trigger 2" is run. And what we want is that both triggers are run, since we want to run tests for all the changes introduced by our branch.
Is there any way to get GCB to "see" all the changes in the branch that is pushed, when deciding which triggers to run? The obvious quick-fix is to create branches with single commits, which makes all the triggers run, but is less than ideal from the perspective of our git workflow.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将触发类型设置为“推到分支”,Git无法跟踪对所有分支的更改,而只能按照您描述的最后提交。
为此,您必须使用拉动请求来触发构建。当创建拉动请求时,GIT将不能够适当地跟踪更改,并且您的测试将按照您的预期进行。因此,将触发您的构建的事件更改为“拉出请求”,而不是从分支机构创建拉动请求以触发构建并因此进行测试。
With the trigger type set to "push to a branch", git is not able to track the changes made to all the branch but only to the last commit as you described.
To accomplish this, you must use Pull Requests to trigger the build. When creating a pull request, git will than be able to track the changes appropriately and your tests will be run as you expected. So change the event that triggers your build to "Pull Request" and than create a pull request from your branch to trigger the build and therefore your tests.