3

I have installed the Bitbucket addon to deploy with AWS CodeDeploy but for an unknown reason, I get this error "Unable to remove top level folder" when I try to deploy from the bitbucket view.

enter image description here

This is my appspec.yml

version: 0.0
os: linux
files:
   - source: /
   destination: /var/www/citytwig
hooks:
  AfterInstall:
    - location: scripts/configure.sh
    timeout: 300
    runas: root

I have already deployed other bitbucket repositories successfully, I'm wondering why this one doesn't work.

jlorie
  • 98
  • 1
  • 9

3 Answers3

4

Aws codedeploy tries to rollback previous deployment before it applies a new one. It can happen that you have deleted some files manually on the instance and now rollback script is failing.

Solution

Delete rollback scripts of codedeploy-agent on the instance.

if you are using ubuntu, ssh into instance and go to the directory

cd /opt/codedeploy-agent/deployment-root/deployment-instructions/

and look for a file that ends with -cleanup

delete this file.

Now try you deployment again.

Check out documentation, or read it in Rollback and Redeployment Workflow section of pdf

Depending on the rollback script the Deployment may fail with different messages, for me it was Directory not empty @ dir_s_rmdir

But it always fails on Install Event.

Yevgeniy Afanasyev
  • 37,872
  • 26
  • 173
  • 191
1

After a long searching, I realized that a file had Russian characters on his filename. It seems that the Bitbucket CodeDeploy Addon have issues with this kind of characters.

jlorie
  • 98
  • 1
  • 9
  • jlorie - We are facing the same issue but in our case, the characters are present in the node_modules folder which are package names for node dependencies. Eg: @agm,@angular We are using node with angular and hence these dependencies need to be checked in. If we remove these folders the deployment works successfully. – coderunner Nov 27 '19 at 05:34
0

I had got the exact error, but in my case, it was a typo in the file name appspec.yml

Seff
  • 1,546
  • 1
  • 17
  • 19