Delivery pipeline configuration

The pipeline configuration file defines the Google Cloud Deploy delivery pipeline, the targets to deploy to, and the progression of those targets.

Structure of a delivery pipeline configuration file

The main configuration file for Google Cloud Deploy is the delivery pipeline config. By convention, this file is called clouddeploy.yaml, but you can follow your organization's conventions, or give it any name you want.

The following configuration includes the target definition:

    apiVersion: deploy.cloud.google.com/v1beta1
    kind: DeliveryPipeline
    metadata:
     name:
     annotations:
     labels:
    description:
    serialPipeline:
     stages:
     - targetId:
       profiles: []
     - targetId:
       profiles: []
     ---

     apiVersion: deploy.cloud.google.com/v1beta1
     kind: Target
     metadata:
      name:
      annotations:
      labels:
     description:
     requireApproval:
     gke:
      cluster: projects/[project_name]/locations/[location]/clusters/[cluster_name]

     executionConfigs:
     - privatePool:
         workerPool:
         serviceAccount:
         artifactStorage:
       usages:
       - [RENDER | DEPLOY]
     - defaultPool:
         serviceAccount:
         artifactStorage:
       usages:
       - [RENDER | DEPLOY]

     ---

This YAML has two main components:

  • The main delivery pipeline and progression

    The configuration file can include any number of pipeline definitions.

  • The target definitions

    For simplicity, only one target is shown in this example, but there can be any number of them. Also, targets can be defined in a separate file or files.

These components are defined in the rest of this document.

Pipeline definition and progression

In addition to pipeline metadata, such as name, the main pipeline definition includes a listing of all targets in deployment sequence order. That is, the first target listed is the first deployment target. After you've deployed to that target, and promote the release, Google Cloud Deploy deploys to the next target in the list.

metadata.name

The name field takes a string that must be unique per project and location.

metadata.annotations and metadata.labels

Delivery pipeline configuration supports Kubernetes annotations and labels, but Google Cloud Deploy does not require them.

Annotations and labels are stored with the delivery pipeline resource.

description

An arbitrary string describing this delivery pipeline. This description is shown in the delivery pipeline details in Google Cloud Console.

stages

A list of all targets to which this delivery pipeline is configured to deploy.

The list must be in the order of the delivery sequence you want. For example, if you have targets called dev, staging, and production, list them in that same order, so that your first deployment is to dev, and your final deployment is into production.

Populate each stages.targetId field with the value of the metadata.name field in the corresponding target definition. And under targetId, include profiles:

serialPipeline:
 stages:
 - targetId:
   profiles: []

targetId:

Identifies the specific target to use for this stage of the delivery pipeline. The value is the metadata.name property from the target definition.

profiles

Takes a list of zero or more Skaffold profile names, from skaffold.yaml. Google Cloud Deploy uses the profile with skaffold render when creating the release. Skaffold profiles let you vary configuration between targets while using a single configuration file.

Target definitions

The delivery pipeline definition file can contain target definitions, or you can specify targets in a separate file. You can repeat Target names within a project, but they must be unique within a delivery pipeline.

You can reuse targets among multiple delivery pipelines. However, you can only reference a target once from within a single delivery pipeline's progression.

     apiVersion: deploy.cloud.google.com/v1beta1
     kind: Target
     metadata:
      name:
      annotations:
      labels:
     description:
     requireApproval:
     gke:
      cluster: projects/[project_name]/locations/[location]/clusters/[cluster_name]

     executionConfigs:
     - privatePool:
         workerPool:
         serviceAccount:
         artifactStorage:
       usages:
       - [RENDER | DEPLOY]
     - defaultPool:
         serviceAccount:
         artifactStorage:
       usages:
       - [RENDER | DEPLOY]

metadata.name

The name of this target. This name must be globally unique.

metadata.annotations and metadata.labels

Target configuration supports Kubernetes annotations and labels, but Google Cloud Deploy does not require them.

Annotations and labels are stored with the target resource.

description

This field takes an arbitrary string that describes the use of this target.

requireApproval

Whether promotion to this target requires manual approval. Can be true or false.

This property is optional. The default is false.

gke

The resource path identifying the cluster where your application is deployed:

gke:
  cluster: projects/[project_name]/locations/[location]/clusters/[cluster_name]
  • project_name

    The Google Cloud project in which the cluster lives.

  • location

    The location where the cluster lives. For example, us-central1. The cluster can also be zonal (us-central1-c).

  • cluster_name

    The name of the cluster, as it appears in your list of clusters in Google Cloud Console.

Here's an example:

gke:
  cluster: projects/cd-demo-01/locations/us-central1/clusters/prod

executionConfigs

A set of fields to specify a non-default execution environment for this target.

  • privatePool | defaultPool

    Configuration for the worker pool to use, whether it's a private pool or the default pool. A given target can have both (one for RENDER and one for DEPLOY). When configuring a defaultPool, you can specify an alternate service account or storage location or both.

    If you're configuring defaultPool to set the usages (RENDER | DEPLOY), and not an alternate service account or storage location, include empty braces: defaultPool {}.

    • workerPool

      A resource path identifying the Cloud Build private worker pool to use for this target. For example:

      projects/p123/locations/us-central1/workerPools/wp123.

      Omit this property if you're configuring service account or storage for the defaultPool. This property is required for privatePool, and is omitted for defaultPool.

    • serviceAccount

      The name of the service account to use for this operation for this target.

    • artifactStorage

      The Cloud Storage bucket to use, instead of the default bucket, for this operation for this target.

  • usages

    Either RENDER or DEPLOY or both, indicating which of those operations to perform for this target using this execution environment. To indicate that a custom execution environment is to be used for both rendering and deployment, you would configure it as follows:

    usages:
    - RENDER
    - DEPLOY
    

What's next