The Sourcegraph Managed Services Platform (MSP) integrates with GCP Cloud Deploy to provision a delivery and rollout pipeline for services. The pipeline can be composed of one or more stages. When a new version of your service is built it is deployed to the first stage of the pipeline and can be manually promoted to the next stage(s). As such if your service is composed of development and production environments; new versions can be continuously delivered to development and manually promoted to production after they have been tested.

Untitled

If you have any questions or need assistance, please reach out to #discuss-core-services!

Configuring rollouts

Configuring rollouts requires making changes to the MSP specifiction for a service and to your CI pipeline which builds and publishes Docker images for your service. For any configuration help reach out in #discuss-core-services.

MSP specification

To configure rollouts for a service a top-level rollout object defines the stages (environments) and the order through which releases progress. Each service included in the rollout must specify a deploy.type of rollout.

Below is a simplified MSP specification detailing the required configuration to use Cloud Deploy.

service:
  id: msp-example
  # ...
build:
  # ...

# Rollout configures how releases should roll out through a set of environments.
rollout:
  # Stages specifies the order and environments through which releases progress.
  stages:
    - environment: development
    - environment: production
  # ServiceAccount is the email address of the service account to provision IAM access to create releases. Can be used to give access to the Service Account used in your CI pipeline
  serviceAccount: [email protected]

environments:
  - id: development
    projectID: msp-example-development-0000
    category: test
    deploy:
      type: rollout
    # ...

  - id: production
    projectID: msp-example-production-0000
    category: external
    deploy:
      type: rollout
    # ...

CI configuration

Note: The recommended CI configuration is subject to change as improvements are made to simplify the process. Any improvements should not break existing configurations

Buildkite

In the sourcegraph/sourcegraph monorepo using Buildkite & Bazel the msp_delivery Bazel rule can be used.

msp_delivery(
    name = "msp_deploy",
    gcp_project = "msp-example-production-0000",
    msp_service_id = "msp-example",
    repository = "us.gcr.io/sourcegraph-dev/msp-example",
)

The following must be modifed to match your service:

The Bazel rule must be specified in the same BUILD.bazel file which includes the oci_push rule named candidate_push for your service.