【发布时间】:2019-12-04 13:31:18
【问题描述】:
我有一个 Codepipeline,它使用 ECS 蓝/绿部署操作将 ECR 映像部署到 ECS 集群。该管道包含两个源:一个用于使用 AWS ECR 操作的 ECR 映像,另一个用于使用第三方 Github 操作从 Github 获取配置。 ECR 操作输出 image 工件,而 Github 操作输出 config 工件。这两个工件都作为 ECS 蓝/绿部署操作的输入提供。
管道在 ECS 蓝/绿部署操作中失败,并出现以下错误(从 AWS 控制台可见):
动作配置无效
尝试从以下位置读取任务定义工件文件时出现异常:config
这是管道的结构(部分细节为匿名编辑):
$ aws codepipeline get-pipeline --name my-codepipeline
{
"pipeline": {
"name": "my-codepipeline",
"roleArn": "arn:aws:iam::123456789000:role/my-codepipeline-role",
"artifactStore": {
"type": "S3",
"location": "my-codepipeline-s3"
},
"stages": [
{
"name": "Source",
"actions": [
{
"name": "ImageSource",
"actionTypeId": {
"category": "Source",
"owner": "AWS",
"provider": "ECR",
"version": "1"
},
"runOrder": 1,
"configuration": {
"ImageTag": "latest",
"RepositoryName": "my-ecr"
},
"outputArtifacts": [
{
"name": "image"
}
],
"inputArtifacts": []
},
{
"name": "ConfigSource",
"actionTypeId": {
"category": "Source",
"owner": "ThirdParty",
"provider": "GitHub",
"version": "1"
},
"runOrder": 1,
"configuration": {
"Branch": "master",
"OAuthToken": "****",
"Owner": "me",
"PollForSourceChanges": "false",
"Repo": "application-config"
},
"outputArtifacts": [
{
"name": "config"
}
],
"inputArtifacts": []
}
]
},
{
"name": "Deploy",
"actions": [
{
"name": "DeployBackend",
"actionTypeId": {
"category": "Deploy",
"owner": "AWS",
"provider": "CodeDeployToECS",
"version": "1"
},
"runOrder": 1,
"configuration": {
"AppSpecTemplateArtifact": "config",
"AppSpecTemplatePath": "production/appspec.yaml",
"ApplicationName": "my-codedeploy",
"DeploymentGroupName": "my-codedeploy-group",
"Image1ArtifactName": "image",
"Image1ContainerName": "IMAGE_NAME",
"TaskDefinitionTemplateArtifact": "config",
"TaskDefinitionTemplatePath": "production/taskdef.json"
},
"outputArtifacts": [],
"inputArtifacts": [
{
"name": "image"
},
{
"name": "config"
}
]
}
]
}
],
"version": 1
},
"metadata": {
"pipelineArn": "arn:aws:codepipeline:ap-northeast-1:123456789000:my-codepipeline",
"created": 1564107543.285,
"updated": 1564107543.285
}
}
我检查了 S3 中的压缩工件,它肯定包含 Github 存储库中 AppSpecTemplatePath 和 TaskDefinitionTemplatePath 指定位置的配置文件。
这里是appspec.yaml的内容:
$ cat production/appspec.yaml
version: 0.0
Resources:
- TargetService:
Type: AWS::ECS::Service
Properties:
TaskDefinition: <TASK_DEFINITION>
LoadBalancerInfo:
ContainerName: "my-container"
ContainerPort: 80
【问题讨论】:
标签: amazon-web-services aws-codepipeline