如何修复aws CODE BUILD COMMAND_EXECUTION_ERROR退出状态255

问题描述 投票:0回答:1

我使用aws服务代码配置CICD命令行来构建桩堆线等,以更新我的ecs fargate集群中的deploymnet。 --services xxxxx。原因:退出状态255“

我已经尝试通过“ AmazonECS_FullAccess”策略为代码构建角色提供权限。

post_build:  
    commands:  
      - echo Build completed on `date`  
      - echo Pushing the Docker images...  
      - docker push $REPOSITORY_URI:latest  
      - docker push $REPOSITORY_URI:$IMAGE_TAG  
      - echo Writing image definitions file...  
      - printf '[{"name":"xxxxxxx","imageUri":"%s"}]' $REPOSITORY_URI:$IMAGE_TAG > imagedefinitions.json  
      - cat imagedefinitions.json 
      - echo Updating ECSfargate service ...  
      - aws ecs describe-services --services xxxxxxxxxxxxxxxxx 
      - aws ecs update-service --service xxxxxxxxxxxxxxxxx --desired-count 2 --no-force-new-deployment  

amazon-web-services amazon-iam amazon-ecs aws-codebuild
1个回答
0
投票
255-命令失败。 CLI或发出请求的服务均抛出错误。

https://docs.aws.amazon.com/cli/latest/topic/return-codes.html

正如您提到的那样,您已经提供了ECS对CB角色的完全访问权限,接下来您可以检查的是命令失败的原因:ecs describe或ecs update-service失败吗?因为如果Fargate服务不稳定,将导致错误255。

我建议:

1)只需离开ecs describe命令,看看是否可行。

2)如果(1)成功,则如果Fargate Taskdef具有logGroup条目,请执行ecs update-service并在AWS ECS控制台和/或CW日志组中监视服务。

© www.soinside.com 2019 - 2024. All rights reserved.