Configuring Pub/Sub notifications

You can receive notifications of changes to your Google Cloud repositories by using Pub/Sub. These notifications inform you when a user creates a new repository, deletes a repository, or pushes a change to an existing repository. You can choose to configure notifications for specific repositories or across an entire Google Cloud project.

To learn more about Pub/Sub, see What is Pub/Sub?

Before you begin

  • If you haven't already done so, create a repository.
  • Verify that you have the appropriate permissions to create topics and subscriptions. For more information, see Access control.
  • Ensure you have a service account that can publish to your topic. By default, Cloud Source Repositories uses the Compute Engine default service account to publish messages. For more information, see Pub/Sub notifications for Cloud Source Repositories.

Create a Pub/Sub topic

For each Cloud Source Repositories project or repository for which you'd like notifications, you need to create a Pub/Sub topic. You can create a topic using either the Google Cloud console or the gcloud command-line tool.

When you create a topic, you need to use a qualified URI for your repository. The qualified URI is:

projects/[PROJECT_ID]/topics/[TOPIC_NAME]

Where:

  • [PROJECT_ID] is your Google Cloud project ID.
  • [TOPIC_NAME] is the name of the topic.

To create a topic, follow these steps.

Console

  1. In the Google Cloud console, go to the Pub/Sub Topics page.

    Go to the Topics page

  2. Click