AWS CloudFormation
User Guide (API Version 2010-05-15)
AWS 服务或AWS文档中描述的功能,可能因地区/位置而异。请点击 Amazon AWS 入门,可查看中国地区的具体差异

AWS::CodePipeline::Pipeline

AWS::CodePipeline::Pipeline 资源创建一个 AWS CodePipeline 管道,用于描述软件在发布过程中的变更。有关更多信息,请参阅什么是 AWS CodePipeline?(在 AWS CodePipeline 用户指南 中)。

语法

要在 AWS CloudFormation 模板中声明此实体,请使用以下语法:

JSON

Copy
{ "Type" : "AWS::CodePipeline::Pipeline", "Properties" : { "ArtifactStore" : ArtifactStore, "DisableInboundStageTransitions" : [ DisableInboundStageTransitions, ... ], "Name" : String, "RestartExecutionOnUpdate" : Boolean, "RoleArn" : String, "Stages" : [ Stages, ... ] } }

YAML

Copy
Type: "AWS::CodePipeline::Pipeline" Properties: ArtifactStore: ArtifactStore DisableInboundStageTransitions: - DisableInboundStageTransitions Name: String RestartExecutionOnUpdate: Boolean RoleArn: String Stages: - Stages

属性

ArtifactStore

AWS CodePipeline 存储管道项目的 Amazon Simple Storage Service (Amazon S3) 位置。有关更多信息,请参阅 AWS CodePipeline 用户指南 中的为您的应用程序创建 Amazon S3 存储桶

Required: Yes

Type: AWS CodePipeline Pipeline ArtifactStore

更新要求无需中断

DisableInboundStageTransitions

防止管道中的项目转换到您指定的阶段。这让您能够手动控制转换。

Required: No

Type: AWS CodePipeline Pipeline DisableInboundStageTransitions 列表

更新要求无需中断

Name

AWS CodePipeline 管道的名称。

Required: No

Type: String

更新要求替换

RestartExecutionOnUpdate

指示在您更新 AWS CodePipeline 管道后是否重新运行管道。

Required: No

Type: Boolean

更新要求无需中断

RoleArn

服务角色 Amazon 资源名称 (ARN)(用于授予 AWS CodePipeline 代您调用 AWS 产品的权限)。有关更多信息,请参阅 AWS CodePipeline 用户指南 中的 AWS CodePipeline 访问权限参考

Required: Yes

Type: String

更新要求无需中断

Stages

定义 AWS CodePipeline 管道阶段。

Required: Yes

Type: AWS CodePipeline 管道阶段

更新要求无需中断

返回值

Ref

当您将 AWS::CodePipeline::Pipeline 资源的逻辑 ID 传递给内部函数 Ref 时,该函数返回管道名称,例如 mysta-MyPipeline-A1BCDEFGHIJ2

有关使用 Ref 功能的更多信息,请参阅参考

示例

下面的示例将创建一个具有源代码、测试和发布阶段的管道。对于源代码阶段,AWS CodePipeline 会检测对存储在 S3 存储桶中的应用程序所做的变更并将它们拉入管道。测试阶段使用 AWS CodeDeploy 将这些变更部署到 EC2 实例。对于发布阶段,入站转换将禁用,以便您能够控制将变更部署到发布版本的时机。

JSON

Copy
"AppPipeline": { "Type": "AWS::CodePipeline::Pipeline", "Properties": { "RoleArn": { "Ref" : "CodePipelineServiceRole" }, "Stages": [ { "Name": "Source", "Actions": [ { "Name": "SourceAction", "ActionTypeId": { "Category": "Source", "Owner": "AWS", "Version": "1", "Provider": "S3" }, "OutputArtifacts": [ { "Name": "SourceOutput" } ], "Configuration": { "S3Bucket": { "Ref" : "SourceS3Bucket" }, "S3ObjectKey": { "Ref" : "SourceS3ObjectKey" } }, "RunOrder": 1 } ] }, { "Name": "Beta", "Actions": [ { "Name": "BetaAction", "InputArtifacts": [ { "Name": "SourceOutput" } ], "ActionTypeId": { "Category": "Deploy", "Owner": "AWS", "Version": "1", "Provider": "CodeDeploy" }, "Configuration": { "ApplicationName": {"Ref" : "ApplicationName"}, "DeploymentGroupName": {"Ref" : "DeploymentGroupName"} }, "RunOrder": 1 } ] }, { "Name": "Release", "Actions": [ { "Name": "ReleaseAction", "InputArtifacts": [ { "Name": "SourceOutput" } ], "ActionTypeId": { "Category": "Deploy", "Owner": "AWS", "Version": "1", "Provider": "CodeDeploy" }, "Configuration": { "ApplicationName": {"Ref" : "ApplicationName"}, "DeploymentGroupName": {"Ref" : "DeploymentGroupName"} }, "RunOrder": 1 } ] } ], "ArtifactStore": { "Type": "S3", "Location": { "Ref" : "ArtifactStoreS3Location" } }, "DisableInboundStageTransitions": [ { "StageName": "Release", "Reason": "Disabling the transition until integration tests are completed" } ] } }

YAML

Copy
AppPipeline: Type: "AWS::CodePipeline::Pipeline" Properties: RoleArn: Ref: CodePipelineServiceRole Stages: - Name: Source Actions: - Name: SourceAction ActionTypeId: Category: Source Owner: AWS Version: 1 Provider: S3 OutputArtifacts: - Name: SourceOutput Configuration: S3Bucket: Ref: SourceS3Bucket S3ObjectKey: Ref: SourceS3ObjectKey RunOrder: 1 - Name: Beta Actions: - Name: BetaAction InputArtifacts: - Name: SourceOutput ActionTypeId: Category: Deploy Owner: AWS Version: 1 Provider: CodeDeploy Configuration: ApplicationName: Ref: ApplicationName DeploymentGroupName: Ref: DeploymentGroupName RunOrder: 1 - Name: Release Actions: - Name: ReleaseAction InputArtifacts: - Name: SourceOutput ActionTypeId: Category: Deploy Owner: AWS Version: 1 Provider: CodeDeploy Configuration: ApplicationName: Ref: ApplicationName DeploymentGroupName: Ref: DeploymentGroupName RunOrder: 1 ArtifactStore: Type: S3 Location: Ref: ArtifactStoreS3Location DisableInboundStageTransitions: - StageName: Release Reason: "Disabling the transition until integration tests are completed"

本页内容: