AWS::CodePipeline::Pipeline - AWS CloudFormation
AWS 文档中描述的 AWS 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅中国的 AWS 服务入门

AWS::CodePipeline::Pipeline

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

语法

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

JSON

{ "Type" : "AWS::CodePipeline::Pipeline", "Properties" : { "ArtifactStore" : ArtifactStore, "ArtifactStores" : [ ArtifactStoreMap, ... ], "DisableInboundStageTransitions" : [ StageTransition, ... ], "Name" : String, "RestartExecutionOnUpdate" : Boolean, "RoleArn" : String, "Stages" : [ StageDeclaration, ... ], "Tags" : [ Tag, ... ] } }

属性

ArtifactStore

用于存储管道的构件的 S3 存储桶。

注意

您必须在管道中包含 artifactStoreartifactStores,而不能同时使用两者。如果在管道中创建跨区域操作,则必须使用 artifactStores

必需:条件

类型ArtifactStore

Update requires: No interruption

ArtifactStores

artifactStore 对象及其相应 AWS 区域的映射。管道区域以及管道中的每个跨区域操作必须具有一个构件存储。

注意

您必须在管道中包含 artifactStoreartifactStores,而不能同时使用两者。如果在管道中创建跨区域操作,则必须使用 artifactStores

必需:条件

类型ArtifactStoreMap 的列表

Update requires: No interruption

DisableInboundStageTransitions

表示 DisableStageTransition 操作的输入。

必需:否

类型StageTransition 的列表

Update requires: No interruption

Name

管道的名称。

必需:否

类型:字符串

最低1

最高100

模式[A-Za-z0-9.@\-_]+

Update requires: Replacement

RestartExecutionOnUpdate

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

必需:否

类型:布尔值

Update requires: No interruption

RoleArn

用于在没有 actionRoleArn 的情况下执行操作,或在有 actionRoleArn 的情况下为操作代入角色的 AWS CodePipeline 的 Amazon 资源名称 (ARN)。

必需:是

类型:字符串

最高1024

模式arn:aws(-[\w]+)*:iam::[0-9]{12}:role/.*

Update requires: No interruption

Stages

表示有关阶段及其定义的信息。

必需:是

类型StageDeclaration 的列表

Update requires: No interruption

Tags

指定应用于管道的标签。

必需:否

类型Tag 的列表

Update requires: No interruption

返回值

Ref

在将此资源的逻辑 ID 传递给内部 Ref 函数时,Ref 返回管道名称,例如 mysta-MyPipeline-A1BCDEFGHIJ2。

For more information about using the Ref function, see Ref.

Fn::GetAtt

Fn::GetAtt 内部函数返回此类型的一个指定属性的值。以下为可用属性和示例返回值。

有关使用 Fn::GetAtt 内部函数的更多信息,请参阅 Fn::GetAtt

Version

管道的版本。

注意

新管道始终分配版本号 1。此编号随管道的更新而增长。

示例

Pipeline 资源配置

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

JSON

"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" }, "EncryptionKey": { "Id": "arn:aws:kms:useast-1:ACCOUNT-ID:key/KEY-ID", "Type": "KMS" }, "DisableInboundStageTransitions": [ { "StageName": "Release", "Reason": "Disabling the transition until integration tests are completed" } ], "Tags": [ { "Key": "Project", "Value": "ProjectA" }, { "Key": "IsContainerBased", "Value": "true" } ] } }

YAML

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 EncryptionKey: Id: arn:aws:kms:useast-1:ACCOUNT-ID:key/KEY-ID Type: KMS DisableInboundStageTransitions: - StageName: Release Reason: "Disabling the transition until integration tests are completed" Tags: - Key: Project Value: ProjectA - Key: IsContainerBased Value: 'true'