AWS CodePipeline “An AppSpec file is required, but could not be found in the revision”

风流意气都作罢 提交于 2020-04-16 05:40:40

问题


I'm trying to set up a deployment pipeline using CodeCommit, ECR and ECS. My pipeline passes the source and build steps fine. I can deploy manually via CodeDeploy if I upload my appspec.yaml file to an s3 bucket. Deploys triggered by a change to my CodeCommit repository always fail with the error:

An AppSpec file is required, but could not be found in the revision

When I look at the details of the failed deployment, I can pull up the revision location, which shows this:

I see in the troubleshooting code deploy section that some editors can cause issues. I'm using vscode on linux, so I don't think that should be an issue. Also, if I upload the same appspec file to s3 and reference it from a manual deployment, it works fine.

I've also tried uploading the same file, but named appspec.yml. Still failed.

The role that this deployment uses has full s3 access, not sure if it could be any other permissions-related problem.

Here is my codepipeline definition:

{
"pipeline": {
    "roleArn": "arn:aws:iam::690517313378:role/service-role/AWSCodePipelineServiceRole-us-east-1-blottermappertf", 
    "stages": [
        {
            "name": "Source", 
            "actions": [
                {
                    "inputArtifacts": [], 
                    "name": "Source", 
                    "region": "us-east-1", 
                    "actionTypeId": {
                        "category": "Source", 
                        "owner": "AWS", 
                        "version": "1", 
                        "provider": "CodeCommit"
                    }, 
                    "outputArtifacts": [
                        {
                            "name": "SourceArtifact"
                        }
                    ], 
                    "configuration": {
                        "PollForSourceChanges": "false", 
                        "BranchName": "master", 
                        "RepositoryName": "blottermapper"
                    }, 
                    "runOrder": 1
                }
            ]
        }, 
        {
            "name": "Build", 
            "actions": [
                {
                    "inputArtifacts": [
                        {
                            "name": "SourceArtifact"
                        }
                    ], 
                    "name": "Build", 
                    "region": "us-east-1", 
                    "actionTypeId": {
                        "category": "Build", 
                        "owner": "AWS", 
                        "version": "1", 
                        "provider": "CodeBuild"
                    }, 
                    "outputArtifacts": [
                        {
                            "name": "BuildArtifact"
                        }
                    ], 
                    "configuration": {
                        "ProjectName": "blottermapper", 
                        "EnvironmentVariables": "[{\"name\":\"REPOSITORY_URI\",\"value\":\"690517313378.dkr.ecr.us-east-1.amazonaws.com/net.threeninetyfive\",\"type\":\"PLAINTEXT\"}]"
                    }, 
                    "runOrder": 1
                }
            ]
        }, 
        {
            "name": "Deploy", 
            "actions": [
                {
                    "inputArtifacts": [
                        {
                            "name": "BuildArtifact"
                        }
                    ], 
                    "name": "Deploy", 
                    "region": "us-east-1", 
                    "actionTypeId": {
                        "category": "Deploy", 
                        "owner": "AWS", 
                        "version": "1", 
                        "provider": "CodeDeploy"
                    }, 
                    "outputArtifacts": [], 
                    "configuration": {
                        "ApplicationName": "blottermappertf", 
                        "DeploymentGroupName": "blottermappertf"
                    }, 
                    "runOrder": 1
                }
            ]
        }
    ], 
    "artifactStore": {
        "type": "S3", 
        "location": "codepipeline-us-east-1-634554346591"
    }, 
    "name": "blottermappertf", 
    "version": 1
}, 
"metadata": {
    "pipelineArn": "arn:aws:codepipeline:us-east-1:690517313378:blottermappertf", 
    "updated": 1573712712.49, 
    "created": 1573712712.49
}

}


回答1:


"An AppSpec file is required, but could not be found in the revision"

The above error is related to the wrong configuration for your codepipeline. To perform ECS codedeploy deployments, the provider in your codepipeline stage for deployment must be "ECS (blue/green)" not "Codedeploy" (codedeploy is used for EC2 deployments.)

Even though in the back-end it uses codedeploy, the name of the provider is "ECS (blue/green)".




回答2:


I found the answer here:

The deployment specifies that the revision is a null file, but the revision provided is a zip file

I was using the wrong action provider when setting up my deployment. I chose ECS and I should have chosen ECS Blue/Green.

The ambiguous error message made debugging and searching for answers on stack overflow difficult for me.



来源:https://stackoverflow.com/questions/58851354/aws-codepipeline-an-appspec-file-is-required-but-could-not-be-found-in-the-rev

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