跳至内容

CodeBuild Phases Failure

0

I setup a CI/CD pipeline (CodeCommit -> CodeBuild -> CodeDeploy) controlled by CodePipeline Enter image description here

Whether using environment variables or hardcoded values, I receive the same error. I made sure my service role has the below permissions:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "ecr:GetDownloadUrlForLayer",
        "ecr:BatchGetImage",
        "ecr:CompleteLayerUpload",
        "ecr:UploadLayerPart",
        "ecr:InitiateLayerUpload",
        "ecr:BatchCheckLayerAvailability",
        "ecr:PutImage"
      ],
      "Resource": "arn:aws:ecr:eu-west-1:<ACCOUNT_ID>:repository/<Respository_name>"
    }
  ]
}

2 回答
1
已接受的回答

Hi, your role needs more permissions than the above. See https://docs.aws.amazon.com/codebuild/latest/userguide/setting-up.html#setting-up-service-role for the full list

专家
已回答 3 年前
  • I noticed that the result is the same as per my below comment:

  • The action ecr:GetAuthenticationToken needs to have '*' as its resource.

0

Hi, please send the log error from the pipeline itself?

已回答 3 年前
  • [Container] 2023/06/22 21:07:31 Command did not exit successfully aws ecr get-login --region eu-west-1 | docker login --username AWS --password-stdin 883907968008.dkr.ecr.eu-west-1.amazonaws.com exit status 1 [Container] 2023/06/22 21:07:31 Phase complete: PRE_BUILD State: FAILED [Container] 2023/06/22 21:07:31 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: aws ecr get-login --region eu-west-1 | docker login --username AWS --password-stdin 883907968008.dkr.ecr.eu-west-1.amazonaws.com. Reason: exit status 1

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。