Amazon web services 带有ECS蓝/绿部署的AWS代码管道失败,出现内部错误| take 2

Amazon web services 带有ECS蓝/绿部署的AWS代码管道失败,出现内部错误| take 2,amazon-web-services,amazon-ecs,aws-code-deploy,aws-codepipeline,blue-green-deployment,Amazon Web Services,Amazon Ecs,Aws Code Deploy,Aws Codepipeline,Blue Green Deployment,首先,我知道有一个类似的问题,但是回答的人没有提供足够的细节 根据这个答案:。。我已经阅读了aws指南:。。。确保所有必需字段都在下面的my taskdef.json中 至于我的管道构建规范 管道构建阶段的设置很简单,我只是将BuildArtifact设置为输出。因此,我可以从管道部署阶段引用imageDetail.json 至于我的管道部署AppSpec 管道部署阶段设置如下所示: 输入工件:BuildArtifact、SourceArtifact;然后: Amazon ECS任务定义:Sou

首先,我知道有一个类似的问题,但是回答的人没有提供足够的细节

根据这个答案:。。我已经阅读了aws指南:。。。确保所有必需字段都在下面的my taskdef.json中

至于我的管道构建规范

管道构建阶段的设置很简单,我只是将BuildArtifact设置为输出。因此,我可以从管道部署阶段引用imageDetail.json

至于我的管道部署AppSpec

管道部署阶段设置如下所示: 输入工件:BuildArtifact、SourceArtifact;然后:

Amazon ECS任务定义:SourceArtifact taskdef.json AWS CodeDeploy AppSpec文件:SourceArtifact taskdef.json 动态更新任务定义映像:BuildArtifact

任务定义中的占位符文本:IMAGE1\u NAME …其中一些来源于本指南:

。。任务定义:

{
  "family": "devops-platform-ecs-task-def",
  "type": "AWS::ECS::TaskDefinition",
  "properties": {
    "containerDefinitions": [
      {
        "name": "pipeline_demo",
        "image": "<IMAGE1_NAME>",
        "cpu": "1024",
        "memory": "1024",
        "essential": true,
        "portMappings": [
          {
            "hostPort": 0,
            "protocol": "tcp",
            "containerPort": 80
          }
        ]
      }
    ],
    "ExecutionRoleArn": "arn:aws:iam::xxxxxx:role/devops_codepipeline",

    "NetworkMode": "null",
    "PlacementConstraints": [
        "type": "memberOf",
        "expression": ""
    ],
    "ProxyConfiguration": {
      "type": "APPMESH",
      "containerName": "",
      "properties": [
          {
              "name": "",
              "value": ""
          }
      ]
    },
    "RequiresCompatibilities": [
      "EC2"
    ],
    "Tags": [
      {
        "key": "",
        "value": ""
      }
    ],
    "TaskRoleArn": "",
    "Volumes": [
        {
            "name": "",
            "host": {
                "sourcePath": ""
            },
            "dockerVolumeConfiguration": {
                "scope": "task",
                "autoprovision": true,
                "driver": "",
                "driverOpts": {
                    "KeyName": ""
                },
                "labels": {
                    "KeyName": ""
                }
            }
        }
    ]
  }
}
尽管如此,我仍然得到了错误。。。


任何帮助都将不胜感激

您的任务定义无效。通过快速查看,我可以看到以下无效属性:

"type": "AWS::ECS::TaskDefinition",
请在此处查看示例任务定义[1]。我还建议从taskdef中删除任何无关的部分,这样它们就不会以任何方式进行干扰


[1]

事实上,我发现加入另一项AWSCODEDPLOYROLEFRECS政策解决了这个问题。到目前为止,我们一直通过控制台管理的aws CLI指南中引用了它,因此我在CLI中偶然发现了这一点。包含策略后,管道已通过问题列出的问题,但遇到另一个无效配置操作;容器列表不能为空。-你的答案可以解决哪一个问题?尽管如此,至少我还有一个更有意义的错误需要处理。

Hi@shariqmaws,我实际上发现加入另一项AWSCodeDeployRoleForECS政策解决了这个问题。到目前为止,我们一直通过控制台管理的aws CLI指南中引用了它,因此我偶然发现了这一点,并创建了一个服务角色CLI。包含策略后,管道已通过问题列出的问题,但遇到另一个无效配置操作;容器列表不能为空。-你的答案可以解决哪一个问题?尽管如此,至少我还有一个更有意义的错误需要处理。我投票支持这项努力,谢谢!
{
  "family": "devops-platform-ecs-task-def",
  "type": "AWS::ECS::TaskDefinition",
  "properties": {
    "containerDefinitions": [
      {
        "name": "pipeline_demo",
        "image": "<IMAGE1_NAME>",
        "cpu": "1024",
        "memory": "1024",
        "essential": true,
        "portMappings": [
          {
            "hostPort": 0,
            "protocol": "tcp",
            "containerPort": 80
          }
        ]
      }
    ],
    "ExecutionRoleArn": "arn:aws:iam::xxxxxx:role/devops_codepipeline",

    "NetworkMode": "null",
    "PlacementConstraints": [
        "type": "memberOf",
        "expression": ""
    ],
    "ProxyConfiguration": {
      "type": "APPMESH",
      "containerName": "",
      "properties": [
          {
              "name": "",
              "value": ""
          }
      ]
    },
    "RequiresCompatibilities": [
      "EC2"
    ],
    "Tags": [
      {
        "key": "",
        "value": ""
      }
    ],
    "TaskRoleArn": "",
    "Volumes": [
        {
            "name": "",
            "host": {
                "sourcePath": ""
            },
            "dockerVolumeConfiguration": {
                "scope": "task",
                "autoprovision": true,
                "driver": "",
                "driverOpts": {
                    "KeyName": ""
                },
                "labels": {
                    "KeyName": ""
                }
            }
        }
    ]
  }
}
"type": "AWS::ECS::TaskDefinition",