简体   繁体   中英

How to trigger Google Cloud Build on GitHub ref/pull/*/merge branch events

As far as I can tell there are two ways of triggering a Google Cloud Build on a GitHub repo:

  1. All pull requests are automatically built
  2. Define a trigger than runs when a branch is changed

An unmerged GitHub pull request has 2 refs as shown here:

$ git ls-remote
From git@github.com: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 has been merged and only has refs/pull/1/head
  • PRs #2 and #3 have not been merged and refs/pull/2/merge also exist

Unfortunately the automatic pull request trigger only builds the refs/pull/*/head ref and not the refs/pull/*/merge ref. It is more important to build refs/pull/*/merge to prove that the pull request can be safely merged into master.

So I am trying to define a trigger to run on refs/pull/*/merge

As far as I can tell Google Cloud Build triggers only match GitHub refs of the form refs/heads/<regex> though:

Cloud Builder触发器

Is it possible to trigger a build when a refs/pull/*/merge branch is changed?

I also tested it and it's true that builds are not triggered for refs/pull/*/merge .

There's a Feature Request on the Issue Tracker about this, so it might get implemented in the future.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM