Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

CloudBuild connection with Gerrit git repo

I created a cloudbuild pubsub trigger.

It looks like there is no way to specify Source to my Gerrit git repo and there is no way to pass Pubsub message to initial build step script.

Is there a way?

Thanks,

Seyoung

0 5 920
5 REPLIES 5

Have you tried using the following plugin?

Gerrit event producer and consumer for GCloud PubSub

Build

Information on how to build this plugin can be found here.

Configuration

Information on how to configure this plugin can be found here.

Yes I am already using the plugin. Gerrit stream evens are being published on a pubsub topic.

The problem I'm having is setting up a pubsub CloudBuild trigger.
1. Source
Trigger Source selection menu has githubs, bit buckets, etc, but no Gerrit or generic git repo.
2. Passing pubsub message head and payload as parameter to pipeline script.

To use Git as a Source Repository in Cloud Build, you can sync your Git repository with Cloud Source Repositories.

Cloud Source Repositories are private Git repositories hosted on Google Cloud. These repositories let you develop and deploy an app or service in a space that provides collaboration and version control for your code.

First, you need to create an empty repository in Cloud Source Repositories.

Then, you can push your code from an existing repository on your local machine to Cloud Source Repositories.

Finally, you can choose the repository in Cloud Source Repositories when creating a Cloud Build trigger

See also:

I want to trigger based on Gerrit event payload contents. I think event from synced Cloud Source Repositories lose information in Gerrit event payload.
Event occurred and stored in Gerrit, and published to Pubsub and delivered to Cloudbuild.
Synching Gerrit repo to Cloud Source Repository and Event message delivery via pubsub might have racing condition.

The suggested solution does not work to use CloudBuild as corporate monorepo CICD backend with Code Review tool.

1. The unit of build event is CL patch set.
2. Backend build/test tool should return CL patchset build/test/coverage/lint results to Code Review for display on demand.
3. For Gerrit, a CL patch is a dynamically generated branch.

A CloudBuild trigger is a fixed git branch build trigger that cannot return build/test results in code review tool expected format.
The UI assumes one repo per one service or product and does not support a monorepo that contains lots of inter-dependent services and products.

I know that Google internally has build tool that supports corporate grade monorepo with code review tool. What is the reason to provide more than a decade old Jenkins like primitive build tool, and has less extensions than Jenkins as a cloud build tool for GCP customers?