Cloud Build lets you create and manage connections to source code repositories using the Google Cloud console. You can create and manage connections using Cloud Build repositories (1st gen) or Cloud Build repositories (2nd gen). With Cloud Build repositories (2nd gen), you can additionally configure repositories programmatically without the Google Cloud console and independently without a trigger.
This page provides an overview of Cloud Build repositories: Cloud Build repositories (1st gen) and Cloud Build repositories (2nd gen).
Cloud Build repositories (1st gen)
Cloud Build repositories (1st gen) offers flexibility by enabling you to create connections to several source code management providers:
You can also build repositories from GitLab and Bitbucket Cloud using webhook events.
You must create a host connection prior to linking repositories when using the GitHub Enterprise, GitLab Enterprise Edition, Bitbucket Server, or Bitbucket Data Center integration.
You can create non-regional (global
) or regional triggers. You can also invoke
builds manually, on a
Pub/Sub topic,
or on an incoming webhook event.
Terraform support and connection setup using the gcloud
command-line tool
is not available for Cloud Build repositories (1st gen).
Cloud Build repositories (2nd gen)
With Cloud Build repositories (2nd gen), you can create and manage
repository connections programmatically. You can set up a single connection for
a repository and use authentication data from that connection to
programmatically set up additional connections across regions and projects. You
can also set up connections using Terraform, in addition to the
Google Cloud console, gcloud
command-line tool, and the API. You must create a
host connection prior to linking repositories when using Cloud Build
repositories (2nd gen).
Cloud Build repositories (2nd gen) can be used with the following providers:
You can invoke builds on commits and pull requests. You can also invoke builds manually, on a Pub/Sub topic, or on an incoming webhook event.
Cloud Build repositories (1st gen) and Cloud Build repositories (2nd gen)
The following table outlines capabilities associated with Cloud Build repositories (1st gen) and Cloud Build repositories (2nd gen).
Capabilities | Cloud Build repositories (1st gen) | Cloud Build repositories (2nd gen) |
---|---|---|
You can build in response to branch pushes, tag pushes, or pull request events. | Yes | Yes |
You can create a manual trigger | Yes | Yes |
You can create a Pub/Sub trigger | Yes | Yes |
You can create a webhook trigger | Yes | Yes |
You can create a single connection for a repository and use authentication from that connection to set up additional connections | No | Yes |
You can connect repositories from GitHub and GitHub Enterprise | Yes | Yes |
You can connect repositories from GitLab and GitLab Enterprise Edition | No | Yes |
You can connect repositories from Bitbucket Data Center and Bitbucket Server | Yes | No |
You can connect repositories from Cloud Source Repositories | Yes | No |
You can link repositories without creating a host connection | Yes | No |
You can create repository connections using gcloud | No | Yes |
You can create and automate repository connections using Terraform | No | Yes, except for Bitbucket Data Center and Bitbucket Cloud |
Your host connections and link repositories must exist in a particular region | No | Yes |
GitLab on Google Cloud
If you use GitLab as your source code repository, you can also use GitLab continuous integration (CI) and Google-managed GitLab CI/CD components in GitLab pipelines to build and deploy your workloads to Google Cloud.
Try the end-to-end tutorial for using GitLab with Google Cloud.
For more information, see the GitLab on Google Cloud overview.
What's next
- Learn how to connect a GitHub host and repository.
- Learn how to connect a GitHub Enterprise host.
- Learn how to connect a GitHub Enterprise repository.
- Learn how to connect a GitLab host.
- Learn how to connect a GitLab repository.
- Learn how to connect a GitLab Enterprise Edition host.
- Learn how to connect a GitLab Enterprise Edition repository.
- Learn how to manually build code in source repositories.
- Learn how to automate builds in response to webhook events.
- Learn how to automate builds in response to Pub/Sub events.