This page describes how to create the delivery pipeline and targets that describe where and how Google Cloud Deploy will deploy your application. See Configuration file schema for a description of the YAML file structure for delivery pipelines and targets.
About the delivery pipeline and targets
After you create the delivery pipeline and target definition file or files, you
gcloud deploy apply against each of those files to register them as
Google Cloud Deploy resources.
Define the delivery pipeline and targets
The structure of the delivery pipeline and target configuration files is described here.
You can call this file anything you want. By convention, a delivery pipeline
config that includes target definitions is
clouddeploy.yaml, and one that instead references targets defined in
one or more separate files is named
Register the delivery pipeline and targets
To register your delivery pipeline with Google Cloud Deploy, you run
gcloud deploy apply once for each separate definition file. That is, if
you define three targets in three files, you would run the command four
times—once for the delivery pipeline, and once for each target.
The following command registers a delivery pipeline with its targets defined in the same file.
gcloud deploy apply --file=PIPELINE_CONFIG \ --region=LOCATION \ --project=PROJECT
You now have a delivery pipeline that can manage deployment of your releases, and target resources that can be used by any delivery pipeline in the same project and region.
A single-file example
The command in this example registers a delivery pipeline and targets that are all defined in the same file:
gcloud deploy apply --file=clouddeploy.yaml --region=us-central1
An example using separate files
For this example, there are three targets defined in three separate files, so you run four commands:
gcloud deploy apply --file=delivery-pipeline.yaml --region=us-central1 && \ gcloud deploy apply --file=target_dev.yaml --region=us-central1 && \ gcloud deploy apply --file=target_staging.yaml --region=us-central1 && \ gcloud deploy apply --file=target_prod.yaml --region=us-central1
--region flag is required unless you've set a default (using
config set deploy/region [REGION]). The region must be the same for the delivery
pipeline and all targets that pipeline references.
Create the delivery pipeline and targets using Terraform
Edit existing pipelines and targets
You can later edit any delivery pipeline or target config and run
deploy apply to update the pipeline or target resource. But those changes
do not affect any existing releases, as they are managed by the original
Require manual approval for a deployment
To require manual approval for a given target, include the following property on the target definition:
The default is
false. If you omit this property from the delivery-pipeline
config, or provide no value for it, deploying to this target doesn't require
approval. (But the caller trying to promote to the target still needs the
clouddeploy.rollouts.create IAM permission.)
You can even require manual approval on the first target. When a release is
created, using the CLI, for the first target, the
rollout is created
automatically. If approval is required, Google Cloud Deploy creates the
rollout, but in a pending-release state until approval is given.
See Deploying your application to find out how to invoke your delivery pipeline and create a release.