CodeDeploy - BeforeInstall ScriptMissing

0

I'm trying to deploy my spring boot application with AWS CodeDeploy in a EC2 linux machine but the process is stoping in BeforeInstall and throwing the message error: Script does not exist at specified location: /opt/codedeploy-agent/deployment-root/eb41ddde-ad23-492e-b3a0-203e1f77fb93/d-JIGRR5O5J/deployment-archive/server_clear.sh

my appspec.yml

version: 0.0
os: linux
files:
  - source: /
    destination: /home/ec2-user/server
permissions:
  - object: /
    pattern: "**"
    owner: ec2-user
    group: ec2-user
hooks:
  BeforeInstall:
    - location: script/server_clear.sh
      timeout: 300
      runas: ec2-user
  AfterInstall:
    - location: fix_privileges.sh
      timeout: 300
      runas: ec2-user
  ApplicationStart:
    - location: server_start.sh
      timeout: 20
      runas: ec2-user
  ApplicationStop:
    - location: server_stop.sh
      timeout: 20
      runas: ec2-user

buildspec.yml

version: 0.2
phases:
  install:
    runtime-versions:
      java: corretto11
  build:
    commands:
      - mvn clean install
  post_build:
    commands:
      - echo Build completed
artifacts:
  files:
    - target/*.jar
    - scripts/*.sh
    - appspec.yml
  discard-paths: yes

Lucena
已提问 2 年前2302 查看次数
1 回答
0

Hello,

Please make sure that your are using the correct relative path. In AppSpec.yaml, I noticed that server_clear.sh path is prefixed with script/ which is not the case of the remaining scripts. The location of scripts you specify in the hooks section is relative to the root of the application revision bundle.

Please check the references below:

https://docs.aws.amazon.com/codedeploy/latest/userguide/application-revisions-appspec-file.html

https://docs.aws.amazon.com/codedeploy/latest/userguide/application-revisions-plan.html

profile pictureAWS
已回答 2 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则