Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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/0bb5a5aa-5894-4575-a69c-a7a4e79b4cdf/d-HQ5GBC7SW/deployment-archive"

The AppSpec file was expected but not found at path "/opt/codedeploy-agent/deployment-root/0bb5a5aa-5894-4575-a69c-a7a4e79b4cdf/d-HQ5GBC7SW/deployment-archive/appspec.yml".

like image 413
Raghuram Milkuri Avatar asked Nov 27 '18 13:11

Raghuram Milkuri


2 Answers

I had the same problem and the other answer helped me reach the right conclusion. In my situation, I had the appspec.yml file in my git repo, but I forgot to add it to the artifact files section. As a result, the appspec.yml wasn't included in the zip and so the deployment step couldn't find it.

In your buildspec.yml, add:

artifacts:
  files:
    - appspec.yml
    - ... other files to include in your build ...

I had some other errors in my deployment configuration too. Looking at the bottom of the log file helped discover them:

less /var/log/aws/codedeploy-agent/codedeploy-agent.log

At one point, my EC2 instance also hung when trying to run a deployment and stopping and restarting the codedeploy agent didn't help. I had to completely restart the EC2 instance.

These docs where helpful: https://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.html

like image 115
Allen Avatar answered Sep 29 '22 15:09

Allen


Are you putting the appspec.yml file at root level of your folder bundle? If yes, how are you creating the bundle? If you are just creating a .zip then you need to make sure you are adding the files to the zip instead of a folder.

like image 24
Aura Herrera Avatar answered Sep 29 '22 17:09

Aura Herrera