【发布时间】:2020-01-10 05:14:11
【问题描述】:
我正在使用集成到 CodePipeline 中的 CodeDeploy。我正在尝试将图像从 ecr 部署到 ecs。
整个基础架构都是使用 CloudFormation 构建的。
管道部署组的模板:
ApplicationName=cls.application.ApplicationName,
DeploymentGroupName='DeploymentGroup',
DeploymentConfigName='CodeDeployDefault.ECSAllAtOnce',
ServiceRoleArn=GetAtt(cls.role, 'Arn'),
AutoRollbackConfiguration={
'enabled': True,
'events': ['DEPLOYMENT_FAILURE', 'DEPLOYMENT_STOP_ON_ALARM', 'DEPLOYMENT_STOP_ON_REQUEST']
},
DeploymentStyle={
'deploymentType': 'BLUE_GREEN',
'deploymentOption': 'WITH_TRAFFIC_CONTROL'
},
BlueGreenDeploymentConfiguration={
'terminateBlueInstancesOnDeploymentSuccess': {
'action': 'TERMINATE',
'terminationWaitTimeInMinutes': 5
},
'deploymentReadyOption': {
'actionOnTimeout': 'CONTINUE_DEPLOYMENT',
},
},
LoadBalancerInfo= <Some irrelevant config>
EcsServices=[
{
'serviceName': 'WordpressService',
'clusterName': 'WordpressCluster'
},
]
到目前为止 - 配置看起来非常简单。 管道本身的配置包含 2 个阶段:
ArtifactStore=ArtifactStore(
Location='SomeS3Location',
Type='S3'
),
Name='WordpressPipeline',
RoleArn=GetAtt(cls.role, 'Arn'),
Stages=[
Stages(
Name='SourceStage',
Actions=[
Actions(
Name='SourceAction',
ActionTypeId=ActionTypeId(
Category='Source',
Owner='AWS',
Version='1',
Provider='ECR'
),
OutputArtifacts=[
OutputArtifacts(
Name='SourceOutput'
)
],
Configuration={
'RepositoryName':'SomeECR'
},
RunOrder='1'
)
]
),
Stages(
Name='DeployStage',
Actions=[
Actions(
Name='DeployAction',
ActionTypeId=ActionTypeId(
Category='Deploy',
Owner='AWS',
Version='1',
Provider='CodeDeploy'
),
InputArtifacts=[
InputArtifacts(
Name='SourceOutput'
)
],
Configuration={
'ApplicationName': 'MyApp',
'DeploymentGroupName': 'MyGroup'
},
RunOrder='1'
)
]
)
]
附:不要介意语法。我正在使用 Troposphere 创建 CloudFormation 模板。
首先,CloudFormation模板运行成功。
其次,从 ECR 采购成功。
第三,部署失败并显示消息:
部署指定修订是一个空文件,但是 提供的修订版是一个 zip 文件。
你知道问题出在哪里吗?
提前谢谢你。
【问题讨论】:
标签: amazon-web-services amazon-cloudformation amazon-ecs aws-code-deploy amazon-ecr