如何在GitHub ref / pull / * / merge分支事件上触发Google Cloud Build

问题描述 投票:2回答:1

据我所知,有两种方法可以在GitHub仓库上触发Google Cloud Build:

  1. 所有拉取请求都是自动构建的
  2. 定义一个触发器,而不是在更改分支时运行

未合并的GitHub拉取请求有2个参考,如下所示:

$ git ls-remote
From [email protected]:user/repo
1680161331c0a0ebcf59fb1ef2f4dbe27b857418    HEAD
9e1d427bfcd97d8ac2eda7661cc8a21da2355d19    refs/heads/if_deps
ee8328eb1e5fa38c9cc39c86d8b0896c9eaec73c    refs/heads/mcmc-fixes
1680161331c0a0ebcf59fb1ef2f4dbe27b857418    refs/heads/master
94d3a40412aff060a2a820d164dfd52050cac192    refs/pull/1/head
9e1d427bfcd97d8ac2eda7661cc8a21da2355d19    refs/pull/2/head
ccb44a8c12ed9d79e76551e7876892c9e87de032    refs/pull/2/merge
ee8328eb1e5fa38c9cc39c86d8b0896c9eaec73c    refs/pull/3/head
f9928f924698042939008e8526094662b7f44125    refs/pull/3/merge
  • PR#1已经合并,只有refs/pull/1/head
  • PR#2和#3尚未合并,refs/pull/2/merge也存在

不幸的是,自动拉取请求触发器仅构建refs/pull/*/head ref而不是refs/pull/*/merge ref。构建refs/pull/*/merge以证明pull请求可以安全地合并到master中更为重要。

所以我试图定义一个在refs/pull/*/merge上运行的触发器

据我所知,Google Cloud Build触发器仅匹配refs/heads/<regex>形式的GitHub引用:

Cloud Builder Triggers

refs/pull/*/merge分支发生变化时,是否可以触发构建?

git github google-cloud-platform google-cloud-build
1个回答
0
投票

我也测试了它,并且确实没有为refs/pull/*/merge触发构建。

关于这个有一个Feature Request on the Issue Tracker,所以它可能会在未来实施。

© www.soinside.com 2019 - 2024. All rights reserved.