Regionalized CSR instances

This document describes the feature set and user experience changes between the public version of Cloud Source Repositories (CSR) and the release of regionalized CSR instances for CONSIP. It supplements but does not replace the Cloud Source Repositories public documentation.

The regionalized CSR instances feature is available only to select customers.

Terminology

CSR: Cloud Source Repositories.

Regionalized CSR instance: An instance of Cloud Source Repositories that is running in a designated region. An instance may have one or more repositories.

Regionalized CSR instances

A regionalized CSR instance is an instance of Cloud Source Repositories that is running in one designated region. This instance can have one or more repositories, all of which are in the same region.

You can activate one regionalized CSR instance in a Google Cloud project. To create repositories in multiple regions, use a different project for each region.

Supported regions are:

  • europe-central2
  • europe-west3
  • europe-west4

Before you begin

  1. Ensure that you have a Google Cloud organization and have created the projects that will use regionalized CSR instances.
    • Ensure that the organization and its projects do not have any repositories in Cloud Source Repositories.
    • For clarity, you may want to add the region you will use to the name of your project. For example, you could name a project csr-europe-central2.
  2. You can now activate regionalized CSR instances, and continue the following steps while you wait to hear that the regionalized CSR instances have been activated.
  3. Make sure that billing is enabled for your projects. Learn how to confirm that billing is enabled for your project.
  4. Install and initialize the Cloud SDK.
  5. Verify that you have the latest version of Git.
  6. Enable the Cloud Source Repositories API.

    Enable the Cloud Source Repositories API

Activating regionalized CSR instances

Regionalized CSR instances must be activated in your organization before you create any regionalized repositories.

Regionalized CSR instances are a private preview offering and available only to select customers.

To activate regionalized CSR instances:

  1. Contact your Google Cloud account representative or Customer Engineer.

  2. Provide them with the following information:

    • The organization ID for the organization for which you are activating regionalized CSR instances. Ensure that the organization and its projects do not have any repositories in Cloud Source Repositories.
    • The project ID where your repositories will be created. The project must be part of the organization above.
    • The region you will use for the project. You can specify one region for each project. You can use multiple regions by using multiple projects. Supported regions are:

      • europe-central2
      • europe-west3
      • europe-west4

Your Google Cloud account representative will notify you when regionalized CSR instances has been activated in a project.

If your organization had existing repositories in Cloud Source Repositories before you activated regionalized CSR instances, these repositories will be deleted.

Once a regionalized CSR instance has been created in a project, you cannot change its region. If you want to use a different region, create a new project and follow the steps above to activate a regionalized CSR instance in the desired region.

If you are unfamiliar with Cloud Source Repositories, you may want to try Quickstart: Create a repository.

Creating regionalized repositories

After the regionalized CSR instance is activated in a project, you can create a new empty regionalized repository.

All new repositories created in the project will be created in the region that you specified when you activated the regionalized CSR instance. You cannot change the region. If multiple projects exist, it is possible to filter projects by region when creating a new repository.

Creating a repository is useful when you want to start a project or back up a Git repository using Cloud Source Repositories.

Before you begin

Before creating a new repository, verify that you have completed the prerequisite steps including enabling the Cloud Source Repositories API.

Create a new repository

You can create a repository by using either the Google Cloud Console or the gcloud command-line tool.

Console

  1. In the Cloud Console, open Cloud Source Repositories.

    Open Cloud Source Repositories

  2. Click Add repository.

    The Add a repository page opens.

  3. Select Create new repository and click Continue.

    The Create new repository page opens.

  4. In the Repository name field, type a name for the new repository. Note that the names All-Users and All-Projects are restricted names and cannot be used.

  5. In the Region field use the drop down menu to select the desired region for the new repository.

  6. In the Project drop-down list, select the Google Cloud project the repository will belong to. Note that only projects in the selected region will be displayed.

  7. Click Create.

    Your repository is created, and the Add code to your repository page opens. This page provides instructions on how to clone the repository to your local machine or push code from an existing repository based on your authentication type.

gcloud

  1. From the command line, call:

    gcloud init
    gcloud source repos create REPO_NAME --project=PROJECT_ID
    

    Where:

    REPO_NAME is the name for your repository. Note that the names All-Users and All-Projects are restricted names and cannot be used.

    PROJECT_ID is the ID of the regionalized project that the repository will belong to. See your administrator or create a repository using the Cloud Console for a list of projects associated with the desired region.

Viewing a repository's region

After you create a regionalized repository, its region is listed next to the repository name in the console. For example, in the following image, the repository's region is europe-west3 and its name is region-test11.

Screenshot of a repository

Mirroring external repositories

You can mirror external repositories such as GitHub or Bitbucket to a regionalized repository. However, to support mirroring, Cloud Source Repositories stores private credentials to the external repository (such as GitHub or Bitbucket). This data is not regionalized.

If you're concerned about regionalization of credentials to external repositories, do not mirror the repositories into Cloud Source Repositories. Unlike credentials, mirrored source code is stored in the region selected for the repository.

Authentication

To authenticate, see Setting up local authentication. If you authenticate using SSH keys, see the following section.

SSH Keys

You can use SSH public key authentication to access repositories in Cloud Source Repositories.

For regionalized repositories, when you register a public key you need to specify the region in which to store the key. To register a public key:

  1. In the Cloud Console, open the Manage SSH Keys page.

    Open Cloud Source Repositories

  2. Click Register SSH key.

    The Register SSH Key dialog opens.

  3. In the Key name field, type a unique name for the key.

  4. In the Key field, copy the key string from your public key file.

  5. In the Region field, select one region in which to store the key. This region must be the same as the region you activated in the Activating a Regionalized CSR Instance section.

  6. Click Register.

You must register a key for each region where your repositories exist.

These keys are associated with the user who added the key, not associated with the repositories. If you are using the same key for repositories in different regions, you need to follow the steps above to register it for each region.

Other Google Cloud services

The following services are used by Cloud Source Repositories and support regionalization. See their documentation for more information on how to set up regionalization.

What's next