CodeDeploy 脚本在指定位置不存在 - appspec.yml

w0n*_*s88 0 deployment amazon-ec2 amazon-web-services aws-code-deploy

我正在尝试使用 CodeDeploy 在 AWS 上部署我的应用程序。

这是我的 appspec.yml 文件:

version: 0.0

os: linux

files:
  - source: /
    destination: /home/ec2-user/todos // <== this dir already exists in my instance

hooks:
  ApplicationStop:
    ...

  BeforeInstall:
    - location: scripts/prerequisites
      timeout: 1200
      runas: root

  AfterInstall:
    ...
  ApplicationStart:
    ...
  ValidateService:
    ...
Run Code Online (Sandbox Code Playgroud)

我不断收到以下错误:

错误代码:ScriptMissing

脚本名称:脚本/先决条件

消息:指定位置不存在脚本:/opt/codedeploy-agent/deployment-root/2e557520-7ffe-4881-8c7c-991952c56e05/d-UWR3Z01FE/deployment-archive/scripts/prerequisites

日志尾部:LifecycleEvent - BeforeInstall

我的脚本存储在名为“scripts”的文件中,该文件位于我的应用程序的根目录中。

我错过了什么?还是做错了?如果有人能在正确的方向上帮助我,我将不胜感激!

w0n*_*s88 5

好的,看来问题只是一个错字。我忘记将文件扩展名写入我的脚本 (.sh)

像这样:

BeforeInstall:
    - location: scripts/prerequisites.sh // <--- this fixed it
      timeout: 1200
      runas: root
Run Code Online (Sandbox Code Playgroud)

希望它可以帮助任何人。