【问题标题】:Is CodeDeploy requires to keep deployment scripts in build archive?CodeDeploy 是否需要将部署脚本保留在构建存档中?
【发布时间】:2016-11-11 10:50:53
【问题描述】:

我尝试部署托管在 S3 上的构建存档并在 beforeInstall 期间收到以下错误:

Script does not exist at specified location: /opt/codedeploy-agent/deployment-root/47208456650-458497-4028-97qa6-ef3a7sa30fa96f/d-0S472LBGI/deployment-archive/deployment/backup.sh

我的构建档案只包含源代码。构建脚本永久位于我的服务器上。

AppSpec.yml 看起来像

version: 0.0
os: linux

files:
  - source: /build.tgz
    destination: /var/www/proj/deployment <- deployment scripts are here
hooks:
  BeforeInstall:
    - location: backup.sh
      runas: root
      timeout: 300
  AfterInstall:
    - location: deploy.sh
      runas: root
      timeout: 300
  ApplicationStart:
    - location: applicationStart.sh
      runas: root
      timeout: 300

【问题讨论】:

  • 只需添加到@Castrohenge,脚本的位置是相对于源包,而不是目标文件夹。这就是它找不到 backup.sh 脚本的原因

标签: amazon-web-services deployment continuous-integration aws-code-deploy


【解决方案1】:

我一直在包中包含我的部署脚本。尝试将位置设置为绝对值。例如。 /var/www/proj/deployment/backup.sh

source 指的是包中的文件/目录。该包将被提取到该位置:

/opt/codedeploy-agent/deployment-root/47208456650-458497-4028-97qa6-ef3a7sa30fa96f/d-0S472LBGI/deployment-archive/deployment

“目标”指示您要将文件/目录复制到的位置。

您可以指定多个文件。例如:

files:
  - source: Config/config.txt
    destination: /webapps/Config
  - source: source
    destination: /webapps/myApp

这里是 AppSpec 文档:http://docs.aws.amazon.com/codedeploy/latest/userguide/app-spec-ref-structure.html

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-09-09
    • 1970-01-01
    • 1970-01-01
    • 2010-09-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-02-12
    相关资源
    最近更新 更多