AWS CodePipeline with ECS Blue/Green deployment fails with internal error

牧云@^-^@ 提交于 2021-02-11 14:05:11

问题


I have a CodePipeline set up where changes to code builds and pushes an image to ECR. I am looking to automate updating ECS with the new image as it is built. I have configured the ECS Blue/Green action but when it runs it fails almost immediately with a message about an "Internal Error". There is no failed deployment created in CodeDeploy.

I have configured CodePipeline with two inputs:

  1. the source code used to build the image
  2. a zip in S3 containing the appspec.yaml and the taskdef.json

When either input changes I rebuild the container and push to ECR tagged 'latest'. The next step should be a Blue/Green deployment to ECS. I have configured CodeDeploy and the job works if triggered manually.

When it is triggered via CodePipeline it will fail and I receive a message "Action execution failed InternalError. Error reference code: <some id>". I suspect that there may be some underlying issue with IAM but I can't find where to start looking at this stage. There is no failed deployment shown in CodeDeploy so I don't see a way to get more information about what has failed.

My policy for CodePipeline is copied from the one documented here: https://docs.aws.amazon.com/codepipeline/latest/userguide/how-to-custom-role.html#view-default-service-role-policy

I have read through the troubleshooting docs here: https://docs.aws.amazon.com/codepipeline/latest/userguide/troubleshooting.html

I believe my issue is similar to the one described here: https://forums.aws.amazon.com/thread.jspa?messageID=897822


回答1:


After a bit more reading of similar posts here, on serverfault.com and the AWS forums I have been able to resolve this.

In my case the issue was that my taskdef.json was not valid. It took me several hours going through each step to realise that while it was valid JSON it only included the container definitions section. On fixing that it appears to now be working correctly.

In the end I have two, related, CodePipelines. One for deploying updated ECR images to ECS (described above) and the other which updates infrastructure and generates a zip containing taskdef.json and appspec.yaml. If that zip changes then my container pipeline runs; likewise if the container image source changes. It needs more testing but right now this appears to be working very smoothly.



来源:https://stackoverflow.com/questions/55897126/aws-codepipeline-with-ecs-blue-green-deployment-fails-with-internal-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!