[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-09-03。"],[[["\u003cp\u003eA delivery pipeline describes a progression of deployment targets, which can be defined in the same file or in separate files.\u003c/p\u003e\n"],["\u003cp\u003eTo register a delivery pipeline and its targets, use the \u003ccode\u003egcloud deploy apply\u003c/code\u003e command for each definition file.\u003c/p\u003e\n"],["\u003cp\u003eDelivery pipelines and targets can be created via the Google Cloud console (for non-production use), \u003ccode\u003egcloud\u003c/code\u003e commands, or Terraform.\u003c/p\u003e\n"],["\u003cp\u003eTargets can be configured to require manual approval before deployment by setting the \u003ccode\u003erequireApproval: true\u003c/code\u003e property.\u003c/p\u003e\n"],["\u003cp\u003eWhile you can edit existing delivery pipelines and target configurations, changes will not affect any previous or existing releases.\u003c/p\u003e\n"]]],[],null,["# Create your delivery pipeline and targets\n\nThis page describes how to create the delivery pipeline and targets that\ndescribe where and how Cloud Deploy will deploy your application. See\n[Configuration file schema](/deploy/docs/config-files) for a description of the\nYAML file structure for delivery pipelines and targets.\n\nAbout the delivery pipeline and targets\n---------------------------------------\n\nYour delivery pipeline describes a [progression](/deploy/docs/terminology#progression)\nof deployment [targets](/deploy/docs/terminology#target). You can define those\ntargets in the same file as the delivery pipeline or in one or more separate\nfiles.\n\nAfter you create the delivery pipeline and target definition file or files, you\nrun `gcloud deploy apply` against each of those files to register them as\nCloud Deploy resources.\n\nDefine the delivery pipeline and targets\n----------------------------------------\n\nThe structure of the delivery pipeline and target configuration files is\ndescribed [here](/deploy/docs/config-files).\n\nYou can call this file anything you want. By convention, a delivery pipeline\nconfig that *includes* [target](/deploy/docs/terminology#target) definitions is\ncalled `clouddeploy.yaml`, and one that instead references targets defined in\none or more separate files is named `delivery-pipeline.yaml`.\n\nThe target can point to [GKE](/deploy/docs/config-files#for_gke_targets),\n[GKE Enterprise](/deploy/docs/config-files#for_anthos_targets),\nor [Cloud Run](/deploy/docs/config-files#for_run_targets). Within a\ndelivery pipeline, all targets must reference the same runtime type (all\nGKE, or all GKE Enterprise, for example).\n\nCreate a delivery pipeline and targets using the Google Cloud console\n---------------------------------------------------------------------\n\nYou can use the Google Cloud console to create a new delivery pipeline and\ntarget or targets. This is useful for trying out Cloud Deploy, but\nis not suitable for production workloads. (You can also use the\nGoogle Cloud console to\n[create a release](/deploy/docs/deploying-application#create_pipeline_in_ui).)\n\nTo create the delivery pipeline:\n\n1. From the **Delivery pipelines** page, click **Create**.\n\n2. Provide a name (or keep the default) and, optionally, a description.\n\n3. Select your region.\n\n4. Choose your runtime environment.\n\n For GKE, choose **Google Kubernetes Engine** , or select\n **Cloud Run** if that's the runtime you're deploying to.\n5. Under **New target**, provide a name (or keep the default).\n\n6. If you want to require\n [approval](/deploy/docs/promote-release#manage_approvals_for_a_delivery_pipeline)\n on this target, select the **Require approval for rollouts** checkbox.\n\n7. If you're going to use a\n [canary deployment strategy](/deploy/docs/deployment-strategies/canary) on this\n target, select the **Enable canary** checkbox.\n\n | **Note:** You can enable canary here for Cloud Run only. For GKE, you need to configure it as described in [Canary deployments](/deploy/docs/deployment-strategies/canary).\n8. Click **Done**.\n\n9. Click **Add target** and follow these steps for each additional target you\n want to create.\n\n10. When you have all your targets, click **Create** to create the delivery\n pipeline and target resources.\n\nRegister the delivery pipeline and targets\n------------------------------------------\n\n**If you created your pipeline and targets using the Google Cloud console,\nyou don't need to do this.**\n\nTo register your delivery pipeline with Cloud Deploy, you run\n`gcloud deploy apply` once for each separate definition file. That is, if\nyou define three targets in three files, you would run the command four\ntimes---once for the delivery pipeline, and once for each target.\n\nThe following command registers a delivery pipeline with its targets defined in\nthe same file. \n\n gcloud deploy apply --file=\u003cvar label=\"pipeline config\" translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003ePIPELINE_CONFIG\u003c/span\u003e\u003c/var\u003e \\\n --region=\u003cvar label=\"location\" translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eLOCATION\u003c/span\u003e\u003c/var\u003e \\\n --project=\u003cvar label=\"project\" translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003ePROJECT\u003c/span\u003e\u003c/var\u003e\n\nYou now have a delivery pipeline that can manage deployment of your releases,\nand target resources that can be used by any delivery pipeline in the same\nproject and region.\n\n### A single-file example\n\nThe command in this example registers a delivery pipeline and targets that are\nall defined in the same file: \n\n gcloud deploy apply --file=clouddeploy.yaml --region=us-central1\n\n### An example using separate files\n\nFor this example, there are three targets defined in three separate files, so\nyou run four commands: \n\n gcloud deploy apply --file=delivery-pipeline.yaml --region=us-central1 && \\\n gcloud deploy apply --file=target_dev.yaml --region=us-central1 && \\\n gcloud deploy apply --file=target_staging.yaml --region=us-central1 && \\\n gcloud deploy apply --file=target_prod.yaml --region=us-central1\n\nThe `--region` flag is required unless you've set a default (using `gcloud\nconfig set deploy/region [REGION]`). The region must be the same for the delivery\npipeline and all targets that pipeline references.\n\nCreate the delivery pipeline and targets using Terraform\n--------------------------------------------------------\n\nYou can also use the\n[Google Cloud Terraform provider](https://registry.terraform.io/providers/hashicorp/google/latest/docs)\nto create [delivery pipeline](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/clouddeploy_delivery_pipeline)\nand [target](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/clouddeploy_target)\nresources.\n\nThe [Google Cloud beta Terraform provider](https://registry.terraform.io/providers/hashicorp/google-beta/latest/docs)\nmay include support for Cloud Deploy features in\n[Preview](/products#product-launch-stages).\n\nEdit existing pipelines and targets\n-----------------------------------\n\nYou can later edit any delivery pipeline or target config and run `gcloud\ndeploy apply` to update the pipeline or target resource. But those changes\n[do not affect any existing releases, as they are managed by the original\ndelivery pipeline](/deploy/docs/pipeline-instances).\n\nRequire manual approval for a deployment\n----------------------------------------\n\nTo require manual approval for a given target, include the following property on\nthe [target definition](/deploy/docs/config-files#target_definitions):\n\n`requireApproval: true`\n\nThe default is `false`. If you omit this property from the delivery-pipeline\nconfig, or provide no value for it, deploying to this target doesn't require\napproval. (But the caller trying to promote to the target still needs the\n`clouddeploy.rollouts.create` IAM permission.)\n\nYou can even require manual approval on the first target. When a release is\ncreated, using the CLI, for the first target, the `rollout` is created\nautomatically. If approval is required, Cloud Deploy creates the\n`rollout`, but in a pending-release state until approval is given.\n\nWhat's next\n-----------\n\n- [Create your Skaffold configuration](/deploy/docs/using-skaffold/getting-started-skaffold).\n\n- See [Deploying your application](/deploy/docs/deploying-application)\n to find out how to invoke your delivery pipeline and create a release."]]