问题
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.
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.
回答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.
回答2:
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.
回答3:
I had got the exact error, but in my case, it was a typo in the file name appspec.yml
来源:https://stackoverflow.com/questions/41684822/aws-deployment-unable-to-remove-top-level-folder