Grace.B
Grace.B

Reputation: 61

How to trigger a Google Cloud Build build steps with a Pull Request?

I have configured a CI pipeline using a cloudbuild.yaml file. I'm trying to launch this pipeline with Pull Requests. It seems that the provided build triggers: https://cloud.google.com/cloud-build/docs/running-builds/automate-builds are not allowing this option. Is there a way to use webhooks to overcome this limitation? Like sending an HTTP request after a pull request event to cloud builds topic and configure a cloud function as a subscriber to launch the pipeline.

Thanks,

Upvotes: 1

Views: 5443

Answers (2)

chriscross
chriscross

Reputation: 453

A completed pull request is merged into an upstream branch (master, release, or another name). https://help.github.com/en/articles/merging-a-pull-request

You can set the Google Cloud Build trigger (in Google Cloud Console) type to "Branch" and enter the relevant branch. Choose Cloud Build configuration file as your build configuration and enter your cloudbuild.yaml file location.

Upvotes: 0

guille
guille

Reputation: 571

The Cloud Build Github App does builds on pull request: https://cloud.google.com/cloud-build/docs/run-builds-on-github

There are three ways to run builds

  • Manually: through API/gcloud
  • (Beta) Build Triggers: configurable through Google Cloud Console
  • (Alpha) Github App: builds automatically on changes to repo and pull requests

These can all be used independently or in combination with each other.

Upvotes: 1

Related Questions