AWS CodeDeploy Appspec.yml 文件未复制到目标

AWS CodeDeploy Appspec.yml files are not being copied to destination

我的文件已正确复制到 EC2 实例以进行部署,但未复制到目标位置。我得到了这样的 appspec.yml 文件:

ubuntu@ip:~$ cat /opt/coded*/deployment-root/*/*/de*/appspec.yml
version: 0.0
os: linux
# I also tried with source: /
files:
  - source: .
    destination: /home/ubuntu/
file_exists_behavior: OVERWRITE
# notes

# ------------------------------------------------------------------------------------

# To learn more about hooks, visit the docs here:
# https://docs.aws.amazon.com/codedeploy/latest/userguide/reference-appspec-file-structure-hooks.html#appspec-hooks-server
hooks:
  BeforeInstall:
    - location: scripts/install_dependencies
      timeout: 300
      runas: root
  ApplicationStart:
    - location: scripts/start_server
      timeout: 300
      runas: root
  ApplicationStop:
    - location: scripts/stop_server
      timeout: 300
      runas: root

我也试过将 source 设置为 source: / 结果相同;什么都没有复制

而且我看到我的文件都在 /opt/coded* 等路径中。但为什么 CodeDeploy 代理不将我的文件复制到目的地? Download bundle 挂钩很好,我遇到的唯一错误是当我需要实际访问我的文件时出现在 ApplicationStart 挂钩中。

注意:我使用 GitHub 作为我的修订存储,而不是 S3,如果这有帮助的话

编辑:我的 install_dependencies 脚本中可能有一些有用的信息,我 运行 类似于:

cd /home/ubuntu/
pip install -r requirements.txt

pip安装是找不到文件的那一行

推理:https://docs.aws.amazon.com/codedeploy/latest/userguide/reference-appspec-file-example.html#appspec-file-example-server

钩子的顺序。在 AfterInstall 挂钩之前复制文件。