Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The CodeDeploy agent did not find an AppSpec file within the unpacked revision directory at revision-relative path "appspec.yml"

Based on below error message codedeploy copies my archive folder to some temp location. i can locate my archive.zip folder after deployment-archive folder.

The CodeDeploy agent did not find an AppSpec file within the unpacked revision directory at revision-relative path "appspec.yml". The revision was unpacked to directory "/opt/codedeploy-agent/deployment-root/59a04892-4afd-4e82-9335-52e8b6047d4b/d-WZDFGDBHU/deployment-archive", and the AppSpec file was expected but not found at path "/opt/codedeploy-agent/deployment-root/59a04892-4afd-4e82-9335-52e8b6047d4b/d-WZDFGDBHU/deployment-archive/appspec.yml". Consult the AWS CodeDeploy Appspec documentation for more information at AWS website

but it looks appspec.yml immediately after deployment-archive folder. But its located deployment-archive/archive/appspec.yml

appspec.yml and my war file all zipped in S3

how to resolve this issue?

like image 728
sam Avatar asked Dec 13 '22 14:12

sam


2 Answers

I also encountered this because I found that CodeDeploy was filling up disk space with logs/deploy info at "/opt/codedeploy-agent/deployment-root/#####yourNumberWillBeDifferent#####". I had deleted all the directories in this location and on the very next deploy I experienced this issue. I found that if you keep the latest directory in this location then you will not get the error. What I wound up doing is have a script run every hour that deletes all the directories in this location except the latest one.

You probably deleted the the folder "d-WZDFGDBHU". CodeDeploy looked at the logs/info from the very last deployment it did on the instance and uses some info from there but could not find it. That is why it mentioned -

''' The revision was unpacked to directory "/opt/codedeploy-agent/deployment-root/59a04892-4afd-4e82-9335-52e8b6047d4b/d-WZDFGDBHU/deployment-archive", and the AppSpec file was expected but not found at path "/opt/codedeploy-agent/deployment-root/59a04892-4afd-4e82-9335-52e8b6047d4b/d-WZDFGDBHU/deployment-archive/appspec.yml" ''' d-WZDFGDBHU is the Deployment ID of the last deployment that was performed prior to the one you just tried.

I don't know why CodeDeploy needs to refer to the last deployment but indeed it does!!

Note that this only happens on in place deployments - not blue green.

I also discovered this -

CodeDeploy keeps a number of the last deployments to allow you to rollback to previous versions. By default it keeps the last 5 but this is configurable using the codedeploy agent config: https://docs.aws.amazon.com/codedeploy/latest/userguide/reference-agent-configuration.html

The setting that controls this is :max_revisions:

like image 57
ErnieAndBert Avatar answered May 04 '23 23:05

ErnieAndBert


Found the issue.Instead of selecting appec.yml , myapp file and zipping them,i created folder for them and then created zip file. I should have created zip file just by selecting files, without creating folder for them. Wasted lot of time on this issue :(

like image 31
sam Avatar answered May 04 '23 22:05

sam