AWS 部署 "Unable to remove top level folder"

AWS deployment "Unable to remove top level folder"

我已经安装了 Bitbucket 插件以使用 AWS CodeDeploy 进行部署,但由于未知原因,当我尝试从 bitbucket 视图进行部署时出现此错误 "Unable to remove top level folder" .

这是我的 appspec.yml

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

我已经成功部署了其他 bitbucket 存储库,我想知道为什么这个存储库不起作用。

找了半天,发现一个文件的文件名中有俄文字符。 Bitbucket CodeDeploy Addon 似乎对这种字符有问题。

Aws codedeploy 在应用新部署之前尝试回滚以前的部署。可能是您在实例上手动删除了一些文件,现在回滚脚本失败了。

解决方案

删除实例上 codedeploy-agent 的回滚脚本。

如果您正在使用 ubuntu,ssh 进入实例并转到目录

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

并查找以 -cleanup

结尾的文件

删除这个文件。

现在再次尝试部署。

查看 documentation, or read it in Rollback and Redeployment Workflow section of pdf

根据回滚脚本,部署可能会失败并显示不同的消息,对我来说是 Directory not empty @ dir_s_rmdir

但它总是在 Install 事件上失败。

我得到了确切的错误,但就我而言,这是文件名中的错字 appspec.yml